com.ptc.windchill.cadx.common.util
Class CadxURLUtilities

java.lang.Object
  extended bycom.ptc.windchill.cadx.common.util.CadxURLUtilities

public class CadxURLUtilities
extends Object


Field Summary
private static char AMP_SEPARATOR
           
private static char EQUALTO_CHAR
           
static String REFERER_URL_COOKIE_KEY
           
static String SAVE_REFERER_URL
           
private static EncodingConverter staticEncoder
           
private static boolean VERBOSE
           
 
Constructor Summary
CadxURLUtilities()
           
 
Method Summary
static String appendQueryParamToURL(String URL, String key, String value)
          Append the specified key-value pair to the specified string.
private static void cleanupRefererPageHiddenFormFields(Properties hiddenFormFields)
          Clean up any stale key/value pairs from the referer page's FormData properties to avoid un-desirable behavior.
static String getCadxHtmlUiHomeURL()
           
static String getContextURL(HTTPState a_HTTPState, Object contextObj, String action)
          For the specified context object & the specified action, get the URL with container oid as query string.
static String getContextURL(Object contextObj, String action)
          For the specified context object & the specified action, get the URL
static String getContextURL(Object contextObj, String action, Properties parameters)
          For the specified context object & the specified action, get the URL for rendering the page.
static Properties getHiddenFields(HTTPState a_HTTPState, String hiddenFieldsCookieId, Properties parameters)
          Return Properties object to be used as the hidden fields used by redirect services.
static String getMyWorkspaceURL(Object contextObj)
          For the specified context object, get the URL for the 'MyWorkspace' action
static String getObjPropsURL(Object contextObj)
          For the specified context object, get the URL for the 'ObjProps' action
static String getRefererURL(BasicTemplateProcessor gfp)
          Returns the URL for the return page when user Cancels an operation.
static String getRefURLFromSessionCookie(HTTPState a_HTTPState, String cookieId)
          Get the referer URL from the saved session cookie.
private static boolean overrideRefererURL(HTTPState a_HTTPState)
          Check to see whther the referer URL can be over-riden.
static void redirectToAnotherPage(HTTPState a_HTTPState, Properties queryData, String hiddenFieldsCookieId, Properties parameters)
          Redirect to a URL generated from the passed query data using the RedirectObject's services.
static void redirectToAnotherPage(HTTPState a_HTTPState, String redirectToURL)
          Redirect to the specified URL using the RedirectObject's services.
static void redirectToAnotherPage(HTTPState a_HTTPState, String redirectToURL, Properties parameters)
          Redirect to the specified URL using the RedirectObject's services.
static void redirectToAnotherPage(HTTPState a_HTTPState, String redirectToURL, String hiddenFieldsCookieId, Properties parameters)
           
static void redirectToDefaultRefererPage(BasicTemplateProcessor aBasicTemplateProcessor, String hiddenFieldsCookieId)
          Redirect to the default referer page using the RedirectObject's services.
static void redirectToDefaultRefererPage(BasicTemplateProcessor aBasicTemplateProcessor, String hiddenFieldsCookieId, Properties parameters)
          Redirect to the default referer page using the RedirectObject's services.
static void redirectToLinkWithinPage(HTTPState a_HTTPState, String redirectToURL, Properties parameters)
          Redirect to the specified page URL using the RedirectObject's services.
static void redirectToRefererPage(HTTPState a_HTTPState, String refererURL, String hiddenFieldsCookieId)
          Redirect to the specified URL using the RedirectObject's services.
static void redirectToRefererPage(HTTPState a_HTTPState, String redirectToURL, String hiddenFieldsCookieId, Properties parameters)
          Redirect to the specified URL using the RedirectObject's services.
static void redirectToTabURL(HTTPState a_HTTPState, String redirectToURL, Properties parameters)
          Redirect to the specified tab page URL using the RedirectObject's services.
private static String removeNoObjectKey(String refUrl)
           
static void saveRefURLInSessionCookie(HTTPState a_HTTPState, String cookieId)
          For the specified cookieId, save the referer URL in a ServletSessionCookie.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REFERER_URL_COOKIE_KEY

public static final String REFERER_URL_COOKIE_KEY
See Also:
Constant Field Values

SAVE_REFERER_URL

public static final String SAVE_REFERER_URL
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

staticEncoder

private static EncodingConverter staticEncoder

AMP_SEPARATOR

private static final char AMP_SEPARATOR
See Also:
Constant Field Values

EQUALTO_CHAR

private static final char EQUALTO_CHAR
See Also:
Constant Field Values
Constructor Detail

CadxURLUtilities

public CadxURLUtilities()
Method Detail

getCadxHtmlUiHomeURL

public static String getCadxHtmlUiHomeURL()

getRefererURL

public static String getRefererURL(BasicTemplateProcessor gfp)
Returns the URL for the return page when user Cancels an operation. The following logic is used : 1. If context obj is workspace then returns workspace's objprops page url. 2. Else if WorkspaceUtilities.getContextWorkspaceForAction returns not null, then indicates it is a context action from WS listing page. Hence returns workspace's objprops page url. 3. Else if context obj is EPMDocument then returns EPMDocument's objprops page url. 4. Else returns CGIConstants.CGI_REFERER value from request object if this is not null. 5. Else returns Cadx Home page URL.


getMyWorkspaceURL

public static String getMyWorkspaceURL(Object contextObj)
For the specified context object, get the URL for the 'MyWorkspace' action


getObjPropsURL

public static String getObjPropsURL(Object contextObj)
For the specified context object, get the URL for the 'ObjProps' action


saveRefURLInSessionCookie

