org.apache.jackrabbit.j2ee
Class RepositoryAccessServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.apache.jackrabbit.j2ee.RepositoryAccessServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class RepositoryAccessServlet
extends javax.servlet.http.HttpServlet

This Class implements a servlet that is used as unified mechanism to retrieve a jcr repository either through JNID, RMI or JCRWebdavServer.

See Also:
Serialized Form

Field Summary
static String INIT_PARAM_LOG4J_CONFIG
           
static String INIT_PARAM_MISSING_AUTH_MAPPING
          the 'missing-auth-mapping' init parameter
static String INIT_PARAM_REPOSITORY_NAME
          the 'repository-name' init parameter
static String INIT_PARAM_RMI_URI
          the 'rmi-uri' init parameter
 
Constructor Summary
RepositoryAccessServlet()
           
 
Method Summary
static Credentials getCredentialsFromHeader(javax.servlet.ServletContext ctx, String authHeader)
          Build a Credentials object for the given authorization header.
static Repository getRepository(javax.servlet.ServletContext ctx)
          Returns the JSR170 repository
 void init()
          Initializes this servlet
static Session login(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest request)
          Simple login to the Repository accessed by this servlet using the Authorization header present in the given request.

Please note, that no workspace information is provided to the repository login (Repository.login(javax.jcr.Credentials)), thus the default workspace will be selected.

 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_PARAM_LOG4J_CONFIG

public static final String INIT_PARAM_LOG4J_CONFIG
See Also:
Constant Field Values

INIT_PARAM_REPOSITORY_NAME

public static final String INIT_PARAM_REPOSITORY_NAME
the 'repository-name' init parameter

See Also:
Constant Field Values

INIT_PARAM_RMI_URI

public static final String INIT_PARAM_RMI_URI
the 'rmi-uri' init parameter

See Also:
Constant Field Values

INIT_PARAM_MISSING_AUTH_MAPPING

public static final String INIT_PARAM_MISSING_AUTH_MAPPING
the 'missing-auth-mapping' init parameter

See Also:
Constant Field Values
Constructor Detail

RepositoryAccessServlet

public RepositoryAccessServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initializes this servlet

Throws:
javax.servlet.ServletException

getRepository

public static Repository getRepository(javax.servlet.ServletContext ctx)
Returns the JSR170 repository

Returns:
a jsr170 repository

getCredentialsFromHeader

public static Credentials getCredentialsFromHeader(javax.servlet.ServletContext ctx,
                                                   String authHeader)
                                            throws javax.servlet.ServletException,
                                                   LoginException
Build a Credentials object for the given authorization header. The creds may be used to login to the repository. If the specified header string is null or not of the required format the behaviour depends on the INIT_PARAM_MISSING_AUTH_MAPPING param:

Parameters:
authHeader - Authorization header as present in the Http request
Returns:
credentials or null.
Throws:
javax.servlet.ServletException - If an IOException occured while decoding the Authorization header.
LoginException - if no suitable auth header and missing-auth-mapping is not present
See Also:
getRepository(ServletContext)

login

public static Session login(javax.servlet.ServletContext ctx,
                            javax.servlet.http.HttpServletRequest request)
                     throws LoginException,
                            javax.servlet.ServletException
Simple login to the Repository accessed by this servlet using the Authorization header present in the given request.

Please note, that no workspace information is provided to the repository login (Repository.login(javax.jcr.Credentials)), thus the default workspace will be selected. In order to provide a specific workspace name, manual login is required (see also getRepository(ServletContext)).

Parameters:
request -
Returns:
Session object obtained upon Repository.login(javax.jcr.Credentials).
Throws:
javax.servlet.ServletException
LoginException - if credentials are invalid
See Also:
in order to be able to login to a specific workspace., for a utility method to retrieve credentials from the Authorization header string.


Copyright © 2005 . All Rights Reserved.