org.exist.http.urlrewrite
Class RewriteConfig

java.lang.Object
  extended by org.exist.http.urlrewrite.RewriteConfig

public class RewriteConfig
extends Object

Handles static mapping configuration for the @link XQueryURLRewrite filter, defined in controller-config.xml. The static mapping is used to map base paths to base controllers or servlets.


Field Summary
static String CONFIG_FILE
           
static String MAP_ELEMENT
           
static String PATTERN_ATTRIBUTE
           
static String SERVER_NAME_ATTRIBUTE
          Adding server-name="www.example.com" to a root tag in the controller-config.xml file.

i.e.

<root server-name="example1.com" pattern="/*" path="xmldb:exist:///db/org/example1/"/>
<root server-name="example2.com" pattern="/*" path="xmldb:exist:///db/org/example2/"/>

Will redirect http://example1.com to /db/org/example1/
and http://example2.com to /db/org/example2/

If there is no server-name attribute on the root tag, then the server name is ignored while performing the URL rewriting.
 
Constructor Summary
RewriteConfig(XQueryURLRewrite urlRewrite)
           
 
Method Summary
 URLRewrite lookup(HttpServletRequest request)
          Lookup the given path in the static mappings table.
 URLRewrite lookup(String path, String serverName, boolean staticMapping)
          Lookup the given path in the static mappings table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_FILE

public static final String CONFIG_FILE
See Also:
Constant Field Values

MAP_ELEMENT

public static final String MAP_ELEMENT
See Also:
Constant Field Values

PATTERN_ATTRIBUTE

public static final String PATTERN_ATTRIBUTE
See Also:
Constant Field Values

SERVER_NAME_ATTRIBUTE

public static final String SERVER_NAME_ATTRIBUTE
Adding server-name="www.example.com" to a root tag in the controller-config.xml file.

i.e.

<root server-name="example1.com" pattern="/*" path="xmldb:exist:///db/org/example1/"/>
<root server-name="example2.com" pattern="/*" path="xmldb:exist:///db/org/example2/"/>

Will redirect http://example1.com to /db/org/example1/
and http://example2.com to /db/org/example2/

If there is no server-name attribute on the root tag, then the server name is ignored while performing the URL rewriting.

See Also:
Constant Field Values
Constructor Detail

RewriteConfig

public RewriteConfig(XQueryURLRewrite urlRewrite)
              throws ServletException
Throws:
ServletException
Method Detail

lookup

public URLRewrite lookup(HttpServletRequest request)
                  throws ServletException
Lookup the given path in the static mappings table.

Parameters:
request - use the path from this request
Returns:
the URLRewrite instance for the mapping or null if none was found
Throws:
ServletException

lookup

public URLRewrite lookup(String path,
                         String serverName,
                         boolean staticMapping)
                  throws ServletException
Lookup the given path in the static mappings table.

Parameters:
path - path to look up
staticMapping - don't return redirects to other controllers, just static mappings to servlets.
Returns:
the URLRewrite instance for the mapping or null if none was found
Throws:
ServletException


Copyright (C) Wolfgang Meier. All rights reserved.