Package org.ametys.web
Class URIPrefixHandler
java.lang.Object
org.ametys.web.URIPrefixHandler
- All Implemented Interfaces:
Component
,Contextualizable
,Serviceable
Component providing base paths for computing URIs.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeUriPrefix
(String siteName, boolean absolute, boolean internal) Computes an URI prefix.void
contextualize
(Context context) Get the absolutized version of the root uri.
Use it to create an absolute link beginning with the application root, for instance when sending a mail linking to the application.getAbsoluteUriPrefix
(String siteName) Get an absolutized version of the workspace context path.Get the application root.getUriPrefix
(String siteName) Get the full path to the workspace with site name.void
service
(ServiceManager manager)
-
Field Details
-
ROLE
Avalon role
-
-
Constructor Details
-
URIPrefixHandler
public URIPrefixHandler()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
computeUriPrefix
Computes an URI prefix. Uses by variousURIResolver
.- Parameters:
siteName
- the current site name. May be null or empty.absolute
- if the resulting prefix should be absolute.internal
- if the resulting prefix should be internal.- Returns:
- the computes prefix.
-
getUriPrefix
Get the application root. Can be empty if the application resides in the root context.
Use it to create a link beginning with the application root.- Returns:
- The application root uri.
-
getUriPrefix
Get the full path to the workspace with site name. If the current workspace is the default one, the workspace path part will be empty. Use it when creating site-dependent links, such as page URIs.- Parameters:
siteName
- the current site name.- Returns:
- The workspace context path with site name.
-
getAbsoluteUriPrefix
Get the absolutized version of the root uri.
Use it to create an absolute link beginning with the application root, for instance when sending a mail linking to the application.- Returns:
- The absolute root uri.
-
getAbsoluteUriPrefix
Get an absolutized version of the workspace context path. Use it when linking to a page or an URI from outside the server, for instance when sending a link to a specific page in an e-mail.- Parameters:
siteName
- The name of the current site.- Returns:
- The absolute workspace context path.
-