Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal
11g Release 1 (11.1.1.7.0)
E15995-06


oracle.webcenter.framework.resource.external
Class ResourceUri

java.lang.Object
  extended by oracle.webcenter.framework.resource.external.ResourceUri


public class ResourceUri
extends java.lang.Object

Provides a static API to get absolute URLs to resources within WebCenter applications (Spaces and Portal applications) including the protocol, host, port and context root. This class by default produces absolute urls where the scheme (protocol), host and port are the same for both Faces and non-Faces requests and that the webcenter Faces requests are made on /faces, RSS requests are made on /rss and REST requests are made on /rest URLs. If the context roots are non-standard, for example if RSS is using https on a different port to Faces requests, a section needs to be added to the adf-config.xml file. wlst commands exist to set these values in adf-config.xml and these should be used when making changes to deployed applications. Otherwise, adf-config.xml may be edited from within JDeveloper and the <resource-uri element added within the adf-service-config element between the data-source and resource-handler elements (if any).

 <adf-service-config xmlns="http://xmlns.oracle.com/webcenter/framework/service">
         <data-source jndi-name="jdbc_WebCenterDS" />
  <resource-uri
    rss-mount="/rss"
    faces-mount="/faces"
    wc-ctxroot="/webcenter"
    rest-ctxroot="/rest"
    faces-host="http://a.different.host.com:5678/mywebcenterapp/jsf" />
  <resource-handler class= ...
 

where rss-mount is the context root of the RSS Servlet for RSS requests (starting with a slash). This defaults to /rss/rssservlet and does not normally need to be set. faces-mount is the mount point of the Faces requests, and this defaults to /faces wc-ctxroot is the context root for the webcenter faces servlet. This defaults to /webcenter rest-ctxroot is the context root for the REST servlet. This defaults to /rest faces-mount overrides the existing context and configuration settings by specifying the entire absolute URL to the Faces servlet. This is used to build up URLs to the Faces servlet from outside of the FacesContext (for example, from the REST or RSS servlet). In most cases this should be null null indicates that the current context is used to build up the url. This implementation works both inside and outside of a Faces context, but it is designed to be used outside of the Faces Context (inside of a Faces request, the resourceHandler tag should be used) The webcenter faces context root to use for RAH requests can also be set in the web.xml of the faces application by adding a context parameter:

   <context-param>
     <param-name>oracle.webcenter.framework.resource.external</param-name>
     <param-value>true</param-value>
  </context-param>
 

a Servlet Start up listener will then obtain the context root for this web application as the application starts up and RAH will then use this as the context root for all calls to get the faces context root. This is preferred to adding a fixed value into adf-config.xml using the wc-ctxroot.


Field Summary
static java.lang.String CONTEXT_PARAM_MAIN_FACES_APP_MARKER
          The Context Parameter to be used in the web.xml of the Faces servlet that should be used to service RAH urls.
static java.lang.String OWRESOURCE_JSPX
          The URL path used invoke the Resource Action Handler via the Resource External Phase Listener (since 11.1.1.4.0) when the user is only required to log in if the resource is not accessible to unauthenticated users.
static java.lang.String RESOURCE_EXTERNAL_JSPX
          The Faces page used to invoke the Resource Action Handler when the user must be logged on before accessing the page (even for resources accessible to unauthenticated users).
static java.lang.String RESOURCE_EXTERNAL_REFERER
          The resource referer attribute value used by the Resource Action Handler when it is invoked by owResource.jspx so that View Handlers can handle incoming requests to the application differently to those which navigate within the application.
static java.lang.String URL_PARAM_RESOURCEID
          URL parameter used to identify the service specific resource.
static java.lang.String URL_PARAM_SCOPE
          URL parameter used to identify the scope of the resource.
static java.lang.String URL_PARAM_SERVICEID
          URL parameter used to identify the service where the resource view is located (as defined in service-definition.xml).
static java.lang.String URL_PARAM_TITLE
          URL parameter used to specify the title to use for displaying the resource.
static java.lang.String URL_PARAM_TYPE
          URL parameter used to identify the type of resource being displayed.
