org.ow2.jonas.web.tomcat6.versioning
Class ContextFinder

java.lang.Object
  extended by org.ow2.jonas.web.tomcat6.versioning.ContextFinder

public final class ContextFinder
extends Object

Manages virtual contexts.

Author:
Frederic Germaneau, S. Ali Tokmen

Method Summary
static void addNonVersionedContext(String context)
          Adds a non-versioned context root.
static boolean bindContextRoot(String appName, String userURI, org.apache.catalina.Context contextRoot, String policy)
          Binds a new context root.
static org.apache.tomcat.util.buf.MessageBytes getContextURI(org.apache.tomcat.util.buf.MessageBytes decodedURI, org.apache.catalina.connector.Request req, VersionedPathBean vpb)
          Gets the context URI for a given request using the Context URI mapping.
static Map<String,String> readContextRoot(String userContextRoot)
           
static void removeNonVersionedContext(String context)
          Remove a non-versioned context root.
static void setJmxService(JmxService jmxService)
           
static void setParent(BaseWebContainerService webContainer)
           
static boolean unbindContextRoot(org.apache.catalina.Context contextRoot)
          Unbinds a versioned path.
static boolean unbindContextRoot(String contextRoot)
          Unbinds a versioned path.
static boolean unbindContextRoot(String userURI, org.apache.catalina.Context contextRoot)
          Unbinds a context root.
static boolean unbindContextRoot(String userURI, String versionedPath)
          Unbinds a versioned path.
static boolean unbindVirtualContext(String userURI)
          Unbinds a user (virtual) URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setJmxService

public static void setJmxService(JmxService jmxService)
Parameters:
jmxService - JMX service to set.

setParent

public static void setParent(BaseWebContainerService webContainer)
Parameters:
webContainer - JOnAS web container to set.

getContextURI

public static org.apache.tomcat.util.buf.MessageBytes getContextURI(org.apache.tomcat.util.buf.MessageBytes decodedURI,
                                                                    org.apache.catalina.connector.Request req,
                                                                    VersionedPathBean vpb)
                                                             throws IOException
Gets the context URI for a given request using the Context URI mapping.

Parameters:
decodedURI - Decoded URI.
req - Request received by the HTTP server.
vpb - Bean to use for saving information about resolving paths.
Returns:
Response bytes.
Throws:
IOException - If duplication of the decodedURI fails.

addNonVersionedContext

public static void addNonVersionedContext(String context)
Adds a non-versioned context root.

Parameters:
context - Context root.

bindContextRoot

public static boolean bindContextRoot(String appName,
                                      String userURI,
                                      org.apache.catalina.Context contextRoot,
                                      String policy)
Binds a new context root. If the userURI is an existing versioned path, adds the context to the map using the given policy. Else, creates a new versioned context with this root as default.

Parameters:
appName - Name of the application the context belongs to.
userURI - User URI.
contextRoot - Versioned context root.
policy - Policy to use, ignored if new virtual context.
Returns:
true if versioning enabled, false otherwise.

readContextRoot

public static Map<String,String> readContextRoot(String userContextRoot)
Parameters:
userContextRoot - User (virtual) context root to list.
Returns:
Context root information for a given virtual (user) URI.

removeNonVersionedContext

public static void removeNonVersionedContext(String context)
Remove a non-versioned context root.

Parameters:
context - Context root.

unbindContextRoot

public static boolean unbindContextRoot(String userURI,
                                        org.apache.catalina.Context contextRoot)
Unbinds a context root.

Parameters:
userURI - User (virtual) URI to unbind from.
contextRoot - Context root to unbind.
Returns:
true if succeeded, false otherwise.

unbindContextRoot

public static boolean unbindContextRoot(String userURI,
                                        String versionedPath)
Unbinds a versioned path.

Parameters:
userURI - User (virtual) URI to unbind from.
versionedPath - Versioned path to unbind.
Returns:
true if succeeded, false otherwise.

unbindContextRoot

public static boolean unbindContextRoot(org.apache.catalina.Context contextRoot)
Unbinds a versioned path.

Parameters:
versionedPath - Versioned path to unbind.
Returns:
true if succeeded, false otherwise.

unbindContextRoot

public static boolean unbindContextRoot(String contextRoot)
Unbinds a versioned path.

Parameters:
versionedPath - Versioned path to unbind.
Returns:
true if succeeded, false otherwise.

unbindVirtualContext

public static boolean unbindVirtualContext(String userURI)
Unbinds a user (virtual) URI.

Parameters:
userURI - User (virtual) URI to unbind.
Returns:
true if succeeded, false otherwise.


Copyright © 2010 OW2 Consortium. All Rights Reserved.