org.jmage.mapper
Class ServletMapper

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.jmage.mapper.ServletMapper
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ServletMapper
extends javax.servlet.http.HttpServlet

Maps ImageRequests based on queryString params.

See Also:
Serialized Form

Field Summary
static java.lang.String CHAIN_DELIMITER
           
protected  java.lang.String chainDelimiter
           
static java.lang.String CHAINPARAM_DELIMITER
           
protected  java.lang.String chainParamDelimiter
           
protected static ApplicationContext context
           
protected static org.apache.log4j.Logger log
           
protected  ThreadLocalServletImageRequestMap requestMap
           
protected static java.lang.String TOMCAT_CLIENTABORT
           
 
Constructor Summary
ServletMapper()
           
 
Method Summary
protected  java.net.URI completeUri(java.lang.String resource)
          Fix partial URIs
protected  java.lang.String determineContentType(java.lang.String imagePath)
          What content type are we looking for?
protected  void fillChainParam(java.lang.String key, java.lang.String value, ImageRequest imageRequest)
          Set the chain param on the ImageRequest
protected  void fillFilterChainProperties(java.lang.String key, java.lang.String value, java.util.Properties filterChainProperties)
          Extract per filterchain only properties.
protected  void fillImageParam(java.lang.String key, java.lang.String image, ImageRequest imageRequest)
          Set the image param on the ImageRequest
 ImageRequestMapper getImageRequestMapper()
           
 void init()
           
protected  ImageRequest populateImageRequestFrom(javax.servlet.http.HttpServletRequest request)
           
protected  void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAINPARAM_DELIMITER

public static final java.lang.String CHAINPARAM_DELIMITER
See Also:
Constant Field Values

CHAIN_DELIMITER

public static final java.lang.String CHAIN_DELIMITER
See Also:
Constant Field Values

log

protected static org.apache.log4j.Logger log

context

protected static ApplicationContext context

TOMCAT_CLIENTABORT

protected static final java.lang.String TOMCAT_CLIENTABORT
See Also:
Constant Field Values

requestMap

protected ThreadLocalServletImageRequestMap requestMap

chainParamDelimiter

protected java.lang.String chainParamDelimiter

chainDelimiter

protected java.lang.String chainDelimiter
Constructor Detail

ServletMapper

public ServletMapper()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

service

protected void service(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

getImageRequestMapper

public ImageRequestMapper getImageRequestMapper()

populateImageRequestFrom

protected ImageRequest populateImageRequestFrom(javax.servlet.http.HttpServletRequest request)
                                         throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

fillFilterChainProperties

protected void fillFilterChainProperties(java.lang.String key,
                                         java.lang.String value,
                                         java.util.Properties filterChainProperties)
Extract per filterchain only properties. put them into their own properties and store them in global hashmap with filterchain name as lookup key.

Parameters:
key - the per filterchain property key
value - the per filterchain property value
filterChainProperties - per image request properties

fillImageParam

protected void fillImageParam(java.lang.String key,
                              java.lang.String image,
                              ImageRequest imageRequest)
                       throws java.net.URISyntaxException
Set the image param on the ImageRequest

Parameters:
key -
imageRequest -
Throws:
java.net.URISyntaxException

fillChainParam

protected void fillChainParam(java.lang.String key,
                              java.lang.String value,
                              ImageRequest imageRequest)
                       throws java.net.URISyntaxException
Set the chain param on the ImageRequest

Parameters:
key -
value -
imageRequest -
Throws:
java.net.URISyntaxException

completeUri

protected java.net.URI completeUri(java.lang.String resource)
                            throws java.net.URISyntaxException
Fix partial URIs

Parameters:
resource -
Returns:
Throws:
java.net.URISyntaxException

determineContentType

protected java.lang.String determineContentType(java.lang.String imagePath)
What content type are we looking for?

Parameters:
imagePath -
Returns:
file extension


Copyright © 2004-2008 Sourceforge. All Rights Reserved.