public static void saveRefURLInSessionCookie(HTTPState a_HTTPState,
                                             String cookieId)
For the specified cookieId, save the referer URL in a ServletSessionCookie. This could be used later on by some other page to go back to this save URL page. For example, if user launches a Browse page and after navigating through several layers of page, when user is done with browse operation, user would like to go back to the referer page from where the Browse operation was launched. This saved value would be used for that.


getRefURLFromSessionCookie

public static String getRefURLFromSessionCookie(HTTPState a_HTTPState,
                                                String cookieId)
Get the referer URL from the saved session cookie. Note that the page could be launched from several pages. For example, the Edit Workspace Options page could be launched from the Workspace Listing page as well as from the Checkout page. Hence it should have been saved before.


overrideRefererURL

private static boolean overrideRefererURL(HTTPState a_HTTPState)
Check to see whther the referer URL can be over-riden. This is indicated through the saveRefURL query or form hidden fields parameter.


redirectToDefaultRefererPage

public static void redirectToDefaultRefererPage(BasicTemplateProcessor aBasicTemplateProcessor,
                                                String hiddenFieldsCookieId)
Redirect to the default referer page using the RedirectObject's services. If the form data properties of the source page was saved before as session cookie, plug them too so that they too are made available to the re-directed page.


redirectToDefaultRefererPage

public static void redirectToDefaultRefererPage(BasicTemplateProcessor aBasicTemplateProcessor,
                                                String hiddenFieldsCookieId,
                                                Properties parameters)
Redirect to the default referer page using the RedirectObject's services. Plug in the key/value pairs of the specified parameters into the re-directed page. If the form data properties of the source page was saved before as session cookie, plug them too so that they too are made available to the re-directed page.


redirectToRefererPage

public static void redirectToRefererPage(HTTPState a_HTTPState,
                                         String refererURL,
                                         String hiddenFieldsCookieId)
Redirect to the specified URL using the RedirectObject's services. If the form data properties of the source page was saved before as session cookie, plug them too so that they too are made available to the re-directed page.


redirectToRefererPage

public static void redirectToRefererPage(HTTPState a_HTTPState,
                                         String redirectToURL,
                                         String hiddenFieldsCookieId,
                                         Properties parameters)
Redirect to the specified URL using the RedirectObject's services. Plug in the key/value pairs of the specified parameters into the re-directed page. If the form data properties of the source page was saved before as session cookie, plug them too so that they too are made available to the re-directed page.


redirectToAnotherPage

public static void redirectToAnotherPage(HTTPState a_HTTPState,
                                         String redirectToURL)
Redirect to the specified URL using the RedirectObject's services.


redirectToAnotherPage

public static void redirectToAnotherPage(HTTPState a_HTTPState,
                                         String redirectToURL,
                                         Properties parameters)
Redirect to the specified URL using the RedirectObject's services. Plug in the key/value pairs of the specified parameters into the re-directed page.


redirectToAnotherPage

public static void redirectToAnotherPage(HTTPState a_HTTPState,
                                         String redirectToURL,
                                         String hiddenFieldsCookieId,
                                         Properties parameters)

redirectToAnotherPage

public static void redirectToAnotherPage(HTTPState a_HTTPState,
                                         Properties queryData,
                                         String hiddenFieldsCookieId,
                                         Properties parameters)
Redirect to a URL generated from the passed query data using the RedirectObject's services. Plug in the key/value pairs of the specified parameters into the re-directed page. If the form data properties of the source page was saved before as session cookie, plug them too so that they too are made available to the re-directed page.


getContextURL

public static String getContextURL(HTTPState a_HTTPState,
                                   Object contextObj,
                                   String action)
For the specified context object & the specified action, get the URL with container oid as query string.


getContextURL

public static String getContextURL(Object contextObj,
                                   String action)
For the specified context object & the specified action, get the URL


getContextURL

public static String getContextURL(Object contextObj,
                                   String action,
                                   Properties parameters)
For the specified context object & the specified action, get the URL for rendering the page. Append any param from the parameter file as query string.


redirectToTabURL

public static void redirectToTabURL(HTTPState a_HTTPState,
                                    String redirectToURL,
                                    Properties parameters)
Redirect to the specified tab page URL using the RedirectObject's services.


redirectToLinkWithinPage

public static void redirectToLinkWithinPage(HTTPState a_HTTPState,
                                            String redirectToURL,
                                            Properties parameters)
Redirect to the specified page URL using the RedirectObject's services. The redirectToURL is expected to be for an internal resource (say a tab within the multi-tab page). So, just re-direct without plugging-in the launching page's hidden fields.


getHiddenFields

public static Properties getHiddenFields(HTTPState a_HTTPState,
                                         String hiddenFieldsCookieId,
                                         Properties parameters)
Return Properties object to be used as the hidden fields used by redirect services. The objects is created by merging state properties: 0. An empty Properties object is created. 1. If the form data properties of the source page was saved before as session cookie merge the properties. 2. Merge in context properties. 3. Merge in paramaters passed.


removeNoObjectKey

private static String removeNoObjectKey(String refUrl)

cleanupRefererPageHiddenFormFields

private static void cleanupRefererPageHiddenFormFields(Properties hiddenFormFields)
Clean up any stale key/value pairs from the referer page's FormData properties to avoid un-desirable behavior. For example, the top line status message of the referer page could be the stale old one from the previous transaction on that page. We don't want to show that message when we re-direct to the referer page from some other action.


appendQueryParamToURL

public static String appendQueryParamToURL(String URL,
                                           String key,
                                           String value)
Append the specified key-value pair to the specified string. The key and value string will be encoded before being appended to the URL.