wt.httpgw
Class GatewayServletHelper

java.lang.Object
  extended bywt.httpgw.GatewayServletHelper

public class GatewayServletHelper
extends Object

The GatewayServletHelper class is designed to work with the URLFactory to provide a series of accessory methods to build invokations through the Anonymous and Authenticated gateways.

This class's scope should not be extended beyond the construction of requests for Anonymous and Authenticated gateways. If other gateways are required, they should be created based on the implementation provided here.

The GatewayServletHelper utilizes the URLFactory to create and return HREFs according to the current context. If the URLFactory's requestURI is set, a relative HREF will be returned if possible. If no requestURI is present the HREF will be relative to the Windchill codebase.

For example, if an anonymous gateway was set to http://hostname/Windchill/servlet/WindchillAuthGW and the requestURI for the URLFactory is set to the codebase (in this example http://hostname/Windchill)
a call to

would return the String "servlet/WindchillAuthGW/wt.httpgw.HTTPServer/echo"

See Also:
URLFactory

Supported API: true
Extendable: false

Field Summary
static String ANONYMOUS_URL
          Constant for Anonymous URL
private static ThreadLocal anonymousT
          Map of all anonymous mappings
static String AUTHENTICATED_URL
          Constant for Authenticated URL
private static ThreadLocal authenticatedT
           
 
Constructor Summary
GatewayServletHelper()
           
 
Method Summary
static String buildAnonymousHREF(URLFactory aFactory)
          Will return an HREF String to the Anonymous Gateway.
static String buildAnonymousHREF(URLFactory aFactory, String aClass)
          Will return an HREF String to the Anonymous Gateway.
static String buildAnonymousHREF(URLFactory aFactory, String c, String m, HashMap params)
          Will return a HREF String for a class and method invoked through the Anonymous Gateway.
static String buildAnonymousHREF(URLFactory aFactory, String c, String m, String params)
          Will return a HREF String for a class and method invoked through the Anonymous Gateway.
static String buildAnonymousHREF(URLFactory aFactory, String c, String m, String f, HashMap params)
          Will return a HREF String for a class and method invoked through the Anonymous Gateway.
static String buildAnonymousHREF(URLFactory aFactory, String c, String m, String f, String params)
          Will return a HREF String for a class and method invoked through the Anonymous Gateway.
private static String buildAnonymousMethodCall(URLFactory aFactory, String c, String m, String f)
          Using an URLFactory build a proper string for the package-path and resource for the desired class, method and optional file.
static URL buildAnonymousURL(URLFactory aFactory)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static URL buildAnonymousURL(URLFactory aFactory, String aClass)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static URL buildAnonymousURL(URLFactory aFactory, String aClass, HashMap params)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static URL buildAnonymousURL(URLFactory aFactory, String aClass, String params)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static URL buildAnonymousURL(URLFactory aFactory, String c, String m, HashMap params)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static URL buildAnonymousURL(URLFactory aFactory, String c, String m, String params)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static URL buildAnonymousURL(URLFactory aFactory, String c, String m, String f, HashMap params)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static URL buildAnonymousURL(URLFactory aFactory, String c, String m, String f, String params)
          Will return a URL for a class and method invoked through the Anonymous Gateway.
static String buildAuthenticatedHREF(URLFactory aFactory)
          Will return an HREF String to the Authenticated Gateway.
static String buildAuthenticatedHREF(URLFactory aFactory, String aClass)
          Will return an HREF String to the Authenticated Gateway.
static String buildAuthenticatedHREF(URLFactory aFactory, String c, String m, HashMap params)
          Will return a HREF String for a class and method invoked through the Authenticated Gateway.
static String buildAuthenticatedHREF(URLFactory aFactory, String c, String m, HashMap params, boolean fullyQualified)
          Will return a HREF String for a class and method invoked through the Authenticated Gateway.
static String buildAuthenticatedHREF(URLFactory aFactory, String c, String m, String params)
          Will return a HREF String for a class and method invoked through the Authenticated Gateway.
static String buildAuthenticatedHREF(URLFactory aFactory, String c, String m, String f, HashMap params)
          Will return a HREF String for a class and method invoked through the Authenticated Gateway.
