Package org.opencms.ade.galleries
Class CmsPreviewService
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
-
- com.google.gwt.user.server.rpc.RemoteServiceServlet
-
- org.opencms.gwt.CmsGwtService
-
- org.opencms.ade.galleries.CmsPreviewService
-
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService
,com.google.gwt.user.server.rpc.SerializationPolicyProvider
,java.io.Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
,I_CmsPreviewService
public class CmsPreviewService extends CmsGwtService implements I_CmsPreviewService
Handles all RPC services related to the gallery preview dialog.- Since:
- 8.0.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
PATTERN_FOCAL_POINT
Regex used to parse the image.focalpoint property.
-
Constructor Summary
Constructors Constructor Description CmsPreviewService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CmsImageInfoBean
getImageInfo(java.lang.String resourcePath, java.lang.String locale)
Returns the image resource data to be displayed in the preview dialog.static java.lang.String
getPreviewContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, CmsObject cms, CmsResource resource, java.util.Locale locale)
Renders the preview content for the given resource and locale.CmsResourceInfoBean
getResourceInfo(java.lang.String resourcePath, java.lang.String locale)
Returns the data to be displayed in the preview dialog.static CmsPoint
readFocalPoint(CmsObject cms, CmsResource resource)
Reads the focal point from a resource.void
readResourceInfo(CmsObject cms, CmsResource resource, CmsResourceInfoBean resInfo, java.lang.String locale)
Retrieves the resource information and puts it into the provided resource info bean.CmsImageInfoBean
updateImageProperties(java.lang.String resourcePath, java.lang.String locale, java.util.Map<java.lang.String,java.lang.String> properties)
Saves the given properties to the resource and returns the data to be displayed in the preview dialog.CmsResourceInfoBean
updateResourceProperties(java.lang.String resourcePath, java.lang.String locale, java.util.Map<java.lang.String,java.lang.String> properties)
Saves the given properties to the resource and returns the data to be displayed in the preview dialog.-
Methods inherited from class org.opencms.gwt.CmsGwtService
checkPermissions, clearThreadStorage, doGetSerializationPolicy, doUnexpectedFailure, ensureLock, ensureLock, ensureLock, ensureLock, ensureSession, error, getCmsObject, getPropertiesByName, getRequest, getResponse, isBroadcastCall, log, log, logError, service, setBroadcastPoll, setCms, setContext, setRequest, setResponse, tryUnlock
-
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
checkPermutationStrongName, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processCall, processPost, shouldCompressResponse
-
Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
PATTERN_FOCAL_POINT
public static final java.util.regex.Pattern PATTERN_FOCAL_POINT
Regex used to parse the image.focalpoint property.
-
-
Constructor Detail
-
CmsPreviewService
public CmsPreviewService()
-
-
Method Detail
-
getPreviewContent
public static java.lang.String getPreviewContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, CmsObject cms, CmsResource resource, java.util.Locale locale)
Renders the preview content for the given resource and locale.- Parameters:
request
- the current servlet requestresponse
- the current servlet responsecms
- the cms contextresource
- the resourcelocale
- the content locale- Returns:
- the rendered HTML preview content
-
readFocalPoint
public static CmsPoint readFocalPoint(CmsObject cms, CmsResource resource) throws CmsException
Reads the focal point from a resource.- Parameters:
cms
- the CMS context to useresource
- the resource- Returns:
- the focal point (or null, if the focal point property is not set or contains an invalid value)
- Throws:
CmsException
- if something goes wrong
-
getImageInfo
public CmsImageInfoBean getImageInfo(java.lang.String resourcePath, java.lang.String locale) throws CmsRpcException
Description copied from interface:I_CmsPreviewService
Returns the image resource data to be displayed in the preview dialog.- Specified by:
getImageInfo
in interfaceI_CmsPreviewService
- Parameters:
resourcePath
- the resource pathlocale
- the content locale- Returns:
- the image resource data
- Throws:
CmsRpcException
- if something goes wrong- See Also:
I_CmsPreviewService.getImageInfo(java.lang.String, java.lang.String)
-
getResourceInfo
public CmsResourceInfoBean getResourceInfo(java.lang.String resourcePath, java.lang.String locale) throws CmsRpcException
Description copied from interface:I_CmsPreviewService
Returns the data to be displayed in the preview dialog.- Specified by:
getResourceInfo
in interfaceI_CmsPreviewService
- Parameters:
resourcePath
- the path to the selected resourcelocale
- the content locale- Returns:
- the preview data
- Throws:
CmsRpcException
- if something goes wrong- See Also:
I_CmsPreviewService.getResourceInfo(java.lang.String, java.lang.String)
-
readResourceInfo
public void readResourceInfo(CmsObject cms, CmsResource resource, CmsResourceInfoBean resInfo, java.lang.String locale) throws CmsException
Retrieves the resource information and puts it into the provided resource info bean.- Parameters:
cms
- the initialized cms objectresource
- the resourceresInfo
- the resource info beanlocale
- the content locale- Throws:
CmsException
- if something goes wrong
-
updateImageProperties
public CmsImageInfoBean updateImageProperties(java.lang.String resourcePath, java.lang.String locale, java.util.Map<java.lang.String,java.lang.String> properties) throws CmsRpcException
Description copied from interface:I_CmsPreviewService
Saves the given properties to the resource and returns the data to be displayed in the preview dialog.- Specified by:
updateImageProperties
in interfaceI_CmsPreviewService
- Parameters:
resourcePath
- the path to the selected resourcelocale
- the content localeproperties
- a map with the key/value pairs of the properties to be updated- Returns:
- the updates preview data
- Throws:
CmsRpcException
- if something goes wrong- See Also:
I_CmsPreviewService.updateImageProperties(java.lang.String, java.lang.String, java.util.Map)
-
updateResourceProperties
public CmsResourceInfoBean updateResourceProperties(java.lang.String resourcePath, java.lang.String locale, java.util.Map<java.lang.String,java.lang.String> properties) throws CmsRpcException
Description copied from interface:I_CmsPreviewService
Saves the given properties to the resource and returns the data to be displayed in the preview dialog.- Specified by:
updateResourceProperties
in interfaceI_CmsPreviewService
- Parameters:
resourcePath
- the path to the selected resourcelocale
- the content localeproperties
- a map with the key/value pairs of the properties to be updated- Returns:
- the updates preview data
- Throws:
CmsRpcException
- if something goes wrong- See Also:
I_CmsPreviewService.updateResourceProperties(java.lang.String, java.lang.String, java.util.Map)
-
-