com.bowstreet.webapp.util
Interface URLMapper


public interface URLMapper


Field Summary
static java.lang.String EXPLICIT_PROFILE_SEPARATOR
          Separator ("$") used for specifying multiple ProfileSet/Profile combinations on a URL example URL: http://localhost:7001/bowstreet/webengine/test/ProfiledText/Profile!
static java.lang.String PROFILESET_PROFILE_SEPARATOR
          Separator ("!")
 
Method Summary
 java.lang.String addQueryParameter(java.lang.String url, java.lang.String name, java.lang.String value)
          addQueryParameter Add a query parameter name/value pair to the specified URL string.
 boolean getKeepCurrentPage()
           
 java.lang.String getStaticContentURL(java.lang.String contentPath, java.lang.String httpChoice)
          getStaticContentURL for content within this app context The URL is /-relative (eg, /bowstreet/webengine/MyModel/Action!
 java.lang.String getURL(java.lang.String modelName, java.lang.String actionName)
          getURL returns a / relative URL for a model running in this server/app-context.
 java.lang.String getURL(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.
 URLMapper newInstance()
          newInstance - self-creation, internally used for performance/efficiency
 WebAppModelURL parseURLRequest(javax.servlet.http.HttpServletRequest req)
          parseURLRequest Return the ModelURL components from the request context.
 void setKeepCurrentPage(boolean keepCurrentPage)
           
 void setRequest(javax.servlet.http.HttpServletRequest req)
          setRequest Gives the URLMapper a reference to the HTTPServletRequest for getting more info about the request.
 

Field Detail

EXPLICIT_PROFILE_SEPARATOR

static final java.lang.String EXPLICIT_PROFILE_SEPARATOR
Separator ("$") used for specifying multiple ProfileSet/Profile combinations on a URL example URL: http://localhost:7001/bowstreet/webengine/test/ProfiledText/Profile!profiledText!Silver$Region!EastCoast

See Also:
Constant Field Values

PROFILESET_PROFILE_SEPARATOR

static final java.lang.String PROFILESET_PROFILE_SEPARATOR
Separator ("!") used for separate the ProfileSet and Profile combinations on a URL. example URL: http://localhost:7001/bowstreet/webengine/test/ProfiledText/Profile!profiledText!Silver$Region!EastCoast

See Also:
Constant Field Values
Method Detail

addQueryParameter

java.lang.String addQueryParameter(java.lang.String url,
                                   java.lang.String name,
                                   java.lang.String value)
addQueryParameter Add a query parameter name/value pair to the specified URL string. For instance, if you pass:
"http://server:port/foobar", "a", "b" this will return
http://server:port/foobar?a=b
If you pass: "http://server:port/foobar?a=b&c=d", "x", "yz" this method will return http://server:port/foobar?a=b&c=d&x=yz

Parameters:
url - url
name - parameter name
value - parameter value
Returns:
String representation of the new/modified URL

getKeepCurrentPage

boolean getKeepCurrentPage()
Returns:
Returns true if generated URLs should preserve the current page.

getStaticContentURL

java.lang.String getStaticContentURL(java.lang.String contentPath,
                                     java.lang.String httpChoice)
getStaticContentURL for content within this app context The URL is /-relative (eg, /bowstreet/webengine/MyModel/Action!MyAction) IF you specify a null httpChoice. The URL is absolute (eg, http://server:port/bowstreet/webengine/... ) if you specify a NON-null httpChoice (eg, "https") for the 4th argument. To get the protocol://server:port URL info to prefix a /-relative URL with, use: webAppAccess.getRequestData().getServerURL();

Parameters:
contentPath - path to the content (eg, "/images/icon.gif")
httpChoice - should contain one of: "http" "https" "" or null
Returns:
String representation of the URL to specified static content

getURL

java.lang.String getURL(java.lang.String modelName,
                        java.lang.String actionName)
getURL returns a / relative URL for a model running in this server/app-context. This method has no profile choice, and default http/https choice. The URL is /-relative (eg, /bowstreet/webengine/MyModel/Action!MyAction) To get the protocol://server:port URL info to prefix a /-relative URL with, use: webAppAccess.getRequestData().getServerURL();

Parameters:
modelName - model name
actionName - action name
Returns:
String representation of the URL to the specified model/action

getURL

java.lang.String getURL(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. The URL is /-relative (eg, /bowstreet/webengine/MyModel/Action!MyAction) IF you specify a null httpChoice. The URL is absolute (eg, http://server:port/bowstreet/webengine/... ) if you specify a NON-null httpChoice (eg, "https") for the 4th argument. To get the protocol://server:port URL info to prefix a /-relative URL with, use: webAppAccess.getRequestData().getServerURL();

Parameters:
modelName - model name
actionName - action name
profileName - explicit profile name
       profile selection syntax in the form of ProfileSetName!ProfileName
       For example: "Region!Northeast"
       Or, to apply more than one profile: "Region!Northeast$ServiceLevel!Gold"
httpChoice - should contain one of: "http" "https" "" or null
Returns:
String representation of the requested URL.

newInstance

URLMapper newInstance()
newInstance - self-creation, internally used for performance/efficiency


parseURLRequest

WebAppModelURL parseURLRequest(javax.servlet.http.HttpServletRequest req)
parseURLRequest Return the ModelURL components from the request context.

Parameters:
req - the incoming request to parse.
Returns:
WebAppModelURL holds parsed modelName, actionName & profileName

setKeepCurrentPage

void setKeepCurrentPage(boolean keepCurrentPage)
Parameters:
keepCurrentPage - Should subsequently-generated URLs preserve the current page?

setRequest

void setRequest(javax.servlet.http.HttpServletRequest req)
setRequest Gives the URLMapper a reference to the HTTPServletRequest for getting more info about the request. Typically called by the servlet instantiating the URLMapper.

Parameters:
req - HttpServletRequest


Copyright © 2009 IBM. All Rights Reserved.