## org.w3c.tools.resources
Class LookupState

    java.lang.Object
      |
      +--org.w3c.tools.resources.LookupState

public class LookupState
extends java.lang.Object

This object keeps the state info around while looking up an entity.

Constructor Summary
`LookupState(RequestInterface request)` Create a lookup state to handle the given request on behalf of client.
`LookupState(java.lang.String uri)` Construct a lookup state to be resolved internnaly by the server.

Method Summary
`int` | `countRemainingComponents()` How much components have not yet been looked up in this state.
`java.lang.String` | `getFragment()` Get the fragment part of the URL, if any.
`java.lang.String` | `getNextComponent()` Get next part of the URL to be look for.
`java.lang.String` | `getQuery()` Get the query part of the URL, if any.
`java.lang.String` | `getRemainingPath()` Get the remaiing path, without consuming it.
`java.lang.String` | `getRemainingPath(boolean consume)` Get the remaining path.
`RequestInterface` | `getRequest()` Get this lookup state request.
`java.lang.String` | `getURI()` Get this lookpu state full URI.
`boolean` | `hasMoreComponents()` Does this look up state has more components to be looked for.
`boolean` | `hasRequest()` Is this lookup state object associated with a request ?
`boolean` | `isDirectory()` Is the requested URI a directory URI ?
`boolean` | `isInternal()` Is this lookup state internal to the server.
`void` | `markInternal()` Mark this lookup state as being done internally.
`protected void` | `parseURI()` Parse the given URI into an array of hierarchical components.
`java.lang.String` | `peekNextComponent()` Get the next component, without consuming it.
`static java.lang.String` | `unescape(java.lang.String s)` Unescape a escaped string

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

Constructor Detail

### LookupState

    public LookupState(RequestInterface request)
                throws ProtocolException

  Create a lookup state to handle the given request on behalf of client.
  Parameters:
    `client` - The client that issued the request.
    `request` - The request whose URI is to bee looked up.
  Throws:
    ProtocolException - if an error relative to the protocol occurs

### LookupState

    public LookupState(java.lang.String uri)
                throws ProtocolException

  Construct a lookup state to be resolved internnaly by the server. This method allows for internal lookup of object, even if there is no real client making the request.
  Parameters:
    `uri` - The URI to be looked up.
  Throws:
    ProtocolException - if an error relative to the protocol occurs

Method Detail

### unescape

    public static java.lang.String unescape(java.lang.String s)

  Unescape a escaped string
  Parameters:
    `s` - The string to be unescaped
  Returns:
    the unescaped string.

### parseURI

    protected void parseURI()
                     throws ProtocolException

  Parse the given URI into an array of hierarchical components. The optional query string and an optional fragment are recorded into the request as new fields.

  The query string and the fragment are recorded into the request as the query and frag attributes.

  Throws:
    ProtocolException - if unable to parse

### getFragment

    public java.lang.String getFragment()

  Get the fragment part of the URL, if any. The fragment is anything beyond the # character in a URL.
  Returns:
    A String instance, or null.

### getQuery

    public java.lang.String getQuery()

  Get the query part of the URL, if any. The query is anything beyond a ? character in a URL.
  Returns:
    A String instance, or null.

### isDirectory

    public boolean isDirectory()

  Is the requested URI a directory URI ?
  Returns:
    A boolean true if the requested URI ends with a slash, false otherwise.

### getURI

    public java.lang.String getURI()

  Get this lookpu state full URI.

### getNextComponent

    public final java.lang.String getNextComponent()

  Get next part of the URL to be look for.
  Returns:
    A String giving the next component.

### peekNextComponent

    public final java.lang.String peekNextComponent()

  Get the next component, without consuming it.
  Returns:
    A String giving the next component, or null if none is available.

### getRemainingPath

    public final java.lang.String getRemainingPath(boolean consume)

  Get the remaining path.
  Parameters:
    `consume` - If true, consume the components, otherwise, just peek them.
  Returns:
    A String giving the remaining URL.

### getRemainingPath

    public final java.lang.String getRemainingPath()

  Get the remaiing path, without consuming it.
  Returns:
    The remaining path.

### hasMoreComponents

    public boolean hasMoreComponents()

  Does this look up state has more components to be looked for.
  Returns:
    true if more components are to be looked for.

### countRemainingComponents

    public int countRemainingComponents()

  How much components have not yet been looked up in this state.

### getRequest

    public final RequestInterface getRequest()

  Get this lookup state request.
  Returns:
    An instance of RequestInterface, or null if this is an internal request.

### hasRequest

    public boolean hasRequest()

  Is this lookup state object associated with a request ?
  Returns:
    A boolean true if a request is associated.

### markInternal

    public void markInternal()

  Mark this lookup state as being done internally. This allows lookup methods to be more kind (for example, not throwing redirections error, etc).

### isInternal

    public boolean isInternal()

  Is this lookup state internal to the server. Internal lookup state may not have an associated request.
  Returns:
    A boolean true if this is an internal request.