|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.jackrabbit.servlet.AbstractRepositoryServlet
public abstract class AbstractRepositoryServlet
Abstract base class for servlets that make a repository available in
the servlet context. This class handles the initialization and cleanup
tasks of setting up and clearing the configured repository attribute,
while a subclass only needs to implement the abstract
getRepositoryFactory() method that returns a factory for
retrieving the actual content repository.
The Repository instance bound to the servlet context is actually
a ProxyRepository that uses the given RepositoryFactory
for late binding of the underlying content repository.
The default name of the repository attribute is
"javax.jcr.Repository", but it can be changed by specifying
an init parameter with the same name:
<servlet>
<init-param>
<param-name>javax.jcr.Repository</param-name>
<param-value>my.repository.attribute</param-value>
<description>
This init parameter causes the repository to be looked up from
the "my.repository.attribute" attribute instead of the default
"javax.jcr.Repository".
</description>
</init-param>
</servlet>
A repository servlet can also be mapped to the URL space. See the
doGet(HttpServletRequest, HttpServletResponse) method for
the details of the default behavior.
| Constructor Summary | |
|---|---|
AbstractRepositoryServlet()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Removes the repository attribute from the servlet context. |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Outputs the repository descriptors either as a collection of properties (see Properties.store(java.io.OutputStream, String) or
individually addressable text/plain resources based on the request URI. |
protected java.lang.String |
getAttributeName()
Returns the name of the repository attribute. |
protected java.lang.String |
getInitParameter(java.lang.String name,
java.lang.String def)
Utility method that returns the named init parameter or the given default value if the parameter does not exist. |
protected abstract RepositoryFactory |
getRepositoryFactory()
Returns the repository factory that will be used by the ProxyRepository bound to the servlet context. |
void |
init()
Binds a ProxyRepository with the factory returned by
getRepositoryFactory() in the configured servlet
context attribute. |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
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 |
| Constructor Detail |
|---|
public AbstractRepositoryServlet()
| Method Detail |
|---|
public void init()
throws javax.servlet.ServletException
ProxyRepository with the factory returned by
getRepositoryFactory() in the configured servlet
context attribute.
init in class javax.servlet.GenericServletjavax.servlet.ServletException - if the factory could not be retrievedpublic void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServlet
protected abstract RepositoryFactory getRepositoryFactory()
throws javax.servlet.ServletException
ProxyRepository bound to the servlet context.
javax.servlet.ServletException - if the factory could not be createdprotected java.lang.String getAttributeName()
javax.jcr.Repository" or
the value of the "javax.jcr.Repository" init parameter.
A subclass can override this method to customize the attribute name, but for consistency it is generally better not to do that.
protected java.lang.String getInitParameter(java.lang.String name,
java.lang.String def)
name - name of the init parameterdef - default value
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
Properties.store(java.io.OutputStream, String) or
individually addressable text/plain resources based on the request URI.
A typical mapping for a repository servlet would be:
<servlet-mapping> <servlet-name>Repository</servlet-name> <url-pattern>/repository/*</url-pattern> </servlet-mapping>
This mapping would allow clients to retrieve all repository descriptors
from http://server/context/repository/ and to address
individual descriptors by key with URIs like
http://server/context/repository/key.
For example, the name of the repository vendor could be retrieved from
http://server/context/repository/jcr.repository.vendor.
Likewise, a 404 (not found) response from
http://server/context/repository/level.2.supported would
indicate that the repository does not support Level 2 features.
Note that mapping a repository servlet to the URL space is optional, as the main purpose of the servlet is to make a repository available in the servlet context, not to expose repository information to web clients.
doGet in class javax.servlet.http.HttpServletrequest - HTTP requestresponse - HTTP response
java.io.IOException - on IO errors
javax.servlet.ServletException - on servlet errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||