public abstract class AbstractResource extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HST_MOUNT_REL_PREFIX |
static String |
HST_REST_RELATIONS_BASE_URI |
static String |
MOUNT_ALIAS_ASSETS |
static String |
MOUNT_ALIAS_GALLERY |
static String |
MOUNT_ALIAS_REST |
static String |
MOUNT_ALIAS_SITE |
Constructor and Description |
---|
AbstractResource() |
Modifier and Type | Method and Description |
---|---|
protected String |
deleteHippoBean(javax.servlet.http.HttpServletRequest servletRequest,
HippoBean hippoBean)
Deletes the content node mapped to the provided
HippoBean |
List<Class<? extends HippoBean>> |
getAnnotatedClasses(HstRequestContext requestContext)
Deprecated.
since 2.28.00 not used any more. If custom annotated classes are needed, inject a
custom object converter in the HstRequestContext through ContentBeansTool. This method does not do
anything any more
|
String |
getAnnotatedClassesResourcePath()
Deprecated.
since 2.28.00 not used any more. If custom annotated classes are needed, inject a
custom object converter in the HstRequestContext through ContentBeansTool
|
protected HippoBean |
getChildBeanByRelPathOrPrimaryNodeType(HippoBean hippoBean,
String relPath,
String primaryNodeType)
|
ContentRewriter<String> |
getContentRewriter() |
protected String |
getHstQualifiedLinkRel(String simpleRel)
Creates an URL that can be used to specify the relation type for a link such as
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/> |
HstQueryManager |
getHstQueryManager(HstRequestContext requestContext) |
HstQueryManager |
getHstQueryManager(javax.jcr.Session session,
HstRequestContext requestContext) |
protected String |
getLinkMountRelation(String mountName)
Creates an URL that can be used to specify the relation type for a link such as
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/> |
HippoFolderBean |
getMountContentBaseBean(HstRequestContext requestContext) |
protected Link |
getMountLink(HstRequestContext requestContext,
HippoBean hippoBean,
String mountAliasName,
String subPath)
Creates a link to the provided
HippoBean , exposed over the mount identified by the alias
mountAliasName . |
protected Link |
getNodeLink(HstRequestContext requestContext,
HippoBean hippoBean)
Creates a link to the provided
HippoBean , exposed over the rest mount. |
ObjectConverter |
getObjectConverter(HstRequestContext requestContext) |
protected javax.jcr.Session |
getPersistableSession(HstRequestContext requestContext)
Creates a persistable JCR session with the default credentials
|
protected javax.jcr.Session |
getPersistableSession(HstRequestContext requestContext,
javax.jcr.Credentials credentials)
Creates a persistable JCR session with provided credentials.
|
protected ObjectBeanPersistenceManager |
getPersistenceManager(HstRequestContext requestContext)
Creates and returns a persistence manager with the default session of the requestContext.
|
protected ObjectBeanPersistenceManager |
getPersistenceManager(HstRequestContext requestContext,
javax.jcr.Session persistableSession)
Creates and returns a persistence manager with the specified session.
|
protected String |
getQualifiedLinkRel(String simpleRel)
Creates an URL that can be used to specify the relation type for a link such as
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/> |
protected String |
getQualifiedLinkRel(String iri,
String simpleRel)
Creates an URL that can be used to specify the relation type for a link such as
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/> |
protected HippoBean |
getRequestContentBean(HstRequestContext requestContext)
Returns the content HippoBean for the current request.
|
protected <T extends HippoBean> |
getRequestContentBean(HstRequestContext requestContext,
Class<T> beanMappingClass)
Returns the content HippoBean of type T for the current request.
|
protected HstRequestContext |
getRequestContext(javax.servlet.http.HttpServletRequest servletRequest) |
protected Link |
getRestLink(HstRequestContext requestContext,
HippoBean hippoBean,
String subPath)
Creates a link to the provided
HippoBean , exposed over the rest mount. |
String |
getRestRelationsBaseUri() |
protected Link |
getSiteLink(HstRequestContext requestContext,
HippoBean hippoBean)
Creates a link to the provided
HippoBean , exposed over the site mount. |
boolean |
isPageLinksExternal() |
void |
setAnnotatedClasses(List<Class<? extends HippoBean>> annotatedClasses) |
void |
setAnnotatedClassesResourcePath(String annotatedClassesResourcePath)
Deprecated.
since 2.28.00 not used any more. If custom annotated classes are needed, inject a
custom object converter in the HstRequestContext through ContentBeansTool
|
void |
setContentRewriter(ContentRewriter<String> contentRewriter) |
void |
setHstQueryManagerFactory(HstQueryManagerFactory hstQueryManagerFactory)
Deprecated.
since 2.28.00 not used any more. If custom object converter is needed, inject a
custom hst query manager in the HstRequestContext. This method does not do
anything any more
|
void |
setObjectConverter(ObjectConverter objectConverter)
Deprecated.
since 2.28.00 not used any more. If custom object converter is needed, inject a
custom object converter in the HstRequestContext through ContentBeansTool. This method does not do
anything any more
|
void |
setPageLinksExternal(boolean pageLinksExternal) |
void |
setRestRelationsBaseUri(String restRelationsBaseUri) |
public static final String MOUNT_ALIAS_REST
public static final String MOUNT_ALIAS_SITE
public static final String MOUNT_ALIAS_GALLERY
public static final String MOUNT_ALIAS_ASSETS
public static final String HST_REST_RELATIONS_BASE_URI
public static final String HST_MOUNT_REL_PREFIX
@Deprecated public String getAnnotatedClassesResourcePath()
@Deprecated public void setAnnotatedClassesResourcePath(String annotatedClassesResourcePath)
@Deprecated public List<Class<? extends HippoBean>> getAnnotatedClasses(HstRequestContext requestContext)
public void setAnnotatedClasses(List<Class<? extends HippoBean>> annotatedClasses)
public ObjectConverter getObjectConverter(HstRequestContext requestContext)
ObjectConverter
instance. Note that this instance is shared between multiple threads.@Deprecated public void setObjectConverter(ObjectConverter objectConverter)
public HstQueryManager getHstQueryManager(HstRequestContext requestContext)
HstRequestContext.getSession()
of the
provided requestContext
public HstQueryManager getHstQueryManager(javax.jcr.Session session, HstRequestContext requestContext)
session
@Deprecated public void setHstQueryManagerFactory(HstQueryManagerFactory hstQueryManagerFactory)
public String getRestRelationsBaseUri()
public void setRestRelationsBaseUri(String restRelationsBaseUri)
public boolean isPageLinksExternal()
public void setPageLinksExternal(boolean pageLinksExternal)
public ContentRewriter<String> getContentRewriter()
public void setContentRewriter(ContentRewriter<String> contentRewriter)
protected ObjectBeanPersistenceManager getPersistenceManager(HstRequestContext requestContext) throws javax.jcr.RepositoryException
Note: when the operation is annotated with Persistable
, the default session of the requestContext
should already be a persistable (writable) session.
requestContext
- javax.jcr.RepositoryException
protected ObjectBeanPersistenceManager getPersistenceManager(HstRequestContext requestContext, javax.jcr.Session persistableSession) throws javax.jcr.RepositoryException
requestContext
- persistableSession
- javax.jcr.RepositoryException
protected HstRequestContext getRequestContext(javax.servlet.http.HttpServletRequest servletRequest)
HstRequestContext
for the provided servletRequest
protected <T extends HippoBean> T getRequestContentBean(HstRequestContext requestContext, Class<T> beanMappingClass) throws ObjectBeanManagerException
beanMappingClass for the relative content path of the
resolved sitemap item a ObjectBeanManagerException is thrown
If there is no resolved sitemap item, null
is returned.
T
- requestContext
- beanMappingClass
- ObjectBeanManagerException
- when there cannot be returned a beanprotected HippoBean getRequestContentBean(HstRequestContext requestContext) throws ObjectBeanManagerException
requestContext
- ObjectBeanManagerException
- when there cannot be returned a beanpublic HippoFolderBean getMountContentBaseBean(HstRequestContext requestContext) throws ObjectBeanManagerException
requestContext
- ObjectBeanManagerException
- when there cannot be returned a site content base beanprotected String deleteHippoBean(javax.servlet.http.HttpServletRequest servletRequest, HippoBean hippoBean) throws javax.jcr.RepositoryException, ObjectBeanPersistenceException
HippoBean
servletRequest
- hippoBean
- the bean which mapped data should be deletedjavax.jcr.RepositoryException
ObjectBeanPersistenceException
protected HippoBean getChildBeanByRelPathOrPrimaryNodeType(HippoBean hippoBean, String relPath, String primaryNodeType)
HippoBean
for the provided HippoBean
. If relPath
is not
null
or empty, a lookup using relPath
is done. If relPath
is
null
or empty, a lookup using primaryNodeType
is done; if any child beans are
found, the first is returned.hippoBean
- relPath
- the path identifying the child bean, see also HippoBean.getBean(String)
primaryNodeType
- the primary node type used to search for child beans, see also
HippoBean.getChildBeans(String)
null
if not foundprotected String getQualifiedLinkRel(String iri, String simpleRel)
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/>
iri
- Internationalized Resource Identifier, e.g. "http://www.onehippo.org/cms7/hst/rest/relations"
simpleRel
- relationship, e.g. "mount:site"
iri
and simpleRel
protected String getQualifiedLinkRel(String simpleRel)
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/>
simpleRel
- relationship, e.g. "mount:site"getRestRelationsBaseUri()
(which defaults to
"http://www.onehippo.org/cms7/hst/rest/relations"
) and simpleRel
protected String getHstQualifiedLinkRel(String simpleRel)
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/>
simpleRel
- relationship, e.g. "mount:site"HST_REST_RELATIONS_BASE_URI
(which is defined as
"http://www.onehippo.org/cms7/hst/rest/relations"
) and simpleRel
protected String getLinkMountRelation(String mountName)
<link href="http://localhost:8080/site/" rel="http://www.onehippo.org/cms7/hst/rest/relations/mount:site" title="Home Page"/>
mountName
- mount name, e.g. "site"HST_MOUNT_REL_PREFIX
(which is defined as
"http://www.onehippo.org/cms7/hst/rest/relations/mount:"
) and mountName
protected Link getNodeLink(HstRequestContext requestContext, HippoBean hippoBean)
HippoBean
, exposed over the rest mount. If the bean is not exposed over
the mount, a page not found link is returned.requestContext
- hippoBean
- protected Link getRestLink(HstRequestContext requestContext, HippoBean hippoBean, String subPath)
HippoBean
, exposed over the rest mount. If the bean is not exposed over
the mount, a page not found link is returned.requestContext
- hippoBean
- subPath
- subPath appended to the link created for HippoBean
, can be null
protected Link getSiteLink(HstRequestContext requestContext, HippoBean hippoBean)
HippoBean
, exposed over the site mount. If the bean is not exposed over
the mount, a page not found link is returned.requestContext
- hippoBean
- protected Link getMountLink(HstRequestContext requestContext, HippoBean hippoBean, String mountAliasName, String subPath)
HippoBean
, exposed over the mount identified by the alias
mountAliasName
. If no mount is found with the provided mountAliasName
, a link is
created using the mount of the provided HstRequestContext
. If the bean is not exposed over the mount,
a page not found link is returned.requestContext
- hippoBean
- mountAliasName
- mount alias name, when null
the mount with the alias site
is
used to create the linksubPath
- subPath appended to the link created for HippoBean
, can be null
protected javax.jcr.Session getPersistableSession(HstRequestContext requestContext) throws javax.jcr.RepositoryException
Note: The client should invoke logout()
method on the session after use.
Internally, Session.impersonate(Credentials)
method will be used to create a
persistable JCR session. The method is invoked on the session from the session pooling repository.
requestContext
- javax.jcr.RepositoryException
protected javax.jcr.Session getPersistableSession(HstRequestContext requestContext, javax.jcr.Credentials credentials) throws javax.jcr.RepositoryException
Note: The client should invoke logout()
method on the session after use.
Internally, Session.impersonate(Credentials)
method will be used to create a
persistable JCR session. The method is invoked on the session from the session pooling repository.
requestContext
- javax.jcr.RepositoryException
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.