public interface ClientUtilities
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
GROUP_ROOTPATH |
static java.lang.String |
JSON_EXTENSION
JSON extension.
|
static java.lang.String |
QUERY_SELECTOR
The query selector.
|
static java.lang.String |
SOCO_SELECTOR
GET Selector.
|
static java.lang.String |
USER_ROOTPATH |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
externalLink(java.lang.String path)
Computes the externalized URL to the resource at the given path.
|
java.lang.String |
externalLink(java.lang.String path,
java.lang.Boolean needExtension)
Computes the externalized URL to the resource at the given path.
|
java.lang.String |
filterHTML(java.lang.String valueToBeFiltered)
Calls
XSSAPI filterHTML on the provided String. |
FileDataSource |
getAttachmentFromDataSource(FileDataSource attachmentDataSource,
FileUploadSizeLimit fileUploadSizeLimit,
java.util.Set<java.lang.String> whitelist,
java.util.List<java.lang.String> blacklist)
Utility to check a file against the specified white list, black list, and size restraints.
|
java.lang.Iterable<FileDataSource> |
getAttachmentsFromDataSources(java.lang.Iterable<FileDataSource> attachmentList,
FileUploadSizeLimit fileUploadSizeLimit,
java.util.Set<java.lang.String> whitelist,
java.util.List<java.lang.String> blacklist)
Utility to check attached files against the specified white list and black list.
|
java.util.List<FileDataSource> |
getAttachmentsFromRequest(long attachmentSizeLimit,
java.util.List<java.lang.String> whiteList,
java.util.List<java.lang.String> blackList)
Utility to filter the attachments in the current request against the specified white list, black list, and
size.
|
java.util.List<FileDataSource> |
getAttachmentsFromRequest(RequestParameter[] fileRequestParameters,
FileUploadSizeLimit fileUploadSizeLimit,
java.util.List<java.lang.String> whitelist,
java.util.List<java.lang.String> blackList)
Utility to check attached files against the specified white list and black list.
|
java.util.List<FileDataSource> |
getAttachmentsFromRequest(RequestParameter[] fileRequestParameters,
long attachmentSizeLimit,
java.util.List<java.lang.String> whitelist,
java.util.List<java.lang.String> blacklist)
Utility to check attached files against the specified white list and black list.
|
java.lang.String |
getAuthorizedUserId()
Gets the authorized user ID.
|
UserProperties |
getAuthorizedUserProfileProperties()
Get the
UserProperties for the authenticated user. |
java.lang.String |
getCommonStorePath(Resource resource)
This method maps the given
resource to its equivalent resource path based on applicable global
shared storage cloud config settings. |
Page |
getContainingPage(java.lang.String path)
Returns the page that contains the resource at the given path if path is absolute.
|
ValueMap |
getDesignProperties(Resource componentResource,
java.lang.String restrictToType)
This Will attempt to get the design based on the component resource.
|
SocialGroup |
getGroup(java.lang.String id,
ResourceResolver resolver,
java.lang.String resourceType)
Get the
SocialGroup for the specified user id with the specified resource type. |
Resource |
getIncludedResource()
Gets the included component when Sling performed the include on the server.
|
MachineTranslationCloudConfig |
getMTCloudConfig(Resource resource)
Gets an Machine Translation config for the requested resource.
|
Page |
getPage(java.lang.String pathToPage)
Returns the
Page from the specified path. |
SlingHttpServletRequest |
getRequest()
Get the original request.
|
java.lang.String |
getRequestExtension()
Get the current extension of the request.
|
SocialComponentFactoryManager |
getSocialComponentFactoryManager()
Get the
SocialComponentFactoryManager service. |
java.lang.String |
getSocialProfilePath()
Helper method to get the configured social profile path for the page on which the resource is contained.
|
SocialUtils |
getSocialUtils()
Gets the
SocialUtils service. |
Configuration |
getStorageCloudConfig(Resource resource)
Gets an active storage cloud service configuration based on the requested resource.
|
SocialResourceConfiguration |
getStorageConfig(Resource resource)
Gets an active storage configuration based on the requested resource.
|
User |
getUser(java.lang.String userId,
ResourceResolver resolver)
Get the
User for the specified user ID. |
User |
getUser(java.lang.String userId,
ResourceResolver resolver,
java.lang.String resourceType)
Get the
User for the specified user id with the specified resource type. |
java.lang.String |
getUserId(java.lang.String userId)
Get CQ userId from the id retrieved from the
getUser(java.lang.String, org.apache.sling.api.resource.ResourceResolver) request |
UserProperties |
getUserProperties(java.lang.String authorizableId,
java.lang.String relPath)
Get the
UserProperties for the specified user |
boolean |
isAnalyticsServiceConfigured(Resource resource)
Checks if Analytics Service is configured for the requested resource.
|
boolean |
isTranslationServiceConfigured(Resource resource)
Checks if Translation Service is configured for the requested resource.
|
boolean |
userIsAnonymous()
Helper method to check whether the user is anonymous (not logged in) or not.
|
static final java.lang.String JSON_EXTENSION
static final java.lang.String SOCO_SELECTOR
static final java.lang.String QUERY_SELECTOR
static final java.lang.String USER_ROOTPATH
static final java.lang.String GROUP_ROOTPATH
java.lang.String externalLink(java.lang.String path)
path
- path to the resourcejava.lang.String externalLink(java.lang.String path, java.lang.Boolean needExtension)
path
- path to resourceneedExtension
- boolean to indicate whether the .social.json extension needs to be appended to the URLjava.lang.String getRequestExtension()
java.lang.String filterHTML(java.lang.String valueToBeFiltered)
XSSAPI
filterHTML on the provided String. If no reference to XSSAPI is available the
String is returned as is.valueToBeFiltered
- The String to be filtered.SocialComponentFactoryManager getSocialComponentFactoryManager()
SocialComponentFactoryManager
service.SocialUtils getSocialUtils()
SocialUtils
service.java.lang.String getAuthorizedUserId()
boolean userIsAnonymous()
SlingHttpServletRequest getRequest()
SlingHttpServletRequest
requestjava.lang.String getSocialProfilePath()
Page getContainingPage(java.lang.String path)
path
- the path to the resource for which the containing page is to be foundPage getPage(java.lang.String pathToPage)
Page
from the specified path.pathToPage
- path to a pagePage
object from the page path, or null.User getUser(java.lang.String userId, ResourceResolver resolver)
User
for the specified user ID.userId
- The user ID of the user.resolver
- The resolver to use.User
representing the user id.User getUser(java.lang.String userId, ResourceResolver resolver, java.lang.String resourceType)
User
for the specified user id with the specified resource type.userId
- The user idresolver
- The resolver to useresourceType
- the resource typejava.lang.String getUserId(java.lang.String userId)
getUser(java.lang.String, org.apache.sling.api.resource.ResourceResolver)
requestuserId
- StringConfiguration getStorageCloudConfig(Resource resource)
resource
- The resource to get the active storage cloud service for.com.day.cq.wcm.webservicesupport.Configuration
for the specified resource, or null if none exists.SocialResourceConfiguration getStorageConfig(Resource resource)
resource
- The resource to get the active storage configuration for.MachineTranslationCloudConfig getMTCloudConfig(Resource resource)
resource
- The resource to get the Machine Translation config for.MachineTranslationCloudConfig
for the requested resource, or null if none exists.boolean isTranslationServiceConfigured(Resource resource)
resource
- The resource to get the Machine Translation config for.boolean isAnalyticsServiceConfigured(Resource resource)
resource
- The resource to get the Analytics config for.java.util.List<FileDataSource> getAttachmentsFromRequest(long attachmentSizeLimit, java.util.List<java.lang.String> whiteList, java.util.List<java.lang.String> blackList)
attachmentSizeLimit
- Size limit for attachments.whiteList
- List
of allowed file types.blackList
- File types that are not allowed.List
of filtered attachments.java.util.List<FileDataSource> getAttachmentsFromRequest(RequestParameter[] fileRequestParameters, long attachmentSizeLimit, java.util.List<java.lang.String> whitelist, java.util.List<java.lang.String> blacklist)
fileRequestParameters
- Request parameters of the type file.attachmentSizeLimit
- Size limit for attachments.whitelist
- List
of allowed file types.blacklist
- File types that are not allowed.List
of filtered attachments.java.util.List<FileDataSource> getAttachmentsFromRequest(RequestParameter[] fileRequestParameters, FileUploadSizeLimit fileUploadSizeLimit, java.util.List<java.lang.String> whitelist, java.util.List<java.lang.String> blackList)
fileRequestParameters
- Request parameters of the type file.fileUploadSizeLimit
- FileUploadSizeLimit
of the file.whitelist
- List of allowed file types.blackList
- File types that are not allowed.List
of filtered attachments.java.lang.Iterable<FileDataSource> getAttachmentsFromDataSources(java.lang.Iterable<FileDataSource> attachmentList, FileUploadSizeLimit fileUploadSizeLimit, java.util.Set<java.lang.String> whitelist, java.util.List<java.lang.String> blacklist)
attachmentList
- Unfiltered list of attachments.fileUploadSizeLimit
- FileUploadSizeLimit
of the file.whitelist
- List
of allowed file types.blacklist
- File types that are not allowed.FileDataSource
FileDataSource getAttachmentFromDataSource(FileDataSource attachmentDataSource, FileUploadSizeLimit fileUploadSizeLimit, java.util.Set<java.lang.String> whitelist, java.util.List<java.lang.String> blacklist)
attachmentDataSource
- FileDataSource
of the attachment.fileUploadSizeLimit
- FileUploadSizeLimit
of the file.whitelist
- Set
of allowed file types.blacklist
- File types that are not allowed.FileDataSource
for the file. Or null if the file is not allowed.ValueMap getDesignProperties(Resource componentResource, java.lang.String restrictToType)
componentResource
- what component resource to try and get the design properties fromrestrictToType
- only allow this method to return if the requested type hint isA certain typeResource getIncludedResource()
SocialGroup getGroup(java.lang.String id, ResourceResolver resolver, java.lang.String resourceType)
SocialGroup
for the specified user id with the specified resource type.id
- Stringresolver
- ResourceResolverresourceType
- StringUserProperties getAuthorizedUserProfileProperties() throws RepositoryException
UserProperties
for the authenticated user.RepositoryException
- if a repository problem is encountered.UserProperties getUserProperties(java.lang.String authorizableId, java.lang.String relPath) throws RepositoryException
UserProperties
for the specified userauthorizableId
- the user whose properties to get.relPath
- the relative path within the user to find the properties, usually 'profile' or 'preferences'.RepositoryException
- if a repository problem is encountered.java.lang.String getCommonStorePath(Resource resource)
resource
to its equivalent resource path based on applicable global
shared storage cloud config settings. This supports language specific pages hosting Communities components
which all store their content in a language neutral location in the SRP.resource
- The resource to transpose."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"