com.silverpeas.jcrutil.servlets
Class RepositoryAccessServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.silverpeas.jcrutil.servlets.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 or RMI.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
RepositoryAccessServlet()
           
 
Method Summary
 javax.jcr.Repository getRepository()
          Returns the JCR repository
static javax.jcr.Repository getRepository(javax.servlet.ServletContext ctx)
          Returns the JCR repository
 void init()
          Initializes the servlet.
protected  void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, 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

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

RepositoryAccessServlet

public RepositoryAccessServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initializes 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 class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException - if a same servlet is already registered or of another initialization error occurs.

service

protected void service(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse resp)
                throws javax.servlet.ServletException,
                       IOException
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
IOException

getRepository

public javax.jcr.Repository getRepository()
Returns the JCR repository

Returns:
a JCR repository
Throws:
IllegalStateException - if the repository is not available in the context.

getRepository

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

Parameters:
ctx - the servlet context
Returns:
a JCR repository
Throws:
IllegalStateException - if the repository is not available in the context.


Copyright © 2016 Silverpeas. All Rights Reserved.