org.directwebremoting.impl
Class DefaultPageNormalizer

java.lang.Object
  extended by org.directwebremoting.impl.DefaultPageNormalizer
All Implemented Interfaces:
PageNormalizer

public class DefaultPageNormalizer
extends java.lang.Object
implements PageNormalizer

The default implementation of PageNormalizer attempts to read from WEB-INF/web.xml to find a welcome-files element, and uses a default of removing "index.html" and "index.jsp" if this proceedure fails.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Field Summary
protected static javax.xml.parsers.DocumentBuilderFactory buildFactory
          How we create new documents
protected static java.lang.Object initLock
          The lock to prevent 2 things from calling init at the same time
protected  boolean normalizeIncludesQueryString
          Does the page normalizer include query strings in it's definition of pages?
protected  ServletContext servletContext
          We need one of these to do the init process.
protected  java.util.List welcomeFiles
          The list of filename components to strip to normalize a filename
 
Constructor Summary
DefaultPageNormalizer()
           
 
Method Summary
protected static java.util.List getDefaultWelcomeFileList()
          Use the default list of components to strip to normalize a filename
protected static java.util.List getWebXmlWelcomeFileList(ServletContext context)
          Accessor for the list of components to strip to normalize a filename
 java.lang.String normalizePage(java.lang.String unnormalized)
          Take an un-normalized URL and turn it into the canonical form for that URL.
 void setNormalizeIncludesQueryString(boolean normalizeIncludesQueryString)
          Does the page normalizer include query strings in it's definition of pages?
 void setServletContext(ServletContext servletContext)
           
 void setWelcomeFileList(java.util.List welcomeFiles)
          Accessor for the list of components to strip to normalize a filename
 void setWelcomeFiles(java.lang.String welcomeFileNames)
          Accessor for the list of components to strip to normalize a filename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletContext

protected ServletContext servletContext
We need one of these to do the init process.


normalizeIncludesQueryString

protected boolean normalizeIncludesQueryString
Does the page normalizer include query strings in it's definition of pages?


buildFactory

protected static javax.xml.parsers.DocumentBuilderFactory buildFactory
How we create new documents


initLock

protected static final java.lang.Object initLock
The lock to prevent 2 things from calling init at the same time


welcomeFiles

protected java.util.List welcomeFiles
The list of filename components to strip to normalize a filename

Constructor Detail

DefaultPageNormalizer

public DefaultPageNormalizer()
Method Detail

normalizePage

public java.lang.String normalizePage(java.lang.String unnormalized)
Description copied from interface: PageNormalizer
Take an un-normalized URL and turn it into the canonical form for that URL. In general this will work by stripping off extra components like index.html rather than adding them in.

Specified by:
normalizePage in interface PageNormalizer
Parameters:
unnormalized - The raw string from the browser
Returns:
A canonical form that DWR uses to compare pages for equivalence.

getWebXmlWelcomeFileList

protected static java.util.List getWebXmlWelcomeFileList(ServletContext context)
Accessor for the list of components to strip to normalize a filename

Parameters:
context - Our route to reading web.xml
Returns:
A list of the welcome files from web.xml or null if none are found there

getDefaultWelcomeFileList

protected static java.util.List getDefaultWelcomeFileList()
Use the default list of components to strip to normalize a filename

Returns:
A list of the default welcome files

setWelcomeFileList

public void setWelcomeFileList(java.util.List welcomeFiles)
Accessor for the list of components to strip to normalize a filename

Parameters:
welcomeFiles - the welcomeFiles to set

setWelcomeFiles

public void setWelcomeFiles(java.lang.String welcomeFileNames)
Accessor for the list of components to strip to normalize a filename

Parameters:
welcomeFileNames - the welcomeFiles to set as a comma or newline separated list.

setNormalizeIncludesQueryString

public void setNormalizeIncludesQueryString(boolean normalizeIncludesQueryString)
Does the page normalizer include query strings in it's definition of pages?

Parameters:
normalizeIncludesQueryString - The new value

setServletContext

public void setServletContext(ServletContext servletContext)
Parameters:
servletContext - the servletContext to set