Oracle Entitlements Server Provider SSPI API Reference

weblogic.security.service
Class URLResource

java.lang.Object
  |
  +--weblogic.security.service.ResourceBase
        |
        +--weblogic.security.service.URLResource

public final class URLResource
extends ResourceBase

The URLResource class is used by a container to specify the URL resource (and method related to the resource) that a caller is attempting to access.

This class behaves differently on Windows than it does on other platforms. On Windows it converts the contextPath and URI to lower case. This is because contextPath and URI are case insensitive in Windows. This default behavior can be changed by putting one of -Dweblogic.security.URLResourceCaseMapping=on, -Dweblogic.security.URLResourceCaseMapping=off or -Dweblogic.security.URLResourceCaseMapping=os on the command line. The on setting means to always map contextPath and URI to lower case. The off setting means to never map contextPath and URI to lower case. The os setting (the default) means to map contextPath and URI to lower case only on Windows. In general, this flag will not have to be set. It will likely only need to be set when you are running a domain on a combination of Windows and non-Windows machines. Then setting it to on will make the system behave correctly across platforms although it will make non-Windows systems case insensitive.

Note: The URLResource class should be used in place of the WebResource class, which is now deprecated.

The toString format (which is produced by the ResourceBase class) for a URL resource is:
type=<url>, application=myApp, contextPath=/mywebapp, uri=/foo/bar/my.jsp, httpMethod=GET

Author:
Copyright © 2004-2008, Oracle and/or its affiliates. All rights reserved.
See Also:
Serialized Form

Fields inherited from class weblogic.security.service.ResourceBase
id, length, NO_PARENT, parent, resStr, SCOPE_RESOURCE_ACTION, values
 
Constructor Summary
URLResource(java.lang.String application, java.lang.String contextPathArg, java.lang.String uriArg, java.lang.String httpMethod, java.lang.String transportType)
          Constructs a new URLResource with a target name composed from the application, contextPath, URI, httpMethod, and transportType parameters.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this resource to the resource in the specified object.
 java.lang.String getApplicationName()
          Gets the name of the application associated with the URLResource.
 java.lang.String getContextPath()
          Gets the URI of the Web component.
 int getFieldType(java.lang.String fieldName)
           
 java.lang.String getHttpMethod()
          Gets the HTTP method of the URL resource.
 java.lang.String[] getKeys()
          Gets keys for the URLresource.
 int getRepeatingFieldIndex()
           
 int getRepeatingFieldTerminatingIndex()
           
 java.lang.String getTransportType()
          Gets the transport guarantee required to access the URLResource.
 java.lang.String getType()
          Gets the type of this resource (URLResource).
 java.lang.String getURI()
          Gets the URI of the Web component.
protected  void init(java.lang.String[] values, int len, long seed, java.lang.String httpMethod, java.lang.String suffix, boolean URIUnchanged)
          Initializes the URLResource with the array of values.
protected  Resource makeParent()
          Gets a Resource object that represents the parent of the current URLResource.
 boolean mappingToLowerCase()
          Returns true if we are mapping the contextPath and URI to lower case upon creation.
 
Methods inherited from class weblogic.security.service.ResourceBase
appendArrayValue, appendValue, getID, getParentResource, getValues, hashCode, init, init, reset, toString, writeResourceString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLResource

public URLResource(java.lang.String application,
                   java.lang.String contextPathArg,
                   java.lang.String uriArg,
                   java.lang.String httpMethod,
                   java.lang.String transportType)
Constructs a new URLResource with a target name composed from the application, contextPath, URI, httpMethod, and transportType parameters.

For example, if the web.xml deployment descriptor in mywebapp.war (which is inside myApp.ear) contains the following elements:

<web-app>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>MyResource</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>MyRole</role-name>
    </auth-constraint>
  </security-constraint>
  ...
</web-app>

If the URL to access the resource is http://MyServer:MyPort/mywebapp/foo/bar/my.jsp?x=y, then the context path is "/mywebapp", the servlet path is "/foo/bar/my.jsp", and the path info is "" (null).

Finally, the URLResource is represented as type=<url>, application=myApp, contextPath=/mywebapp, uri=/foo/bar/my.jsp, httpMethod=GET.

This method will map the contextPath and URI to lower case if mappingToLowerCase() returns true.

Parameters:
application - the name of the application in which the resource is deployed, as it appears in the corresponding <display-name> element. The <display-name> element is associated with an <application> element in the deployment descriptor, in an .ear file.

contextPath - the context path for the Web application.

uri - the URI of the resource. This is the servlet path and the path info as specified in the Servlet 2.3 spec. This can be thought of as the URI, relative to the context path.

