Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal
Class UPFileSpec

    java.lang.Object
      org.jasig.portal.UPFileSpec

    public class UPFileSpec

extends java.lang.Object

This helper class allows for easy access to the information contained in the ever-changing uP file URL spec. The uP file syntax is likely to change often, therefore we encourage developers to use this class instead of trying to parse the uP file on your own.

Note: in case you're wondering what in the world "uP file" is, take a look at the portal URLs. The context path ends with a file-like specification that always has ".uP" at the end ... that's what we call a "uP" file. It is used to provide information on how different requests should be processed.

Current uP file syntax looks like this: `"[tag.tagId.]{method}.methodId.[target.targetId.][*.]uP"`, where "[]" denote optional expressions and "{}" choice-defined expressions. The "{method}" field, at the moment has two choices: "render" and "worker".

uPortal will assume that the .uP file spec is always well-formed, so don't try to construct it on your own, use `baseActionURL` or one of the `workerActionURL`s.

Version:
  $Revision: 1.14 $
Author:
  Peter Kharchenko

Field Summary
`static java.lang.String` | `DETACH_URL_ELEMENT`
`static java.lang.String` | `FILE_DOWNLOAD_WORKER`
`(package private) java.lang.String` | `method`
`(package private) java.lang.String` | `methodNodeId`
`static java.lang.String` | `PORTAL_URL_SEPARATOR`
`static java.lang.String` | `PORTAL_URL_SUFFIX`
`static int` | `RENDER_METHOD`
`static java.lang.String` | `RENDER_URL_ELEMENT`
`static java.lang.String` | `TAG_URL_ELEMENT`
`(package private) java.lang.String` | `tagId`
`static java.lang.String` | `TARGET_URL_ELEMENT`
`(package private) java.lang.String` | `targetNodeId`
`(package private) java.lang.String` | `uPFile_extras`
`static int` | `WORKER_METHOD`
`static java.lang.String` | `WORKER_URL_ELEMENT`

Constructor Summary
`UPFileSpec()` Creates a new `UPFileSpec` instance with all values being null.
`UPFileSpec(javax.servlet.http.HttpServletRequest req)` Construct a .uP file spec object for a .uP file contained in a given request.
`UPFileSpec(java.lang.String uPFile)` Construct a .uP file spec object by providing the actual .uP file string
`UPFileSpec(java.lang.String tagId, int method, java.lang.String methodNodeId, java.lang.String targetNodeId, java.lang.String extraElements)` A building constructor.
`UPFileSpec(UPFileSpec up)` Copy constructor.

Method Summary
`protected void` | `analyze(java.lang.String uPFile)`
`static java.lang.String` | `buildUPFile(java.lang.String tagId, int method, java.lang.String methodNodeId, java.lang.String targetNodeId, java.lang.String extraElements)` Constructs a .uP file
`static java.lang.String` | `buildUPFileBase(java.lang.String tagId, int method, java.lang.String methodNodeId, java.lang.String targetNodeId, java.lang.String extraElements)` Constructs a .uP file, without the suffix (actual ".uP") so it can be extended further.
`protected static java.lang.String` | `buildUPFileBase(java.lang.String tagId, java.lang.String method, java.lang.String methodNodeId, java.lang.String targetNodeId, java.lang.String extraElements)`
`java.lang.String` | `getMethod()` Determine method name
`java.lang.String` | `getMethodNodeId()` Determine Id specified by the method element.
`java.lang.String` | `getTagId()` Returns a tag identifier.
`java.lang.String` | `getTargetNodeId()` Determine Id specified by the "target" element.
`java.lang.String` | `getUPFile()` Get the full .uP file `String`.
`java.lang.String` | `getUPFileExtras()` Returns a "cleaned-up" version of the uP file with all known fields such as tag, method, and target, removed.
`void` | `setMethod(int method)` Set a method.
`void` | `setMethodNodeId(java.lang.String nodeId)` Set method node id.
`void` | `setTagId(java.lang.String id)` Set a tag id
`void` | `setTargetNodeId(java.lang.String nodeId)` Set target node id
`void` | `setUPFileExtras(java.lang.String extras)` Set extras to be appended to the spec before the suffix element (".uP")
`private static java.lang.String` | `sinkTokenization(java.util.StringTokenizer st, java.lang.String delimiter, java.lang.String initialValue)` Sinks tokens back into a string.

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

