Package org.apache.jackrabbit.j2ee
Class RepositoryAccessServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.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 JNDI.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
initial param name for the bootstrap config location -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the config that was used to bootstrap this servlet.static RepositoryAccessServlet
getInstance
(javax.servlet.ServletContext ctx) Returns the instance of this servletReturns the JCR repositorystatic Repository
getRepository
(javax.servlet.ServletContext ctx) Returns the JCR repositoryprotected Repository
If our config said so, try to retrieve a Repository from the ServletContextvoid
init()
Initializes the servlet.
Please note that only one repository startup servlet may exist per webapp.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
-
Field Details
-
INIT_PARAM_BOOTSTRAP_CONFIG
initial param name for the bootstrap config location- See Also:
-
-
Constructor Details
-
RepositoryAccessServlet
public RepositoryAccessServlet()
-
-
Method Details
-
init
public void init() throws javax.servlet.ServletExceptionInitializes the servlet.
Please note that only one repository startup servlet may exist per webapp. it registers itself as context attribute and acts as singleton.- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
- if a same servlet is already registered or of another initialization error occurs.
-
getInstance
Returns the instance of this servlet- Parameters:
ctx
- the servlet context- Returns:
- this servlet
-
getRepositoryByContextAttribute
If our config said so, try to retrieve a Repository from the ServletContext -
getRepository
Returns the JCR repository- Returns:
- a JCR repository
- Throws:
IllegalStateException
- if the repository is not available in the context.
-
getRepository
Returns the JCR repository- Parameters:
ctx
- the servlet context- Returns:
- a JCR repository
- Throws:
IllegalStateException
- if the repository is not available in the context.
-
getBootstrapConfig
Returns the config that was used to bootstrap this servlet.- Returns:
- the bootstrap config or
null
.
-