httpMethod - the name of the HTTP method on the URL resource, as it appears in the corresponding <http-method> element in the deployment descriptor. A value of null indicates that the security policy for the resource pertains to all methods that match the other parameters of the resource specification, without consideration for the method name.

transportType - the transport guarantee required to access the URL resource, as it appears in the corresponding <transport-guarantee> element in the deployment descriptor. A value of null indicates that the associated method of the URL resource can be accessed over any transport. If httpMethod is null then parameter must also be null. Valid values for this parameter are restricted to the following:
  • INTEGRAL
  • CONFIDENTIAL
Method Detail

init

protected void init(java.lang.String[] values,
                    int len,
                    long seed,
                    java.lang.String httpMethod,
                    java.lang.String suffix,
                    boolean URIUnchanged)
Initializes the URLResource with the array of values. Computes a resource ID as a hash function of the resource type and each of its non-null values, then stores the suffix for later use.

This method will not map the contextPath and URI to lower case. The caller must check the value of mappingToLowerCase() and map them if necessary.

Parameters:
values - the values with which to initialize the URLResource. The values must be in the same order as the toString prints them.

len - the number of values to use. This can be less than the length of values, in which case the values greater than len will be ignored.

seed - the random number to use in getID calculation.

httpMethod - the HTTP method (for example, "GET"), or null if not applicable.

suffix - the suffix of the file (for example, ".jsp") or null if not applicable.

URIUnchanged - true if we have not changed the URI from how it was passed to us from the container. This is needed to special-case getParentResource().


getType

public java.lang.String getType()
Gets the type of this resource (URLResource).

Returns:
the type of this resource, represented as a String.


makeParent

protected Resource makeParent()
Gets a Resource object that represents the parent of the current URLResource. If the resource does not have a parent, the value of null must be returned.

The parentage hierarchy for the URLResource (that is, the values returned from successive calls to this method) is:

type=<url>, application=myApp, contextPath="/mywebapp", uri=/foo/bar/my.jsp, httpMethod=GET, transportType=confidential
type=<url>, application=myApp, contextPath="/mywebapp", uri=/foo/bar/my.jsp, httpMethod=GET
type=<url>, application=myApp, contextPath="/mywebapp", uri=/foo/bar/my.jsp
type=<url>, application=myApp, contextPath="/mywebapp", uri=/foo/bar/my.jsp/*, httpMethod=GET
type=<url>, application=myApp, contextPath="/mywebapp", uri=/foo/bar/my.jsp/*
type=<url>, application=myApp, contextPath="/mywebapp", uri=/foo/bar/*
type=<url>, application=myApp, contextPath="/mywebapp", uri=/foo/*
type=<url>, application=myApp, contextPath="/mywebapp", uri=*.jsp
type=<url>, application=myApp, contextPath="/mywebapp", uri=/*
type=<url>, application=myApp, contextPath="/mywebapp"
type=<url>, application=myApp
type=<app>, application=myApp
type=<url>

Returns:
the Resource object of the parent resource.

Overrides:
makeParent in class ResourceBase

getKeys

public java.lang.String[] getKeys()
Gets keys for the URLresource.

Returns:
an array of Strings containing the URLResource's keys.

Overrides:
getKeys in class ResourceBase

getFieldType

public int getFieldType(java.lang.String fieldName)

Overrides:
getFieldType in class ResourceBase

getRepeatingFieldIndex

public int getRepeatingFieldIndex()

Overrides:
getRepeatingFieldIndex in class ResourceBase

getRepeatingFieldTerminatingIndex

public int getRepeatingFieldTerminatingIndex()

Overrides:
getRepeatingFieldTerminatingIndex in class ResourceBase

getApplicationName

public java.lang.String getApplicationName()
Gets the name of the application associated with the URLResource.

Returns:
the name of the application associated with the URLResource, represented as a String.


getContextPath

public java.lang.String getContextPath()
Gets the URI of the Web component.

Returns:
a String representing the URI of the Web component.


getURI

public java.lang.String getURI()
Gets the URI of the Web component.

Returns:
the URI of the Web component, represented as a String.


getHttpMethod

public java.lang.String getHttpMethod()
Gets the HTTP method of the URL resource.

Returns:
the name of the HTTP method on the URLResource, represented as a String.


getTransportType

public java.lang.String getTransportType()
Gets the transport guarantee required to access the URLResource.

Returns:
the transport guarantee required to access the URLResource.


mappingToLowerCase

public boolean mappingToLowerCase()
Returns true if we are mapping the contextPath and URI to lower case upon creation.

equals

public boolean equals(java.lang.Object obj)
Compares this resource to the resource in the specified object.

Parameters:
obj - the other resource with which to compare this resource.

Returns:
TRUE if the resource passed in matches this resource, and FALSE otherwise.

Overrides:
equals in class ResourceBase
See Also:
Object.equals(Object)