Field Detail

### TAG_URL_ELEMENT

    public static final java.lang.String TAG_URL_ELEMENT

See Also:
  Constant Field Values

### TARGET_URL_ELEMENT

    public static final java.lang.String TARGET_URL_ELEMENT

See Also:
  Constant Field Values

### WORKER_URL_ELEMENT

    public static final java.lang.String WORKER_URL_ELEMENT

See Also:
  Constant Field Values

### DETACH_URL_ELEMENT

    public static final java.lang.String DETACH_URL_ELEMENT

See Also:
  Constant Field Values

### RENDER_URL_ELEMENT

    public static final java.lang.String RENDER_URL_ELEMENT

See Also:
  Constant Field Values

### PORTAL_URL_SEPARATOR

    public static final java.lang.String PORTAL_URL_SEPARATOR

See Also:
  Constant Field Values

### PORTAL_URL_SUFFIX

    public static final java.lang.String PORTAL_URL_SUFFIX

See Also:
  Constant Field Values

### FILE_DOWNLOAD_WORKER

    public static final java.lang.String FILE_DOWNLOAD_WORKER

See Also:
  Constant Field Values

### RENDER_METHOD

    public static final int RENDER_METHOD

See Also:
  Constant Field Values

### WORKER_METHOD

    public static final int WORKER_METHOD

See Also:
  Constant Field Values

### tagId

    java.lang.String tagId

### method

    java.lang.String method

### methodNodeId

    java.lang.String methodNodeId

### targetNodeId

    java.lang.String targetNodeId

### uPFile_extras

    java.lang.String uPFile_extras

Constructor Detail

### UPFileSpec

    public UPFileSpec()

  Creates a new `UPFileSpec` instance with all values being null.

### UPFileSpec

    public UPFileSpec(javax.servlet.http.HttpServletRequest req)

  Construct a .uP file spec object for a .uP file contained in a given request.

  Parameters:
    `req` - a `HttpServletRequest` value

### UPFileSpec

    public UPFileSpec(java.lang.String uPFile)

  Construct a .uP file spec object by providing the actual .uP file string

  Parameters:
    `uPFile` - a `String` value

### UPFileSpec

    public UPFileSpec(UPFileSpec up)

  Copy constructor.

  Parameters:
    `up` - an `UPFileSpec` value to copy the values from

### UPFileSpec

    public UPFileSpec(java.lang.String tagId,
                      int method,
                      java.lang.String methodNodeId,
                      java.lang.String targetNodeId,
                      java.lang.String extraElements)
               throws PortalException

  A building constructor.

  Parameters:
    `tagId` - a tag id `String` value (can be `null`)
    `method` - a method `String` value (required, must be one of the `UPFileSpec.*_METHOD` constants, i.e. `RENDER_METHOD` or `WORKER_METHOD`)
    `methodNodeId` - a method node id `String` value (required value, can not be `null`)
    `targetNodeId` - a target id `String` value (can be `null`)
    `extraElements` - a `String` to be incorporated into the file name before the suffix (".uP"). These values will be available from the `getUPFileExtras()` result when .uP file is parsed. (can be `null`)
  Throws:
    `PortalException` - if an invalid method code is passed or no methodNodeId is present.

Method Detail

### setTagId

    public void setTagId(java.lang.String id)

  Set a tag id

  Parameters:
    `id` - a `String` value

### setMethod

    public void setMethod(int method)
                   throws PortalException

  Set a method.

  Parameters:
    `method` - a method `String` value (required, must be one of the `UPFileSpec.*_METHOD` constants, i.e. `RENDER_METHOD` or `WORKER_METHOD`)
  Throws:
    `PortalException` - if an invalid method id is passed.

### setMethodNodeId

    public void setMethodNodeId(java.lang.String nodeId)

  Set method node id.

  Parameters:
    `nodeId` - a `String` value

### setTargetNodeId

    public void setTargetNodeId(java.lang.String nodeId)

  Set target node id

  Parameters:
    `nodeId` - a `String` value

