com.mortbay.HTTP.Handler
Class TranslateHandler

java.lang.Object
  |
  +--com.mortbay.HTTP.Handler.NullHandler
        |
        +--com.mortbay.HTTP.Handler.TranslateHandler

public class TranslateHandler
extends NullHandler

Request path translation handler

This Handler can translate a prefix of a request paths to another path.

The Translate handler is configured with PathMap mapping from the old path to the new path. Translations are applied, longest match first, until no more translations match. If the PathMap key "TranslateURI" is set to a value of true, then translations are reflected in the requests URI.

Version:
$Id: TranslateHandler.java,v 2.7 1999/10/09 15:07:26 gregw Exp $
Author:
Greg Wilkins
See Also:
Interface.HttpHandler

Fields inherited from class com.mortbay.HTTP.Handler.NullHandler
httpServer
 
Constructor Summary
TranslateHandler(PathMap translations)
           
TranslateHandler(java.util.Properties properties)
          Construct basic auth handler.
 
Method Summary
 void handle(HttpRequest request, HttpResponse response)
          Constructor
 void setProperties(java.util.Properties properties)
          Configure from Properties.
 java.lang.String translate(java.lang.String address)
          Translate a path string.
 
Methods inherited from class com.mortbay.HTTP.Handler.NullHandler
destroy, getProperties, servlet, servletNames, setServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TranslateHandler

public TranslateHandler(java.util.Properties properties)
                 throws java.io.IOException
Construct basic auth handler.
Parameters:
properties - Passed to setProperties

TranslateHandler

public TranslateHandler(PathMap translations)
Method Detail

setProperties

public void setProperties(java.util.Properties properties)
                   throws java.io.IOException
Configure from Properties.
Overrides:
setProperties in class NullHandler
Parameters:
properties -  
Throws:
java.io.IOException -  

handle

public void handle(HttpRequest request,
                   HttpResponse response)
            throws java.lang.Exception
Description copied from interface: HttpHandler
Constructor
Overrides:
handle in class NullHandler
Tags copied from interface: HttpHandler
Parameters:
request - The HTTP requests to be handled
response - The HTTP response to be used.

translate

public java.lang.String translate(java.lang.String address)
Description copied from interface: HttpHandler
Translate a path string. Used by getRealPath method.
Overrides:
translate in class NullHandler
Tags copied from interface: HttpHandler
Returns:
the translated path