ccc.web.filters
Class LegacyLinkFilter

java.lang.Object
  extended by ccc.web.filters.LegacyLinkFilter
All Implemented Interfaces:
javax.servlet.Filter

public final class LegacyLinkFilter
extends java.lang.Object
implements javax.servlet.Filter

A servlet to redirect old CCC6 URLs to the corresponding CCC7 url.
Supports links in the following forms:
- /2334.html
- /233.4.63.html
- /files/my%20file.txt
- /images/my%20image.jpg
- /foo?p_service=Content.show&p_applic=CCC&pContentID=557

Author:
Civic Computing Ltd.

Field Summary
static java.util.regex.Pattern FILE_PATTERN
          FILE_PATTERN : Pattern.
static java.util.regex.Pattern IMAGE_PATTERN
          IMAGE_PATTERN : Pattern.
static java.util.regex.Pattern PAGE_PATTERN
          PAGE_PATTERN : Pattern.
 
Constructor Summary
LegacyLinkFilter()
          Constructor.
LegacyLinkFilter(Resources resources)
          Constructor.
 
Method Summary
 void destroy()
          
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          
 void init(javax.servlet.FilterConfig filterConfig)
          
protected  boolean isController(java.util.Map<java.lang.String,java.lang.String> queryParams)
          Determine whether the request is for a CCC6 controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAGE_PATTERN

public static final java.util.regex.Pattern PAGE_PATTERN
PAGE_PATTERN : Pattern.


FILE_PATTERN

public static final java.util.regex.Pattern FILE_PATTERN
FILE_PATTERN : Pattern.


IMAGE_PATTERN

public static final java.util.regex.Pattern IMAGE_PATTERN
IMAGE_PATTERN : Pattern.

Constructor Detail

LegacyLinkFilter

public LegacyLinkFilter()
Constructor.


LegacyLinkFilter

public LegacyLinkFilter(Resources resources)
Constructor.

Parameters:
resources - The resource API for this filter.
Method Detail

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException

Specified by:
doFilter in interface javax.servlet.Filter
Throws:
java.io.IOException
javax.servlet.ServletException

isController

protected boolean isController(java.util.Map<java.lang.String,java.lang.String> queryParams)
Determine whether the request is for a CCC6 controller.

Parameters:
queryParams - The requeste's query parameters.
Returns:
True if the request is to a CCC6 controller, false otherwise.

destroy

public void destroy()

Specified by:
destroy in interface javax.servlet.Filter

init

public void init(javax.servlet.FilterConfig filterConfig)

Specified by:
init in interface javax.servlet.Filter


Copyright © 2010. All Rights Reserved.