### setUPFileExtras

    public void setUPFileExtras(java.lang.String extras)

  Set extras to be appended to the spec before the suffix element (".uP")

  Parameters:
    `extras` - a `String` value

### getTagId

    public java.lang.String getTagId()

  Returns a tag identifier.

  Returns:
    a `String` tag value, `null` if no tag was specified.

### getMethod

    public java.lang.String getMethod()

  Determine method name

  Returns:
    a `String` method name, `null` if no method was specified.

### getMethodNodeId

    public java.lang.String getMethodNodeId()

  Determine Id specified by the method element.

  Returns:
    a `String` method node Id value, `null` if no method was specified.

### getTargetNodeId

    public java.lang.String getTargetNodeId()

  Determine Id specified by the "target" element.

  Returns:
    a `String` target Id value, `null` if no target was specified.

### getUPFile

    public java.lang.String getUPFile()
                               throws PortalException

  Get the full .uP file `String`.

  Returns:
    a `String` value
  Throws:
    `PortalException`

### getUPFileExtras

    public java.lang.String getUPFileExtras()

  Returns a "cleaned-up" version of the uP file with all known fields such as tag, method, and target, removed. This can be used by...

  Returns:
    a `String` value, `null` if none were encountered.

### buildUPFile

    public static java.lang.String buildUPFile(java.lang.String tagId,
                                               int method,
                                               java.lang.String methodNodeId,
                                               java.lang.String targetNodeId,
                                               java.lang.String extraElements)
                                        throws PortalException

  Constructs a .uP file

  Parameters:
    `tagId` - a tag id `String` value (can be `null`)
    `method` - a method `String` value (required, must be one of the `UPFileSpec.*_METHOD` constants, i.e. `RENDER_METHOD` or `WORKER_METHOD`)
    `methodNodeId` - a method node id `String` value (required value, can not be `null`)
    `targetNodeId` - a target id `String` value (can be `null`)
    `extraElements` - a `String` to be incorporated into the file name before the suffix (".uP"). These values will be available from the `getUPFileExtras()` result when .uP file is parsed. (can be `null`)
  Returns:
    a `String` value
  Throws:
    `PortalException` - if an invalid method code is passed or no methodNodeId is present.

### buildUPFileBase

    public static java.lang.String buildUPFileBase(java.lang.String tagId,
                                                   int method,
                                                   java.lang.String methodNodeId,
                                                   java.lang.String targetNodeId,
                                                   java.lang.String extraElements)
                                            throws PortalException

  Constructs a .uP file, without the suffix (actual ".uP") so it can be extended further.

  Parameters:
    `tagId` - a tag id `String` value (can be `null`)
    `method` - a method `String` value (required, must be one of the `UPFileSpec.*_METHOD` constants, i.e. `RENDER_METHOD` or `WORKER_METHOD`)
    `methodNodeId` - a method node id `String` value (required value, can not be `null`)
    `targetNodeId` - a target id `String` value (can be `null`)
    `extraElements` - a `String` to be incorporated into the file name before the suffix (".uP"). These values will be available from the `getUPFileExtras()` result when .uP file is parsed. (can be `null`)
  Returns:
    a `String` value
  Throws:
    `PortalException` - if an invalid method code is passed or no methodNodeId is present.

### buildUPFileBase

    protected static java.lang.String buildUPFileBase(java.lang.String tagId,
                                                      java.lang.String method,
                                                      java.lang.String methodNodeId,
                                                      java.lang.String targetNodeId,
                                                      java.lang.String extraElements)
                                               throws PortalException

  Throws:
    `PortalException`

### analyze

    protected void analyze(java.lang.String uPFile)

### sinkTokenization

    private static java.lang.String sinkTokenization(java.util.StringTokenizer st,
                                                     java.lang.String delimiter,
                                                     java.lang.String initialValue)

  Sinks tokens back into a string. All except for the last one.

  Parameters:
    `st` - a `StringTokenizer` value
    `delimiter` - a `String` delimeter value used to produce the tokenization
    `initialValue` - a `String` value to which to append remaining tokens
  Returns:
    a `String` value

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD