org.hippoecm.hst.jaxrs
Class AbstractJaxrsService

java.lang.Object
  extended by org.hippoecm.hst.jaxrs.AbstractJaxrsService
All Implemented Interfaces:
JAXRSService
Direct Known Subclasses:
CXFJaxrsService

public abstract class AbstractJaxrsService
extends Object
implements JAXRSService

Version:
$Id: AbstractJaxrsService.java 32974 2012-02-16 07:21:17Z wko $

Nested Class Summary
protected static class AbstractJaxrsService.PathsAdjustedHttpServletRequestWrapper
           
protected static class AbstractJaxrsService.ServletConfigImpl
           
 
Field Summary
static String BEANS_ANNOTATED_CLASSES_CONF_PARAM
           
 
Fields inherited from interface org.hippoecm.hst.jaxrs.JAXRSService
REQUEST_CONTENT_BEAN_KEY, REQUEST_CONTENT_NODE_KEY, REQUEST_CONTENT_PATH_KEY, REQUEST_CONTENT_SITE_CONTENT_BASE_BEAN_KEY
 
Constructor Summary
protected AbstractJaxrsService(String serviceName, Map<String,String> jaxrsConfigParameters)
           
 
Method Summary
 void destroy()
           
protected  List<Class<? extends HippoBean>> getAnnotatedClasses(HstRequestContext requestContext)
           
 String getAnnotatedClassesResourcePath()
           
protected  javax.jcr.Node getContentNode(javax.jcr.Session session, String path)
           
protected abstract  String getJaxrsPathInfo(HstRequestContext requestContext, javax.servlet.http.HttpServletRequest request)
          Concrete implementations must implement this method to get the jaxrs pathInfo.
protected  javax.servlet.http.HttpServletRequest getJaxrsRequest(HstRequestContext requestContext, javax.servlet.http.HttpServletRequest request)
           
protected  javax.servlet.ServletConfig getJaxrsServletConfig(javax.servlet.ServletContext servletContext)
           
protected  String getJaxrsServletPath(HstRequestContext requestContext)
           
protected  String getMountContentPath(HstRequestContext requestContext)
           
protected  ObjectConverter getObjectConverter(HstRequestContext requestContext)
           
 HippoBean getRequestContentBean(HstRequestContext requestContext)
          Returns the content HippoBean for the current request.
<T extends HippoBean>
T
getRequestContentBean(HstRequestContext requestContext, Class<T> beanMappingClass)
          Returns the content HippoBean of type T for the current request.
 String getServletPath()
           
 HippoFolderBean getSiteContentBaseBean(HstRequestContext requestContext)
           
 void initialize()
           
abstract  void invoke(HstRequestContext requestContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void setAnnotatedClasses(List<Class<? extends HippoBean>> annotatedClasses)
           
 void setAnnotatedClassesResourcePath(String annotatedClassesResourcePath)
           
 void setObjectConverter(ObjectConverter objectConverter)
           
 void setServletPath(String servletPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEANS_ANNOTATED_CLASSES_CONF_PARAM

public static final String BEANS_ANNOTATED_CLASSES_CONF_PARAM
See Also:
Constant Field Values
Constructor Detail

AbstractJaxrsService

protected AbstractJaxrsService(String serviceName,
                               Map<String,String> jaxrsConfigParameters)
Method Detail

getServletPath

public String getServletPath()

setServletPath

public void setServletPath(String servletPath)

getAnnotatedClassesResourcePath

public String getAnnotatedClassesResourcePath()

setAnnotatedClassesResourcePath

public void setAnnotatedClassesResourcePath(String annotatedClassesResourcePath)

setAnnotatedClasses

public void setAnnotatedClasses(List<Class<? extends HippoBean>> annotatedClasses)

setObjectConverter

public void setObjectConverter(ObjectConverter objectConverter)

getAnnotatedClasses

protected List<Class<? extends HippoBean>> getAnnotatedClasses(HstRequestContext requestContext)

getObjectConverter

protected ObjectConverter getObjectConverter(HstRequestContext requestContext)

initialize

public void initialize()
                throws ContainerException
Specified by:
initialize in interface JAXRSService
Throws:
ContainerException

invoke

public abstract void invoke(HstRequestContext requestContext,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws ContainerException
Specified by:
invoke in interface JAXRSService
Throws:
ContainerException

destroy

public void destroy()
Specified by:
destroy in interface JAXRSService

getJaxrsServletConfig

protected javax.servlet.ServletConfig getJaxrsServletConfig(javax.servlet.ServletContext servletContext)

getJaxrsServletPath

protected String getJaxrsServletPath(HstRequestContext requestContext)
                              throws ContainerException
Throws:
ContainerException

getJaxrsPathInfo

protected abstract String getJaxrsPathInfo(HstRequestContext requestContext,
                                           javax.servlet.http.HttpServletRequest request)
                                    throws ContainerException
Concrete implementations must implement this method to get the jaxrs pathInfo. This one is most likely different than HstRequestContext#getBaseURL()#getPathInfo() because the baseURL has a pathInfo which has been stripped from matrix parameters

Parameters:
requestContext -
request -
Returns:
Throws:
ContainerException

getJaxrsRequest

protected javax.servlet.http.HttpServletRequest getJaxrsRequest(HstRequestContext requestContext,
                                                                javax.servlet.http.HttpServletRequest request)
                                                         throws ContainerException
Throws:
ContainerException

getMountContentPath

protected String getMountContentPath(HstRequestContext requestContext)

getContentNode

protected javax.jcr.Node getContentNode(javax.jcr.Session session,
                                        String path)
                                 throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getRequestContentBean

public <T extends HippoBean> T getRequestContentBean(HstRequestContext requestContext,
                                                     Class<T> beanMappingClass)
Returns the content HippoBean of type T for the current request. If there cannot be found a bean of type beanMappingClass for the relative content path of the resolved sitemap item, null is returned. If there is no resolved sitemap item, null is returned.

Type Parameters:
T -
Parameters:
requestContext -
beanMappingClass -
Returns:
a bean of type T and null if there cannot be found a content bean for the requestContext or when the bean is not of type beanMappingClass

getRequestContentBean

public HippoBean getRequestContentBean(HstRequestContext requestContext)
Returns the content HippoBean for the current request.

Parameters:
requestContext -
beanMappingClass -
Returns:
the HippoBean where the relative contentpath of the sitemap item points to or null when not found, or no relative content path is present, or no resolved sitemap item

getSiteContentBaseBean

public HippoFolderBean getSiteContentBaseBean(HstRequestContext requestContext)
Parameters:
requestContext -
Returns:
the siteContentBaseBean if it can be found and null otherwise


Copyright © 2008-2012 Hippo. All Rights Reserved.