Secure Redirector filter ver. 1.4


This is a Java servlet filter (as per Servlet API 2.3). This filter lets you redirect incoming non-secure requests to the secure equivalent. In other words if requests uses http protocol it will be redirected to the SSL equivalent (https).

How to use it:

a) download httpsflt.jar and save it in WEB-INF/lib

b) describe this filter in your web.xml file. There is one optional parameter port describes a port for SSL connection in case of it is not 443.
 


<filter>
  <filter-name>SecureRedirect</filter-name>
  <filter-class>com.cj.secure.secureRedirectFilter</filter-class>
</filter>

or
 


<filter>
  <filter-name>SecureRedirect</filter-name>
  <filter-class>com.cj.secure.secureRedirectFilter</filter-class>
  <init-param>
   <param-name>port</param-name>
   <param-value>your_port_number</param-value>
  </init-param>
</filter>

c) describe a mapping for this filter in web.xml
 


<filter-mapping>
  <filter-name>SecureRedirect</filter-name>
  <url-pattern>*.jsp</url-pattern>
</filter-mapping>

in this case filter will be on for the each .jsp file. So each http request to your jsp files will be redirected to the SSL equivalent (https)

   For downloading:

    Filter:  httpsflt.jar
 

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in Coldtags: