可以在你WEB应用的web.xml文件中配置如下:
     <security-constraint>
        <web-resource-collection>
            <web-resource-name>Protected Area</web-resource-name>
            <url-pattern>/download/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
        </auth-constraint>
    </security-constraint> 

解决方案 »

  1.   

    是的。
    不想这样的话,可以考虑用Filter。
      

  2.   

    光改配置不能做到? 不只是TOMCAT的配置啊, APACHE的也可以。 
      

  3.   

    做过滤器只是往目录中增加一个.class文件,然后修改下web.xml文件,又不是很复杂。
      

  4.   


    <urlrewrite> 
        <rule> 
            <from>^[\./]*/upload/.*\.jsp$</from> 
            <to>/deny.html</to> 
        </rule> 
    </urlrewrite>