public abstract class AbstractClientUtility extends Object implements ClientUtilities
JSON_EXTENSION, QUERY_SELECTOR, SOCO_SELECTOR
Constructor and Description |
---|
AbstractClientUtility(XSSAPI xss,
ResourceResolver resolver,
SocialUtils socialUtils,
SlingSettingsService slingSettingsService) |
AbstractClientUtility(XSSAPI xss,
SlingHttpServletRequest request,
SocialUtils socialUtils,
SlingSettingsService slingSettingsService) |
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.
|
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.
|
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.
|
User |
getUser(String userId,
ResourceResolver resolver)
Get the for the specified user ID.
|
static void |
setOutputIndenting(ObjectMapper objectMapper,
boolean indent)
Set indenting format to the specified JSon
ObjectMapper . |
boolean |
userIsAnonymous()
Helper method to check whether the user is anonymous (not logged in) or not.
|
public AbstractClientUtility(XSSAPI xss, SlingHttpServletRequest request, SocialUtils socialUtils, SlingSettingsService slingSettingsService)
xss
- Instance of XSSAPI
which will be used to perform xss filtering.request
- The current SlingHttpServletRequest
.socialUtils
- Instance of (@Link SocialUtils).slingSettingsService
- Instance of (@Link SlingSettingsService) which is used to determine the current
run modes.public AbstractClientUtility(XSSAPI xss, ResourceResolver resolver, SocialUtils socialUtils, SlingSettingsService slingSettingsService)
xss
- instance of XSSAPI
which will be used to perform xss filtering.resolver
- instance of ResourceResolver
.socialUtils
- instance of (@Link SocialUtils).slingSettingsService
- instance of (@Link SlingSettingsService) which is used to determine the current
run modes.public static void setOutputIndenting(ObjectMapper objectMapper, boolean indent)
ObjectMapper
.objectMapper
- the mapper on which indentation will be enabled or disabled.indent
- true to enable indentation, false otherwise.public String externalLink(String path)
externalLink
in interface ClientUtilities
path
- path to the resourcepublic String externalLink(String path, Boolean needExtension)
externalLink
in interface ClientUtilities
path
- path to resourceneedExtension
- boolean to indicate whether the .social.json extension needs to be appended to the URLpublic String getRequestExtension()
ClientUtilities
getRequestExtension
in interface ClientUtilities
public String filterHTML(String valueToBeFiltered)
filterHTML
in interface ClientUtilities
valueToBeFiltered
- The String to be filtered.public SocialComponentFactoryManager getSocialComponentFactoryManager()
SocialComponentFactoryManager
service.getSocialComponentFactoryManager
in interface ClientUtilities
public SocialUtils getSocialUtils()
SocialUtils
service.getSocialUtils
in interface ClientUtilities
public String getAuthorizedUserId()
getAuthorizedUserId
in interface ClientUtilities
public boolean userIsAnonymous()
userIsAnonymous
in interface ClientUtilities
public SlingHttpServletRequest getRequest()
ClientUtilities
getRequest
in interface ClientUtilities
SlingHttpServletRequest
requestpublic String getSocialProfilePath()
ClientUtilities
getSocialProfilePath
in interface ClientUtilities
public Page getContainingPage(String path)
ClientUtilities
getContainingPage
in interface ClientUtilities
path
- the path to the resource for which the containing page is to be foundpublic Page getPage(String pathToPage)
ClientUtilities
getPage
in interface ClientUtilities
pathToPage
- path to a pagePage
object from the page path, or null.public User getUser(String userId, ResourceResolver resolver)
ClientUtilities
getUser
in interface ClientUtilities
userId
- The user ID of the user.User
representing the user id.public Configuration getStorageCloudConfig(Resource resource)
ClientUtilities
getStorageCloudConfig
in interface ClientUtilities
resource
- The resource to get the active storage cloud service for.public MachineTranslationCloudConfig getMTCloudConfig(Resource resource)
ClientUtilities
getMTCloudConfig
in interface ClientUtilities
resource
- The resource to get the Machine Translation config for."Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"