static java.lang.String URL_PARAM_Z
          The URL parameter used by /owResource.jspx to identify the resource to display comprising of the service, resource id and scope.

 

Constructor Summary
ResourceUri()
           

 

Method Summary
static java.lang.String defaultGetURI(java.lang.String resourceId, java.lang.String serviceId, java.lang.String scope, java.lang.String title, java.lang.String resourceType, boolean forceLogin, java.util.Map<java.lang.String,java.lang.String> params, java.lang.String absoluteWCContextRoot)
          Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title, scope, resourceType, action and a Map of the name-value parameters to add to the URL.
static java.lang.String getAbsoluteContextRoot()
          Returns the absolute URL up to and including the current servlet context root (even if the FacesContext is not available).
static java.lang.String getAbsoluteWCContextRoot()
          Returns the absolute URL up to and including the servlet context root (even if the FacesContext is not available) of the WebCenter servlet.
static java.lang.StringBuilder getBaseUri(java.lang.String page)
          Returns the absolute URL to the specified containing page (even if the FacesContext is not available).
static java.lang.StringBuilder getRssBaseUri(java.lang.String path)
          Returns the absolute URL to the specified RSS path (even if not executed from within the RSS servlet).
static java.lang.String getURI(java.lang.String resourceId, java.lang.String serviceId, java.lang.String title)
          Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title.
static java.lang.String getURI(java.lang.String resourceId, java.lang.String serviceId, java.lang.String title, java.lang.String scope)
          Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title and scope.
static java.lang.String getURI(java.lang.String resourceId, java.lang.String serviceId, java.lang.String title, java.lang.String scope, boolean forceLogin)
          Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title and scope.
static java.lang.String getURI(java.lang.String resourceId, java.lang.String serviceId, java.lang.String scope, java.lang.String title, java.lang.String resourceType, boolean forceLogin, java.util.Map<java.lang.String,java.lang.String> params)
          Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title, scope, resourceType, action and a Map of the name-value parameters to add to the URL.
static java.lang.String getURI(java.lang.String resourceId, java.lang.String serviceId, java.lang.String scope, java.lang.String title, java.lang.String resourceType, boolean forceLogin, java.util.Map<java.lang.String,java.lang.String> params, java.lang.String absoluteWCContextRoot)
          This is the basically the same as defaultGetURI() except it allows calling of the same getURI() method of any registered custom ResourceURI.
static java.lang.String getURI(java.lang.String resourceId, java.lang.String serviceId, java.lang.String scope, java.lang.String title, java.lang.String resourceType, java.util.Map<java.lang.String,java.lang.String> params)
          Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title, scope, resourceType, action and a Map of the name-value parameters to add to the URL.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

URL_PARAM_RESOURCEID

public static final java.lang.String URL_PARAM_RESOURCEID
URL parameter used to identify the service specific resource.
See Also:
Constant Field Values

URL_PARAM_SERVICEID

public static final java.lang.String URL_PARAM_SERVICEID
URL parameter used to identify the service where the resource view is located (as defined in service-definition.xml).
See Also:
Constant Field Values

URL_PARAM_TYPE

public static final java.lang.String URL_PARAM_TYPE
URL parameter used to identify the type of resource being displayed.
See Also:
Constant Field Values

URL_PARAM_SCOPE

public static final java.lang.String URL_PARAM_SCOPE
URL parameter used to identify the scope of the resource.
See Also:
Constant Field Values

URL_PARAM_TITLE

public static final java.lang.String URL_PARAM_TITLE
URL parameter used to specify the title to use for displaying the resource.
See Also:
Constant Field Values

URL_PARAM_Z

public static final java.lang.String URL_PARAM_Z
The URL parameter used by /owResource.jspx to identify the resource to display comprising of the service, resource id and scope.
See Also:
Constant Field Values

RESOURCE_EXTERNAL_JSPX

public static final java.lang.String RESOURCE_EXTERNAL_JSPX
The Faces page used to invoke the Resource Action Handler when the user must be logged on before accessing the page (even for resources accessible to unauthenticated users).
See Also:
Constant Field Values

OWRESOURCE_JSPX

