com.bowstreet.webapp.util
Class URLMappingUtils

java.lang.Object
  extended by com.bowstreet.webapp.util.URLMappingUtils

public class URLMappingUtils
extends java.lang.Object

Static URL Mapping convenience methods for use in extraordinary circumstances when the recommended WebAppAccess URL Mapping APIs do not provide what is necessary for custom (non default) URL mapping.

Typically, WebApp developers should use the URL mapping APIs documented in WebAppAccess and URLMapper classes, rather than these specialized utility routines described below. This class is provided only for those circumstances when the recommended APIs do not provide what is necessary for custom URLMapper implementation/use and swapping in a custom URL mapper for a particular request or session.

Wraps complexity of pluggable URLMapper implementations


Field Summary
static java.lang.String BASE_URLMAPPER_TOKEN
          Request attribute holding instance of the "base" URLMapper: the first one associated with this request.
static java.lang.String DEFAULT_URL_MAPPER
          Default URL Mapper class / implementation.
static java.lang.String URLMAPPER_TOKEN
          Token specifying current URLMapper, as a request attribute
 
Constructor Summary
URLMappingUtils()
           
 
Method Summary
static java.lang.String getURL(WebAppAccess app, java.lang.String actionName, java.lang.String profileName, java.lang.String httpChoice)
          getURL for the model running in this server/app-context.
static java.lang.String getURL(WebAppAccess app, java.lang.String modelName, java.lang.String actionName, java.lang.String profileName, java.lang.String httpChoice)
          getURL for a model running in this server/app-context
static URLMapper getURLMapper(javax.servlet.http.HttpServletRequest req)
          Get a reference to the URLMapper for this request
static URLMapper setURLMapper(javax.servlet.http.HttpServletRequest req, java.lang.String classname)
          Set URLMapper for this request, by classname.
static void setURLMapperForSession(javax.servlet.http.HttpServletRequest req, java.lang.String classname)
          Set URLMapper for the specified session, by classname Allows you to override the default URL mapper for this request, with an alternate custom URL mapper.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_URLMAPPER_TOKEN

public static final java.lang.String BASE_URLMAPPER_TOKEN
Request attribute holding instance of the "base" URLMapper: the first one associated with this request.

See Also:
Constant Field Values

DEFAULT_URL_MAPPER

public static java.lang.String DEFAULT_URL_MAPPER
Default URL Mapper class / implementation.


URLMAPPER_TOKEN

public static final java.lang.String URLMAPPER_TOKEN
Token specifying current URLMapper, as a request attribute

See Also:
Constant Field Values
Constructor Detail

URLMappingUtils

public URLMappingUtils()
Method Detail

getURL

public static java.lang.String getURL(WebAppAccess app,
                                      java.lang.String actionName,
                                      java.lang.String profileName,
                                      java.lang.String httpChoice)
getURL for the model running in this server/app-context. Get the model name from the app context.

Parameters:
app - web app request context for access to servlet req
actionName - action name (or null to default to "main")
profileName - profile name (or null for no explicit profile)
httpChoice - should contain one of: "http:" "https:" or null
Returns:
String representation of the specified URL.

getURL

public static java.lang.String getURL(WebAppAccess app,
                                      java.lang.String modelName,
                                      java.lang.String actionName,
                                      java.lang.String profileName,
                                      java.lang.String httpChoice)
getURL for a model running in this server/app-context

Parameters:
app - web app request context for access to servlet req
modelName - model name (null default = the model described by app)
actionName - action name (or null to default to "main")
profileName - profile name (or null for no explicit profile)
httpChoice - should contain one of: "http:" "https:" or null
Returns:
String representation of a URL to the specified model/action.

getURLMapper

public static URLMapper getURLMapper(javax.servlet.http.HttpServletRequest req)
Get a reference to the URLMapper for this request

Parameters:
req - current request object.
Returns:
URLMapper reference.

setURLMapper

public static URLMapper setURLMapper(javax.servlet.http.HttpServletRequest req,
                                     java.lang.String classname)
                              throws java.lang.ClassNotFoundException,
                                     java.lang.InstantiationException,
                                     java.lang.IllegalAccessException
Set URLMapper for this request, by classname. Allows you to override the default URL mapper for this request, with an alternate custom URL mapper. NOTE: For advanced/custom use only. Normal WebApp development should use the default URLMapper.

Parameters:
req - request
classname - representation of the custom URL mapper class
Returns:
URLMapper instance of the specified URLMapper class.
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

setURLMapperForSession

public static void setURLMapperForSession(javax.servlet.http.HttpServletRequest req,
                                          java.lang.String classname)
                                   throws java.lang.ClassNotFoundException,
                                          java.lang.InstantiationException,
                                          java.lang.IllegalAccessException
Set URLMapper for the specified session, by classname Allows you to override the default URL mapper for this request, with an alternate custom URL mapper. NOTE: For advanced/custom use only. Normal WebApp development should use the default URLMapper.

Parameters:
req - current request object.
classname - representation of the custom URL mapper class.
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException


Copyright © 2009 IBM. All Rights Reserved.