Class ViewerPathBuilder
java.lang.Object
io.goobi.viewer.model.urlresolution.ViewerPathBuilder
This class offers static methods to create
ViewerPaths
from a http request.- Author:
- Florian Alpers
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<ViewerPath>
createPath
(String applicationUrl, String applicationName, String serviceUrl, String queryString) Create a combined path from the given url.static Optional<ViewerPath>
createPath
(javax.servlet.http.HttpServletRequest httpRequest) Returns the request path of the givenhttpRequest
as aViewerPath
, including information on associated CMSPage and targeted PageType If the url has a pretty-url context and only consists of the server url, "/index" is appended to the url to redirect to the index pretty-mapping Any occurrences of "index.static Optional<ViewerPath>
createPath
(javax.servlet.http.HttpServletRequest request, String baseUrl) createPath.getCampaign
(URI servicePath) getCampaign.getCmsPage
(URI servicePath) Gets the best matching CMSPage which alternative url ('persistent url') matches the beginning of the given pathgetPageType
(URI servicePath) Gets thePageType
that the given path refers to, if anystatic URI
static URI
resolve.static URI
resolve.static boolean
startsWith
(URI uri, String string) Returns true if the first parts of the uri (separated by '/') are equal to all parts of the given string (separated by '/').
-
Method Details
-
createPath
public static Optional<ViewerPath> createPath(javax.servlet.http.HttpServletRequest httpRequest) throws DAOException Returns the request path of the givenhttpRequest
as aViewerPath
, including information on associated CMSPage and targeted PageType If the url has a pretty-url context and only consists of the server url, "/index" is appended to the url to redirect to the index pretty-mapping Any occurrences of "index.(x)html" are removed from the url to get the actual pretty url- Parameters:
httpRequest
- The request from which the path is generated- Returns:
- a
Optional
object. - Throws:
DAOException
- if any.
-
createPath
public static Optional<ViewerPath> createPath(javax.servlet.http.HttpServletRequest request, String baseUrl) throws DAOException createPath.
- Parameters:
request
- aHttpServletRequest
object.baseUrl
- aString
object.- Returns:
- a
Optional
object. - Throws:
DAOException
- if any.
-
createPath
public static Optional<ViewerPath> createPath(String applicationUrl, String applicationName, String serviceUrl, String queryString) throws DAOException Create a combined path from the given url. If the url leads to a known PageType, associates the PageType with the combined path. If the path leads to a cmsPage, either through direct url/cmds/...
, the cmsPages alternative url or a static page mapping, the cmsPage is associated with this path- Parameters:
applicationUrl
- The absolute url of the web-application including the application name ('viewer')applicationName
- The name of the web-application. This is always the last part of thehostUrl
. May be emptyserviceUrl
- The complete requested url, optionally including the hostUrlqueryString
-- Returns:
- A
ViewerPath
containing the complete path information - Throws:
DAOException
- if any.
-
getCmsPage
Gets the best matching CMSPage which alternative url ('persistent url') matches the beginning of the given path- Parameters:
servicePath
- aURI
object.- Returns:
- a
Optional
object. - Throws:
DAOException
- if any.
-
getCampaign
getCampaign.
- Parameters:
servicePath
- aURI
object.- Returns:
- a
Optional
object. - Throws:
DAOException
- if any.
-
getPageType
Gets thePageType
that the given path refers to, if any -
startsWith
Returns true if the first parts of the uri (separated by '/') are equal to all parts of the given string (separated by '/'). If the string has more parts than the uri, false is returned -
resolve
resolve.
-
resolve
- Parameters:
master
-slave
-- Returns:
- a
URI
object
-
resolve
resolve.
-