public static final java.lang.String OWRESOURCE_JSPX
The URL path used invoke the Resource Action Handler via the Resource External Phase Listener (since 11.1.1.4.0) when the user is only required to log in if the resource is not accessible to unauthenticated users.
See Also:
Constant Field Values

RESOURCE_EXTERNAL_REFERER

public static final java.lang.String RESOURCE_EXTERNAL_REFERER
The resource referer attribute value used by the Resource Action Handler when it is invoked by owResource.jspx so that View Handlers can handle incoming requests to the application differently to those which navigate within the application. For example, the view handler may wish to open a popup window for navigation within the application but open a full browser window when navigating to the application via owResource.jspx.
See Also:
Constant Field Values

CONTEXT_PARAM_MAIN_FACES_APP_MARKER

public static final java.lang.String CONTEXT_PARAM_MAIN_FACES_APP_MARKER
The Context Parameter to be used in the web.xml of the Faces servlet that should be used to service RAH urls. This context parameter should be set to true in the web.xml of the Faces servlet that the ResourceUri urls be using to navigate to the faces pages and resource views. If this is set, the context root of the faces servlet where this is set will be used as the WebCenter context root in urls generated by ResourceUri APIs. If this is not set, the context root to use is taken to that of the first faces request to the application.
See Also:
Constant Field Values

Constructor Detail

ResourceUri

public ResourceUri()

Method Detail

getRssBaseUri

public static java.lang.StringBuilder getRssBaseUri(java.lang.String path)
Returns the absolute URL to the specified RSS path (even if not executed from within the RSS servlet). This method returns the absolute URL to the specified RSS path using the current context to build up the first parts of the url (protocol, host, port and context root) and the adf-config.xml configuration to find the RSS mount point, followed by the specified path. For example, getRssBaseUri("/myrss/url"); returns http://www.example.com/contextroot/rss/myrss/url
Parameters:
path - an RSS URL path accessible from a browser (may be null)
Returns:
the absolute URL to the specified RSS path

getAbsoluteContextRoot

public static java.lang.String getAbsoluteContextRoot()
Returns the absolute URL up to and including the current servlet context root (even if the FacesContext is not available). This method returns the absolute URL up to and including the context root using the current context to build up the protocol, host, port and context root. Note: This returns the current servlet context root, to obtain the WebCenter context root from another servlet use getAbsoluteWCContextRoot() If called from outside of a FacesContext it will return the webcenter faces servlet's context root. This returns a URL in the format: [protocol]://[host]:[port]/[ctxroot] such as http://www.example.com:8888/rest
Returns:
the absolute URL to the current context root

getAbsoluteWCContextRoot

public static java.lang.String getAbsoluteWCContextRoot()
Returns the absolute URL up to and including the servlet context root (even if the FacesContext is not available) of the WebCenter servlet. This method returns the absolute URL up to and including the context root of the WebCenter Servlet. This returns a URL in the format: [protocol]://[host]:[port]/[ctxroot] such as http://www.example.com:8888/webcenter
Returns:
the absolute url to the context root of the WebCenter servlet

getBaseUri

public static java.lang.StringBuilder getBaseUri(java.lang.String page)
Returns the absolute URL to the specified containing page (even if the FacesContext is not available). This method returns the absolute URL to the specified path using the current context to build up the first parts of the URL (protocol, host, port and context root) and the adf-config.xml configuration to find the faces mount point, followed by the specified path.
Parameters:
page - a jspx page accessible from a browser
Returns:
the absolute url to the specified containing page

getURI

public static java.lang.String getURI(java.lang.String resourceId,
                                      java.lang.String serviceId,
                                      java.lang.String title)
Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title. This API returns an absolute URL to be used in an a href target. The URL will point to the specified resource through its service's resource view surrounded by any application-specific container page.
Parameters:
resourceId - service-specific resource identifier
serviceId - the service identifier
title - title string used for viewing the resource, for example the title used on a new tab. This may be null
Returns:
an absolute URL to the specified resource

getURI