static String buildAuthenticatedHREF(URLFactory aFactory, String c, String m, String f, String params)
          Will return a HREF String for a class and method invoked through the Authenticated Gateway.
private static String buildAuthenticatedMethodCall(URLFactory aFactory, String c, String m, String f)
          Using an URLFactory build a proper string for the package-path and resource for the desired class, method and optional file.
static URL buildAuthenticatedURL(URLFactory aFactory)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
static URL buildAuthenticatedURL(URLFactory aFactory, String aClass)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
static URL buildAuthenticatedURL(URLFactory aFactory, String aClass, HashMap params)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
static URL buildAuthenticatedURL(URLFactory aFactory, String aClass, String params)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
static URL buildAuthenticatedURL(URLFactory aFactory, String c, String m, HashMap params)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
static URL buildAuthenticatedURL(URLFactory aFactory, String c, String m, String params)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
static URL buildAuthenticatedURL(URLFactory aFactory, String c, String m, String f, HashMap params)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
static URL buildAuthenticatedURL(URLFactory aFactory, String c, String m, String f, String params)
          Will return a URL for a class and method invoked through the Authenticated Gateway.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANONYMOUS_URL

public static final String ANONYMOUS_URL
Constant for Anonymous URL

See Also:
Constant Field Values

AUTHENTICATED_URL

public static final String AUTHENTICATED_URL
Constant for Authenticated URL

See Also:
Constant Field Values

anonymousT

private static ThreadLocal anonymousT
Map of all anonymous mappings


authenticatedT

private static ThreadLocal authenticatedT
Constructor Detail

GatewayServletHelper

public GatewayServletHelper()
Method Detail

buildAuthenticatedHREF

public static final String buildAuthenticatedHREF(URLFactory aFactory)
                                           throws WTException
Will return an HREF String to the Authenticated Gateway.

Supported API: true

Parameters:
aFactory - The current URLFactory
Returns:
The Authenticated HREF for the gateway
Throws:
WTException

buildAuthenticatedHREF

public static final String buildAuthenticatedHREF(URLFactory aFactory,
                                                  String aClass)
                                           throws WTException
Will return an HREF String to the Authenticated Gateway.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class or resource
Returns:
The Authenticated HREF for the gateway
Throws:
WTException

buildAuthenticatedHREF

public static final String buildAuthenticatedHREF(URLFactory aFactory,
                                                  String c,
                                                  String m,
                                                  String params)
                                           throws WTException
Will return a HREF String for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter string encoded already
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedHREF

public static final String buildAuthenticatedHREF(URLFactory aFactory,
                                                  String c,
                                                  String m,
                                                  HashMap params)
                                           throws WTException
Will return a HREF String for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter hashmap not encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedHREF

public static final String buildAuthenticatedHREF(URLFactory aFactory,
                                                  String c,
                                                  String m,
                                                  HashMap params,
                                                  boolean fullyQualified)
                                           throws WTException
Will return a HREF String for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter hashmap not encoded.
fullyQualified - Is resulting HREF fully qualified
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedHREF

public static final String buildAuthenticatedHREF(URLFactory aFactory,
                                                  String c,
                                                  String m,
                                                  String f,
                                                  String params)
                                           throws WTException
Will return a HREF String for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble. The parameter String is pre-encoded.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename appended to the URI
params - The parameter string is pre-encoded encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedHREF

public static final String buildAuthenticatedHREF(URLFactory aFactory,
                                                  String c,
                                                  String m,
                                                  String f,
                                                  HashMap params)
                                           throws WTException
Will return a HREF String for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename appended to the URI
params - The parameter hashmap not encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousHREF

public static final String buildAnonymousHREF(URLFactory aFactory)
                                       throws WTException
Will return an HREF String to the Anonymous Gateway.

Supported API: true

Parameters:
aFactory - The current URLFactory
Returns:
The Anonymous HREF for the gateway
Throws:
WTException

buildAnonymousHREF

public static final String buildAnonymousHREF(URLFactory aFactory,
                                              String aClass)
                                       throws WTException
Will return an HREF String to the Anonymous Gateway.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class or resource
Returns:
The Anonymous HREF for the gateway
Throws:
WTException

buildAnonymousHREF

public static final String buildAnonymousHREF(URLFactory aFactory,
                                              String c,
                                              String m,
                                              String params)
                                       throws WTException
