Package com.composum.sling.nodes.browser
Class Browser
- java.lang.Object
-
- com.composum.sling.core.AbstractSlingBean
-
- com.composum.sling.core.AbstractServletBean
-
- com.composum.sling.nodes.console.ConsoleServletBean
-
- com.composum.sling.nodes.browser.Browser
-
- All Implemented Interfaces:
com.composum.sling.core.bean.RestrictedBean,com.composum.sling.core.SlingBean
public class Browser extends ConsoleServletBean
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classBrowser.NodeHandlea JSP bean for a node (for the current node)static classBrowser.Reference
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_MIME_TYPEstatic Map<String,String>EDITOR_MODESstatic Map<String,String>FILE_ICONSstatic StringHTMLstatic StringJSPstatic StringOAK_RESOURCEstatic StringPDFstatic StringPROP_DATAstatic StringPROP_MIME_TYPEstatic PatternSETUP_SCRIPT_PATTERNstatic StringTYPE_FILEstatic StringTYPE_RESOURCEstatic StringTYPE_UNSTRUCTURED
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Collection<SceneConfigurations.Config>getAvailableScenes()StringgetBasePath()Browser.NodeHandlegetCurrent()Returns a JSP handle of the node displayed currently by the browser.StringgetCurrentPathUrl()Returns a URL to the current nodes View based on the nodes path (without mapping).StringgetCurrentUrl()Returns a URL to the current nodes View with mapping according to the configuration.StringgetEditCodeUrl()Returns a URL to the current nodes View with mapping according to the configuration.@NotNull StringgetFileIcon()static @NotNull StringgetFileIcon(@NotNull com.composum.sling.core.ResourceHandle resource)@NotNull StringgetFilePath()static @NotNull StringgetFilePath(@NotNull com.composum.sling.core.ResourceHandle resource)static @NotNull StringgetFileType(Map<String,String> typeMap, String mimeType, String extension)Determines the text type for the current node using the mimeType (if present) and the extension.StringgetImageCSS()StringgetMappedUrl()Returns a URL to the current nodes View with resolver mapping.StringgetMimeType()the content mime type declared for the current resourcestatic @NotNull StringgetMimeType(@NotNull org.apache.sling.api.resource.Resource resource)StringgetName()@NotNull StringgetNameExtension()@Nullable StringgetOverlayPath()Path of resource type within /mnt/overlay .StringgetOverlayRoot()@NotNull StringgetOverridePath()Path within /mnt/override.StringgetOverrideRoot()Browser.NodeHandlegetParent()List<Browser.NodeHandle>getParents()StringgetPrimaryType()@NotNull Map<String,Browser.Reference>getRelatedPathSet()Set of related paths: for resource types the resource type found in the search path and /mnt/(override|overlay), base paths, resource types.@NotNull StringgetResourceType()the content resource type (sling:resourceType) declared for the current resourcestatic @Nullable StringgetResourceType(@NotNull com.composum.sling.core.ResourceHandle resource)protected @Nullable StringgetResourceType(@Nullable String resourceType)Remove any search path / /mnt/overlay from given path to a resource type = "normalize" path to resource type.protected @NotNull Map<String,Browser.Reference>getResourceTypeSet()Paths for the locations relevant to the resource typein search paths, /mnt/override / /mnt/overlay, mapped to the label information.@NotNull List<String>getSupertypeChain()The chain of resource super types.StringgetTabType()@NotNull StringgetTextSnippet()@NotNull StringgetTextType()Determines the text type for the current node using the mimeType (if present) and the extension.static @NotNull StringgetTextType(@NotNull com.composum.sling.core.ResourceHandle resource)protected @Nullable org.apache.sling.api.resource.ResourcegetTypeResource(@Nullable String resourceType, boolean includeOverlay)Returns the resource for a resourceType (the "highest" in the search path), or the resource if the path is absolute.protected Map<String,Browser.Reference>getTypeRootLabels()protected @NotNull List<String>getTypeSearchPath(boolean includeOverlay)StringgetViewType()booleanisAsset()booleanisCaConfigRelevant()booleanisCanHaveAcl()booleanisDeclaringType()booleanisFile()static booleanisFile(@NotNull com.composum.sling.core.ResourceHandle resource)booleanisImage()booleanisJcrResource()booleanisMergedResource()booleanisOverlayAvailable()booleanisOverlayResource()booleanisOverrideAvailable()booleanisOverrideResource()booleanisRenderable()static booleanisRenderable(@NotNull com.composum.sling.core.ResourceHandle resource, @Nullable String extension)booleanisSceneAvailable()booleanisSetupScript()booleanisSourcePath()booleanisText()static booleanisText(@NotNull com.composum.sling.core.ResourceHandle resource)booleanisTyped()returns 'true' if the current resource has a well known resource typebooleanisVersionable()booleanisVideo()InputStreamopenFile()-
Methods inherited from class com.composum.sling.nodes.console.ConsoleServletBean
initialize
-
Methods inherited from class com.composum.sling.core.AbstractSlingBean
executeQuery, findBeans, findNodes, findNodes, findPathList, getContentResource, getDomId, getHasTitle, getId, getInherited, getInherited, getNode, getParent, getParent, getPath, getPermissible, getProperty, getProperty, getQueryManager, getRequest, getResolver, getResource, getResponse, getServiceKey, getSession, getSling, getStringId, getTitle, getType, getUrl, getUsername, isPermissible, isReadAllowed, isWriteAllowed, toString, toString
-
-
-
-
Field Detail
-
TYPE_FILE
public static final String TYPE_FILE
- See Also:
- Constant Field Values
-
TYPE_RESOURCE
public static final String TYPE_RESOURCE
- See Also:
- Constant Field Values
-
OAK_RESOURCE
public static final String OAK_RESOURCE
- See Also:
- Constant Field Values
-
TYPE_UNSTRUCTURED
public static final String TYPE_UNSTRUCTURED
- See Also:
- Constant Field Values
-
HTML
public static final String HTML
- See Also:
- Constant Field Values
-
JSP
public static final String JSP
- See Also:
- Constant Field Values
-
PDF
public static final String PDF
- See Also:
- Constant Field Values
-
PROP_DATA
public static final String PROP_DATA
- See Also:
- Constant Field Values
-
PROP_MIME_TYPE
public static final String PROP_MIME_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_MIME_TYPE
public static final String DEFAULT_MIME_TYPE
- See Also:
- Constant Field Values
-
SETUP_SCRIPT_PATTERN
public static final Pattern SETUP_SCRIPT_PATTERN
-
-
Method Detail
-
getPrimaryType
public String getPrimaryType()
-
isTyped
public boolean isTyped()
returns 'true' if the current resource has a well known resource type
-
isDeclaringType
public boolean isDeclaringType()
- Returns:
- 'true' if the current resource itself declares a resource type
-
isSourcePath
public boolean isSourcePath()
- Returns:
- 'true' if the current resource itself 'implements' a resource type
-
getResourceType
@NotNull public @NotNull String getResourceType()
the content resource type (sling:resourceType) declared for the current resource
-
getResourceType
@Nullable public static @Nullable String getResourceType(@NotNull @NotNull com.composum.sling.core.ResourceHandle resource)
-
getResourceType
@Nullable protected @Nullable String getResourceType(@Nullable @Nullable String resourceType)
Remove any search path / /mnt/overlay from given path to a resource type = "normalize" path to resource type.
-
getTypeResource
@Nullable protected @Nullable org.apache.sling.api.resource.Resource getTypeResource(@Nullable @Nullable String resourceType, boolean includeOverlay)Returns the resource for a resourceType (the "highest" in the search path), or the resource if the path is absolute.
-
getTypeSearchPath
@NotNull protected @NotNull List<String> getTypeSearchPath(boolean includeOverlay)
-
getSupertypeChain
@NotNull public @NotNull List<String> getSupertypeChain()
The chain of resource super types. This is also included for content resources since this is used quite often in AEM.- See Also:
- "https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/the-basics.html?lang=en#sling-request-processing"
-
getResourceTypeSet
@NotNull protected @NotNull Map<String,Browser.Reference> getResourceTypeSet()
Paths for the locations relevant to the resource typein search paths, /mnt/override / /mnt/overlay, mapped to the label information.
-
getRelatedPathSet
@NotNull public @NotNull Map<String,Browser.Reference> getRelatedPathSet()
Set of related paths: for resource types the resource type found in the search path and /mnt/(override|overlay), base paths, resource types.
-
getBasePath
public String getBasePath()
-
getOverlayRoot
public String getOverlayRoot()
-
isOverlayResource
public boolean isOverlayResource()
-
isOverlayAvailable
public boolean isOverlayAvailable()
-
getOverlayPath
@Nullable public @Nullable String getOverlayPath()
Path of resource type within /mnt/overlay . If not a declaring resource, this doesn't make sense -> null.
-
getOverrideRoot
public String getOverrideRoot()
-
isOverrideResource
public boolean isOverrideResource()
-
isOverrideAvailable
public boolean isOverrideAvailable()
-
getOverridePath
@NotNull public @NotNull String getOverridePath()
Path within /mnt/override.
-
getTypeRootLabels
protected Map<String,Browser.Reference> getTypeRootLabels()
-
isSceneAvailable
public boolean isSceneAvailable()
-
getAvailableScenes
@NotNull public @NotNull Collection<SceneConfigurations.Config> getAvailableScenes()
-
isRenderable
public boolean isRenderable()
-
isRenderable
public static boolean isRenderable(@NotNull @NotNull com.composum.sling.core.ResourceHandle resource, @Nullable @Nullable String extension)
-
isFile
public boolean isFile()
-
isFile
public static boolean isFile(@NotNull @NotNull com.composum.sling.core.ResourceHandle resource)
-
getFilePath
@NotNull public @NotNull String getFilePath()
-
getFilePath
@NotNull public static @NotNull String getFilePath(@NotNull @NotNull com.composum.sling.core.ResourceHandle resource)
-
getFileIcon
@NotNull public @NotNull String getFileIcon()
-
getFileIcon
@NotNull public static @NotNull String getFileIcon(@NotNull @NotNull com.composum.sling.core.ResourceHandle resource)
-
openFile
public InputStream openFile()
-
isAsset
public boolean isAsset()
-
isImage
public boolean isImage()
-
getImageCSS
public String getImageCSS()
-
isVideo
public boolean isVideo()
-
isText
public boolean isText()
-
isText
public static boolean isText(@NotNull @NotNull com.composum.sling.core.ResourceHandle resource)
-
isMergedResource
public boolean isMergedResource()
-
isJcrResource
public boolean isJcrResource()
-
isCanHaveAcl
public boolean isCanHaveAcl()
-
isVersionable
public boolean isVersionable()
-
isCaConfigRelevant
public boolean isCaConfigRelevant()
-
isSetupScript
public boolean isSetupScript()
-
getTextSnippet
@NotNull public @NotNull String getTextSnippet()
-
getNameExtension
@NotNull public @NotNull String getNameExtension()
-
getTextType
@NotNull public @NotNull String getTextType()
Determines the text type for the current node using the mimeType (if present) and the extension.
-
getTextType
@NotNull public static @NotNull String getTextType(@NotNull @NotNull com.composum.sling.core.ResourceHandle resource)
-
getFileType
@NotNull public static @NotNull String getFileType(Map<String,String> typeMap, String mimeType, String extension)
Determines the text type for the current node using the mimeType (if present) and the extension.- Returns:
- the type of the text file (script language) or ""
-
getViewType
public String getViewType()
-
getTabType
public String getTabType()
-
getName
public String getName()
- Specified by:
getNamein interfacecom.composum.sling.core.SlingBean- Overrides:
getNamein classcom.composum.sling.core.AbstractSlingBean
-
getCurrent
public Browser.NodeHandle getCurrent()
Returns a JSP handle of the node displayed currently by the browser.
-
getCurrentPathUrl
public String getCurrentPathUrl()
Returns a URL to the current nodes View based on the nodes path (without mapping).
-
getMappedUrl
public String getMappedUrl()
Returns a URL to the current nodes View with resolver mapping.
-
getCurrentUrl
public String getCurrentUrl()
Returns a URL to the current nodes View with mapping according to the configuration.
-
getEditCodeUrl
public String getEditCodeUrl()
Returns a URL to the current nodes View with mapping according to the configuration.
-
getMimeType
public String getMimeType()
the content mime type declared for the current resource
-
getMimeType
@NotNull public static @NotNull String getMimeType(@NotNull @NotNull org.apache.sling.api.resource.Resource resource)
-
getParent
public Browser.NodeHandle getParent()
-
getParents
public List<Browser.NodeHandle> getParents()
-
-