public static java.lang.String getURI(java.lang.String resourceId,
                                      java.lang.String serviceId,
                                      java.lang.String title,
                                      java.lang.String scope)
Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title and scope.
Parameters:
resourceId - service-specific resource identifier
serviceId - the service identifier
title - title string used for viewing the resource, for example the title used on a new tab. This may be null
scope - the scope GUID used for the resource

getURI

public static java.lang.String getURI(java.lang.String resourceId,
                                      java.lang.String serviceId,
                                      java.lang.String title,
                                      java.lang.String scope,
                                      boolean forceLogin)
Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title and scope.
Parameters:
resourceId - service-specific resource identifier
serviceId - the service identifier
title - title string used for viewing the resource, for example the title used on a new tab. This may be null
forceLogin - true to force users to login when accessing this url, false to allow public access
scope - the scope GUID used for the resource

getURI

public static java.lang.String getURI(java.lang.String resourceId,
                                      java.lang.String serviceId,
                                      java.lang.String scope,
                                      java.lang.String title,
                                      java.lang.String resourceType,
                                      java.util.Map<java.lang.String,java.lang.String> params)
Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title, scope, resourceType, action and a Map of the name-value parameters to add to the URL.
Parameters:
resourceId - service-specific resource identifier
serviceId - the service identifier
title - title string used for viewing the resource, for example the title used on a new tab. This may be null
resourceType - the type of the resource. This may be null
scope - the scope GUID used for the resource
params - a Map of the name-value pairs, for example to set wc.chromelevel=nochrome

getURI

public static java.lang.String getURI(java.lang.String resourceId,
                                      java.lang.String serviceId,
                                      java.lang.String scope,
                                      java.lang.String title,
                                      java.lang.String resourceType,
                                      boolean forceLogin,
                                      java.util.Map<java.lang.String,java.lang.String> params)
Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title, scope, resourceType, action and a Map of the name-value parameters to add to the URL.
Parameters:
resourceId - service-specific resource identifier
serviceId - the service identifier
title - title string used for viewing the resource, for example the title used on a new tab. This may be null
resourceType - the type of the resource. This may be null
scope - the scope GUID used for the resource
forceLogin - true to force users to login when accessing this url, false to allow public access
params - a Map of the name-value pairs, for example to set wc.chromelevel=nochrome

getURI

public static java.lang.String getURI(java.lang.String resourceId,
                                      java.lang.String serviceId,
                                      java.lang.String scope,
                                      java.lang.String title,
                                      java.lang.String resourceType,
                                      boolean forceLogin,
                                      java.util.Map<java.lang.String,java.lang.String> params,
                                      java.lang.String absoluteWCContextRoot)
This is the basically the same as defaultGetURI() except it allows calling of the same getURI() method of any registered custom ResourceURI. If no custom ResourceURI registered, it will call the defaultGetURI().

defaultGetURI

public static java.lang.String defaultGetURI(java.lang.String resourceId,
                                             java.lang.String serviceId,
                                             java.lang.String scope,
                                             java.lang.String title,
                                             java.lang.String resourceType,
                                             boolean forceLogin,
                                             java.util.Map<java.lang.String,java.lang.String> params,
                                             java.lang.String absoluteWCContextRoot)
Returns an absolute URL to the given resource identified by its service specific resource id and service identifier, using the given title, scope, resourceType, action and a Map of the name-value parameters to add to the URL.
Parameters:
resourceId - service-specific resource identifier
serviceId - the service identifier
title - title string used for viewing the resource, for example the title used on a new tab. This may be null
scope - the scope GUID used for the resource
resourceType - the type of the resource. This may be null
forceLogin - true to force users to login when accessing this url, false to allow public access
params - a Map of the name-value pairs, for example to set wc.chromelevel=nochrome
absoluteWCContextRoot - The absolute url upto and including the webcenter context root, to use when building up the url to the requested resource rather than the current context. This can be used when calling this API in a non-request thread or outside of a faces thread to override the current context with a previously determined base url. In the original request thread ResourceUri.getAbsoleteWCContextRoot can be used to obtain this value

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle WebCenter Portal
11g Release 1 (11.1.1.7.0)
E15995-06


Copyright © 2009, 2013, Oracle and/or its affiliates. All rights reserved.