    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.tools.resources.LookupState

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

public class LookupState
extends Object

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

##

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

##

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

##

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(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

##

unescape

     public static String unescape(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 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 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 String getURI()

  Get this lookpu state full URI.

getNextComponent

     public final String getNextComponent()

  Get next part of the URL to be look for.

  Returns:
    A String giving the next component.

peekNextComponent

     public final 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 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 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.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index