This small servlet redirects users to the home page of your web applications. You can use it to prevent your clients from direct using URLs like http://your_host/your_web_app/servlet/YourServletName to bypass your security settings and/or filters that could be associated with custom URLs in your web applications.
How to use it:
a) download protectPackage.jar and save it in WEB-INF/lib
b) describe this servlet in web.xml file.
c) describe a mapping for this servlet in web.xml file
in this case servlets invoker /servlet/SomeServletName will be turned off. protectServlets simply redirects all such requests to the home page of your web application (defined by getContextPath() call).
Also you can describe a special page for redirection as an initial parameter for this servlet.
Parameter name is home. E.g.:
For downloading:
Protect package: protectPackage.jar
See also JSOS - the largest collection of servlets and filters.