Class CatalogVersionInterceptor
- java.lang.Object
-
- org.springframework.web.servlet.handler.HandlerInterceptorAdapter
-
- de.hybris.platform.cmswebservices.interceptor.CatalogVersionInterceptor
-
- All Implemented Interfaces:
org.springframework.web.servlet.AsyncHandlerInterceptor
,org.springframework.web.servlet.HandlerInterceptor
public class CatalogVersionInterceptor extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
Default interceptor to run before controllers' execution to extract the catalog-id and version-id from the request URI and to set the current session values. Also determines if the current user has the required permission to access the catalog version.
-
-
Constructor Summary
Constructors Constructor Description CatalogVersionInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CatalogService
getCatalogService()
protected CatalogVersionPermissionService
getCatalogVersionPermissionService()
protected CatalogVersionService
getCatalogVersionService()
protected CMSAdminSiteService
getCmsAdminSiteService()
protected CMSCatalogVersionService
getCmsCatalogVersionService()
protected RequestMethodResolver
getRequestMethodResolver()
boolean
preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler)
Adds the catalog and version to the session.void
setCatalogService(CatalogService catalogService)
void
setCatalogVersionPermissionService(CatalogVersionPermissionService catalogVersionPermissionService)
void
setCatalogVersionService(CatalogVersionService catalogVersionService)
void
setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)
void
setCmsCatalogVersionService(CMSCatalogVersionService cmsCatalogVersionService)
void
setRequestMethodResolver(RequestMethodResolver requestMethodResolver)
protected void
setSessionParentCatalogVersionsForSite(java.lang.String siteId, java.lang.String catalog, java.lang.String catalogVersion)
Add the active catalog versions for all parent catalog defined for a given site.
-
-
-
Method Detail
-
preHandle
public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler) throws java.lang.Exception
Adds the catalog and version to the session. Also determines if the current user has read or write permission to the catalog version for an operation given by the request's HTTP method. In the case that the user does not have permission, we return an error in the HTTP response using the status code 403 - Forbidden.- Specified by:
preHandle
in interfaceorg.springframework.web.servlet.HandlerInterceptor
- Overrides:
preHandle
in classorg.springframework.web.servlet.handler.HandlerInterceptorAdapter
- Throws:
java.lang.Exception
-UnknownIdentifierException
if no CatalogVersion with the specified catalog id and version existsAmbiguousIdentifierException
if more than one CatalogVersion is found with the specified catalog id and version
-
setSessionParentCatalogVersionsForSite
protected void setSessionParentCatalogVersionsForSite(java.lang.String siteId, java.lang.String catalog, java.lang.String catalogVersion)
Add the active catalog versions for all parent catalog defined for a given site. This is used in a multi-country setup.- Parameters:
siteId
- the site identifiercatalog
- the catalog identifiercatalogVersion
- the catalog version
-
getCmsAdminSiteService
protected CMSAdminSiteService getCmsAdminSiteService()
-
setCmsAdminSiteService
public void setCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService)
-
getCatalogService
protected CatalogService getCatalogService()
-
setCatalogService
public void setCatalogService(CatalogService catalogService)
-
getCatalogVersionService
protected CatalogVersionService getCatalogVersionService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getCmsCatalogVersionService
protected CMSCatalogVersionService getCmsCatalogVersionService()
-
setCmsCatalogVersionService
public void setCmsCatalogVersionService(CMSCatalogVersionService cmsCatalogVersionService)
-
getCatalogVersionPermissionService
protected CatalogVersionPermissionService getCatalogVersionPermissionService()
-
setCatalogVersionPermissionService
public void setCatalogVersionPermissionService(CatalogVersionPermissionService catalogVersionPermissionService)
-
getRequestMethodResolver
protected RequestMethodResolver getRequestMethodResolver()
-
setRequestMethodResolver
public void setRequestMethodResolver(RequestMethodResolver requestMethodResolver)
-
-