public interface ClientUtilities
Modifier and Type | Field and Description |
---|---|
static String |
JSON_EXTENSION
JSON extension.
|
static String |
QUERY_SELECTOR
The query selector.
|
static String |
SOCO_SELECTOR
GET Selector.
|
static String |
USER_ROOTPATH |
Modifier and Type | Method and Description |
---|---|
String |
externalLink(String path)
Computes the externalized URL to the resource at the given path.
|
String |
externalLink(String path,
Boolean needExtension)
Computes the externalized URL to the resource at the given path.
|
String |
filterHTML(String valueToBeFiltered)
Calls filterHTML on the provided String.
|
FileDataSource |
getAttachmentFromDataSource(FileDataSource attachmentDataSource,
FileUploadSizeLimit fileUploadSizeLimit,
Set<String> whitelist,
List<String> blacklist)
Utility to check a file against the specified white list, black list, and size restraints.
|
Iterable<FileDataSource> |
getAttachmentsFromDataSources(Iterable<FileDataSource> attachmentList,
FileUploadSizeLimit fileUploadSizeLimit,
Set<String> whitelist,
List<String> blacklist)
Utility to check attached files against the specified white list and black list.
|
List<FileDataSource> |
getAttachmentsFromRequest(long attachmentSizeLimit,
List<String> whiteList,
List<String> blackList)
Utility to filter the attachments in the current request against the specified white list, black list, and
size.
|
List<FileDataSource> |
getAttachmentsFromRequest(RequestParameter[] fileRequestParameters,
FileUploadSizeLimit fileUploadSizeLimit,
List<String> whitelist,
List<String> blackList)
Utility to check attached files against the specified white list and black list.
|
List<FileDataSource> |
getAttachmentsFromRequest(RequestParameter[] fileRequestParameters,
long attachmentSizeLimit,
List<String> whitelist,
List<String> blacklist)
Utility to check attached files against the specified white list and black list.
|
String |
getAuthorizedUserId()
Gets the authorized user ID.
|
Page |
getContainingPage(String path)
Returns the page that contains the resource at the given path if path is absolute.
|
ValueMap |
getDesignProperties(Resource componentResource,
String restrictToType)
This Will attempt to get the design based on the component resource.
|
SocialGroup |
getGroup(String id,
ResourceResolver resolver,
String resourceType)
Get the
Group 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(String pathToPage)
Returns the from the specified path.
|
SlingHttpServletRequest |
getRequest()
Get the original request.
|
String |
getRequestExtension()
Get the current extension of the request.
|
SocialComponentFactoryManager |
getSocialComponentFactoryManager()
Get the
SocialComponentFactoryManager service. |
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(String userId,
ResourceResolver resolver)
Get the for the specified user ID.
|
User |
getUser(String userId,
ResourceResolver resolver,
String resourceType)
Get the
User for the specified user id with the specified resource type. |
String |
getUserId(String userId)
Get CQ userId from the id retrieved from the
getUser request |
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 String JSON_EXTENSION
static final String SOCO_SELECTOR
static final String QUERY_SELECTOR
static final String USER_ROOTPATH
String externalLink(String path)
path
- path to the resourceString externalLink(String path, Boolean needExtension)
path
- path to resourceneedExtension
- boolean to indicate whether the .social.json extension needs to be appended to the URLString getRequestExtension()
String filterHTML(String valueToBeFiltered)
valueToBeFiltered
- The String to be filtered.SocialComponentFactoryManager getSocialComponentFactoryManager()
SocialComponentFactoryManager
service.SocialUtils getSocialUtils()
SocialUtils
service.String getAuthorizedUserId()
boolean userIsAnonymous()
SlingHttpServletRequest getRequest()
SlingHttpServletRequest
requestString getSocialProfilePath()
Page getContainingPage(String path)
path
- the path to the resource for which the containing page is to be foundPage getPage(String pathToPage)
pathToPage
- path to a pagePage
object from the page path, or null.User getUser(String userId, ResourceResolver resolver)
userId
- The user ID of the user.resolver
- The resolver to use.User
representing the user id.User getUser(String userId, ResourceResolver resolver, String resourceType)
User
for the specified user id with the specified resource type.userId
- The user idresolver
- The resolver to useresourceType
- the resource typeString getUserId(String userId)
getUser
requestConfiguration getStorageCloudConfig(Resource resource)
resource
- The resource to get the active storage cloud service for.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.boolean isTranslationServiceConfigured(Resource resource)
resource
- The resource to get the Machine Translation config for.List<FileDataSource> getAttachmentsFromRequest(long attachmentSizeLimit, List<String> whiteList, List<String> blackList)
List<FileDataSource> getAttachmentsFromRequest(RequestParameter[] fileRequestParameters, long attachmentSizeLimit, List<String> whitelist, List<String> blacklist)
List<FileDataSource> getAttachmentsFromRequest(RequestParameter[] fileRequestParameters, FileUploadSizeLimit fileUploadSizeLimit, List<String> whitelist, List<String> blackList)
fileRequestParameters
- Request parameters of the type file.fileUploadSizeLimit
- com.adobe.cq.social.scf.core.FileUploadSizeLimit
of the file.whitelist
- List of allowed file types.blackList
- File types that are not allowed.List
of filtered attachments.Iterable<FileDataSource> getAttachmentsFromDataSources(Iterable<FileDataSource> attachmentList, FileUploadSizeLimit fileUploadSizeLimit, Set<String> whitelist, List<String> blacklist)
attachmentList
- Unfiltered list of attachments.fileUploadSizeLimit
- com.adobe.cq.social.scf.core.FileUploadSizeLimit
of the file.whitelist
- List
of allowed file types.blacklist
- File types that are not allowed.com.adobe.cq.social.scf.core.FileDataSource
FileDataSource getAttachmentFromDataSource(FileDataSource attachmentDataSource, FileUploadSizeLimit fileUploadSizeLimit, Set<String> whitelist, List<String> blacklist)
attachmentDataSource
- com.adobe.cq.social.scf.core.FileDataSource
of the attachment.fileUploadSizeLimit
- com.adobe.cq.social.scf.core.FileUploadSizeLimit
of the file.whitelist
- Set
of allowed file types.blacklist
- File types that are not allowed.com.adobe.cq.social.scf.core.FileDataSource
for the file. Or null if the file is not allowed.ValueMap getDesignProperties(Resource componentResource, 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(String id, ResourceResolver resolver, String resourceType)
Group
for the specified user id with the specified resource type.id
- resolver
- resourceType
- "Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"