Will return a HREF String for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter string pre-encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousHREF

public static final String buildAnonymousHREF(URLFactory aFactory,
                                              String c,
                                              String m,
                                              String f,
                                              String params)
                                       throws WTException
Will return a HREF String for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename appended to the URI
params - The parameter string pre-encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousHREF

public static final String buildAnonymousHREF(URLFactory aFactory,
                                              String c,
                                              String m,
                                              String f,
                                              HashMap params)
                                       throws WTException
Will return a HREF String for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename appended to the URI
params - The parameter HashMap encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousHREF

public static final String buildAnonymousHREF(URLFactory aFactory,
                                              String c,
                                              String m,
                                              HashMap params)
                                       throws WTException
Will return a HREF String for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whereever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter hashmap not encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousMethodCall

private static final String buildAnonymousMethodCall(URLFactory aFactory,
                                                     String c,
                                                     String m,
                                                     String f)
                                              throws WTException
Using an URLFactory build a proper string for the package-path and resource for the desired class, method and optional file.

If the URLFactory's codebase is defined as http://hostname/Windchill and the anonymous url in the wt.properties file is http://hostname/Windchill/somepathToGateway then this method should return a string of the form somepathToGateway/Class/ Method[/file]

Parameters:
aFactory - The URLFactory instance.
c - The class.
m - The method.
f - The file
Returns:
The String to the method using the gateway
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedMethodCall

private static final String buildAuthenticatedMethodCall(URLFactory aFactory,
                                                         String c,
                                                         String m,
                                                         String f)
                                                  throws WTException
Using an URLFactory build a proper string for the package-path and resource for the desired class, method and optional file.

If the URLFactory's codebase is defined as http://hostname/Windchill and the authenticated url in the wt.properties file is http://hostname/Windchill/somepathToGateway then this method should return a string of the form somepathToGateway/Class/ Method[/file]

Parameters:
aFactory - The URLFactory instance.
c - The class.
m - The method.
f - The file
Returns:
The String to the method using the gateway
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory,
                                              String aClass)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class to append to the URL.
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory,
                                              String aClass,
                                              String params)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class to append to the URL.
params - The encoded parameter string
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory,
                                              String aClass,
                                              HashMap params)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class to append to the URL.
params - The hashmap of parameters
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory,
                                              String c,
                                              String m,
                                              String params)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter string encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory,
                                              String c,
                                              String m,
                                              HashMap params)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter hashmap not encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory,
                                              String c,
                                              String m,
                                              String f,
                                              String params)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename to be added to the end of URI
params - The parameter string encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAuthenticatedURL

public static final URL buildAuthenticatedURL(URLFactory aFactory,
                                              String c,
                                              String m,
                                              String f,
                                              HashMap params)
                                       throws WTException
Will return a URL for a class and method invoked through the Authenticated Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename to be added to the end of URI
params - The parameter hashmap not encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory,
                                          String c,
                                          String m,
                                          String params)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter string encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory,
                                          String c,
                                          String m,
                                          HashMap params)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
params - The parameter hashmap not encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory,
                                          String c,
                                          String m,
                                          String f,
                                          String params)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename to be added to the end of URI
params - The parameter string encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory,
                                          String c,
                                          String m,
                                          String f,
                                          HashMap params)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
c - The class to add to the href
m - The method to be invoked by the class
f - The filename to be added to the end of URI
params - The parameter hashmap not encoded.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory,
                                          String aClass)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class to append to the URL.
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory,
                                          String aClass,
                                          String params)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class to append to the URL.
params - The encoded parameter string
Throws:
WTException - If the server-codebase could not be reached.

buildAnonymousURL

public static final URL buildAnonymousURL(URLFactory aFactory,
                                          String aClass,
                                          HashMap params)
                                   throws WTException
Will return a URL for a class and method invoked through the Anonymous Gateway. If URLFactory is null, a new URLFactory will be instantiated to handle the request, however an instance should be passed in whenever possble.

Supported API: true

Parameters:
aFactory - The current URLFactory
aClass - The class to append to the URL.
params - The hashmap of parameters
Throws:
WTException - If the server-codebase could not be reached.