Package org.appng.api
Class PathInfo
- java.lang.Object
-
- org.appng.api.PathInfo
-
-
Constructor Summary
Constructors Constructor Description PathInfo(String host, String domain, String currentSite, String servletPath, String guiPath, String servicePath, List<String> blobDirectories, List<String> documentDirectories, String repositoryPath, String extension)
PathInfo(String host, String domain, String currentSite, String servletPath, String guiPath, String servicePath, List<String> blobDirectories, List<String> documentDirectories, String repositoryPath, String monitoringPath, String extension)
Creates a newPathInfo
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkPathLength(int minLength)
Checks whether thisPath
has the given minimum number of elements and throws anIOException
otherwiseString
getActionName()
Returns the name of the currently selected action, if presentString
getActionValue()
Returns the value of the currently selected action, if presentint
getApplicationIndex()
Return the index of the element representing theApplication
nameString
getApplicationName()
Returns the name of theApplication
which is being addressed by thisPath
List<String>
getApplicationUrlParameters()
List<String>
getBlobDirectories()
String
getCurrentPath()
Returns the current path to the application, e.g.List<String>
getDocumentDirectories()
Returns aList
of all document directories, which contain the JSP-filesString
getDomain()
Returns the domain of the currently selectedSite
, if presentString
getElementAt(int idx)
Returns the element at indexidx
, if presentint
getElementCount()
Returns the number of elements of thisPath
String
getExtension()
Returns the file-extension for JSP-filesString
getForwardPath(String wwwRootPath, File wwwRootFile)
Builds the the path to which aHttpServletRequest
has to be forwarded to in order the retrieve a file from a document directory.String
getGuiPath()
Returns the path to the appNG webapplication.String
getHost()
Returns the host of the currently selectedSite
, if presentList<String>
getJspUrlParameters()
Returns aList
containing the values of the JSP-Paramters of a JSP-call.String
getLastElement()
Returns the last element of thisPath
.String
getOutputFormat()
Returns the ID ofOutputFormat
.
AnOutputFormat
may be defined by adding_<format>
after the gui-path, e.g.String
getOutputPrefix()
Returns the path prefix that contains theOutputFormat
andOutputType
, if those are set.String
getOutputType()
Returns the ID ofOutputType
.
AnOutputType
may be defined by adding_<type>
after the output-format, e.g.String
getPage()
Returns the name of the currently selected page, if presentString
getPlatformUrl()
Returns the complete absolute URL thisPath
represents, which is theSite
s domain plus the servlet-pathString
getRootPath()
Returns the root-path of thisPath
, which is the first element, or/
if there is no first elementString
getService()
Return the name of the service addressed by thisPath
String
getServicePath()
Returns the path element that addresses a serviceString
getServletPath()
Returns the complete servlet-path thisPath
was built fromString
getSiteName()
Returns the name of theSite
which is being addressed by thisPath
boolean
hasAction()
Checks whether thisPath
has an action selectedboolean
hasApplication()
Checks whether thisPath
contains an element determining the currentApplication
boolean
hasElementAt(int idx)
Returnstrue
if thisPath
has an elements at indexidx
.boolean
hasOutputFormat()
Checks whether thisPath
has anOutputFormat
set.boolean
hasOutputType()
Checks whether thisPath
has anOutputType
set.boolean
hasSite()
Checks whether thisPath
contains an element determining the currentSite
boolean
isDocument()
Checks whether thisPath
represents a document from a document-folder.boolean
isGui()
Checks whether thisPath
represents a call to the appNG webapplication GUIboolean
isJsp()
Checks whether thisPath
represents the call of a JSP file.boolean
isMonitoring()
Checks whether thisPath
represents a monitoring pathboolean
isPathSelected(String path)
Checks whether the givenservletPath
is being addressed by thisPath
, which basically means the servlet-path represented by thisPath
must start with the givenservletPath
.boolean
isRepository()
Checks whether thisPath
represents the repository-folder of appNGboolean
isRoot()
Checks whether thisPath
represents the root-pathboolean
isRootIgnoreTrailingSlash()
boolean
isService()
Checks whether thisPath
represents a call to a service (Webservice
/AttachmentWebservice
,SoapService
or an XML/JSON call of anActionProvider
orDataProvider
.boolean
isStaticContent()
Checks whether thisPath
represents a static resource from a blob-directoryvoid
setAction(String actionName, String actionValue)
Manually sets the name and value for an action within aApplication
void
setApplicationName(String application)
Manually sets the name of the selectedApplication
void
setPage(String page)
Manually sets the page within aApplication
-
-
-
Constructor Detail
-
PathInfo
public PathInfo(String host, String domain, String currentSite, String servletPath, String guiPath, String servicePath, List<String> blobDirectories, List<String> documentDirectories, String repositoryPath, String monitoringPath, String extension)
Creates a newPathInfo
- Parameters:
host
- the host of the currentSite
domain
- the domain of the currentSite
currentSite
- the name of the currentSite
servletPath
- the current servletPath, as returned byHttpServletRequest.getServletPath()
guiPath
- value of the property "manager-path" of the currentSite
servicePath
- value of the property "service-path" of the currentSite
blobDirectories
- a list parsed from the property "assetsDir" of the currentSite
documentDirectories
- a list parsed from the property "documentDir" of the currentSite
repositoryPath
- value of the platform property "repositoryPath"monitoringPath
- the path to appNGs built in monitoringextension
- value of the platform property "jspFileType"
-
-
Method Detail
-
hasElementAt
public boolean hasElementAt(int idx)
Description copied from interface:Path
Returnstrue
if thisPath
has an elements at indexidx
.- Specified by:
hasElementAt
in interfacePath
- Parameters:
idx
- the zero-based index to check- Returns:
true
if there is such a path element,false
otherwise
-
getLastElement
public String getLastElement()
Description copied from interface:Path
Returns the last element of thisPath
.- Specified by:
getLastElement
in interfacePath
- Returns:
- the last element
-
getElementAt
public String getElementAt(int idx)
Description copied from interface:Path
Returns the element at indexidx
, if present- Specified by:
getElementAt
in interfacePath
- Parameters:
idx
- the zero-based index- Returns:
- the element at the given index, or
null
if no such element exists
-
checkPathLength
public void checkPathLength(int minLength) throws IOException
Description copied from interface:Path
Checks whether thisPath
has the given minimum number of elements and throws anIOException
otherwise- Specified by:
checkPathLength
in interfacePath
- Parameters:
minLength
- the minimum length to check- Throws:
IOException
- if thisPath
does not have the required minimum length
-
isStaticContent
public boolean isStaticContent()
Description copied from interface:Path
Checks whether thisPath
represents a static resource from a blob-directory- Specified by:
isStaticContent
in interfacePath
- Returns:
true
if thisPath
represents a static resource,false
otherwise- See Also:
Path.getBlobDirectories()
-
isDocument
public boolean isDocument()
Description copied from interface:Path
Checks whether thisPath
represents a document from a document-folder.- Specified by:
isDocument
in interfacePath
- Returns:
true
if thisPath
represents a JSP file from a document-folder,false
otherwise- See Also:
Path.getDocumentDirectories()
-
isGui
public boolean isGui()
Description copied from interface:Path
Checks whether thisPath
represents a call to the appNG webapplication GUI- Specified by:
isGui
in interfacePath
- Returns:
true
if thisPath
represents a call to the appNG webapplication GUI,false
otherwise- See Also:
Path.getGuiPath()
-
isService
public boolean isService()
Description copied from interface:Path
Checks whether thisPath
represents a call to a service (Webservice
/AttachmentWebservice
,SoapService
or an XML/JSON call of anActionProvider
orDataProvider
.
-
isJsp
public boolean isJsp()
Description copied from interface:Path
Checks whether thisPath
represents the call of a JSP file.- Specified by:
isJsp
in interfacePath
- Returns:
true
if thisPath
represents the call of a JSP file,false
otherwise- See Also:
Path.getExtension()
,Path.isDocument()
-
getSiteName
public String getSiteName()
Description copied from interface:Path
Returns the name of theSite
which is being addressed by thisPath
- Specified by:
getSiteName
in interfacePath
- Returns:
- the site name, if present
- See Also:
Path.hasSite()
-
hasSite
public boolean hasSite()
Description copied from interface:Path
Checks whether thisPath
contains an element determining the currentSite
-
setApplicationName
public void setApplicationName(String application)
Manually sets the name of the selectedApplication
- Parameters:
application
- the name of theApplication
-
getApplicationName
public String getApplicationName()
Description copied from interface:Path
Returns the name of theApplication
which is being addressed by thisPath
- Specified by:
getApplicationName
in interfacePath
- Returns:
- the application name, if present
- See Also:
Path.hasApplication()
-
hasApplication
public boolean hasApplication()
Description copied from interface:Path
Checks whether thisPath
contains an element determining the currentApplication
- Specified by:
hasApplication
in interfacePath
- Returns:
true
if thisPath
contains an element determining the currentApplication
,false
otherwise
-
setPage
public void setPage(String page)
Manually sets the page within aApplication
- Parameters:
page
- the page to set
-
getPage
public String getPage()
Description copied from interface:Path
Returns the name of the currently selected page, if present- Specified by:
getPage
in interfacePath
- Returns:
- the name of the page, or
null
if no page is selected - See Also:
Path.isGui()
-
setAction
public void setAction(String actionName, String actionValue)
Manually sets the name and value for an action within aApplication
- Parameters:
actionName
- the name of the actionactionValue
- the value for the action
-
getActionName
public String getActionName()
Description copied from interface:Path
Returns the name of the currently selected action, if present- Specified by:
getActionName
in interfacePath
- Returns:
- the name of the currently selected action, or
null
if no action is selected - See Also:
Path.isGui()
,Path.getActionValue()
-
getActionValue
public String getActionValue()
Description copied from interface:Path
Returns the value of the currently selected action, if present- Specified by:
getActionValue
in interfacePath
- Returns:
- the value of the currently selected action, or
null
if no action is selected - See Also:
Path.isGui()
,Path.getActionName()
-
hasAction
public boolean hasAction()
Description copied from interface:Path
Checks whether thisPath
has an action selected- Specified by:
hasAction
in interfacePath
- Returns:
true
if thisPath
,false
otherwise- See Also:
Path.getActionName()
,Path.getActionValue()
-
getApplicationUrlParameters
public List<String> getApplicationUrlParameters()
Description copied from interface:Path
- Specified by:
getApplicationUrlParameters
in interfacePath
- Returns:
- a
List
of parameter values - See Also:
Path.isGui()
,Path.isService()
-
getJspUrlParameters
public List<String> getJspUrlParameters()
Description copied from interface:Path
Returns aList
containing the values of the JSP-Paramters of a JSP-call. Every parameter after the JSPs name is a JSP-Parameter. For example, if the current servletpath is/en/index/foo/bar
, withen
being a document folder andindex
the JSP name, the list will contain"foo"
and"bar"
.- Specified by:
getJspUrlParameters
in interfacePath
- Returns:
- a
List
of parameter values - See Also:
Path.isJsp()
-
getRootPath
public String getRootPath()
Description copied from interface:Path
Returns the root-path of thisPath
, which is the first element, or/
if there is no first element- Specified by:
getRootPath
in interfacePath
- Returns:
- the root-path
-
getHost
public String getHost()
Description copied from interface:Path
Returns the host of the currently selectedSite
, if present- Specified by:
getHost
in interfacePath
- Returns:
- the host of the
Site
- See Also:
Path.hasSite()
,Site.getHost()
-
getDomain
public String getDomain()
Description copied from interface:Path
Returns the domain of the currently selectedSite
, if present- Specified by:
getDomain
in interfacePath
- Returns:
- the domain of the
Site
- See Also:
Path.hasSite()
,Site.getDomain()
-
getServletPath
public String getServletPath()
Description copied from interface:Path
Returns the complete servlet-path thisPath
was built from- Specified by:
getServletPath
in interfacePath
- Returns:
- the servlet-path
-
getCurrentPath
public String getCurrentPath()
Description copied from interface:Path
Returns the current path to the application, e.g./manager/mysite/myapp
- Specified by:
getCurrentPath
in interfacePath
- Returns:
- the current path to the application
-
isRoot
public boolean isRoot()
Description copied from interface:Path
Checks whether thisPath
represents the root-path- Specified by:
isRoot
in interfacePath
- Returns:
true
if thisPath
represents the root-path,false
otherwise- See Also:
Path.getRootPath()
-
isRootIgnoreTrailingSlash
public boolean isRootIgnoreTrailingSlash()
-
isRepository
public boolean isRepository()
Description copied from interface:Path
Checks whether thisPath
represents the repository-folder of appNG- Specified by:
isRepository
in interfacePath
- Returns:
true
if thisPath
represents the repository-folder of appNG,false
otherwise
-
isMonitoring
public boolean isMonitoring()
Description copied from interface:Path
Checks whether thisPath
represents a monitoring path- Specified by:
isMonitoring
in interfacePath
- Returns:
true
if thisPath
represents a monitoring path,false
otherwise
-
getGuiPath
public String getGuiPath()
Description copied from interface:Path
Returns the path to the appNG webapplication.- Specified by:
getGuiPath
in interfacePath
- Returns:
- the path to the appNG webapplication
- See Also:
Path.isGui()
-
getBlobDirectories
public List<String> getBlobDirectories()
Description copied from interface:Path
- Specified by:
getBlobDirectories
in interfacePath
- Returns:
- a
List
of all blob directories
-
getDocumentDirectories
public List<String> getDocumentDirectories()
Description copied from interface:Path
Returns aList
of all document directories, which contain the JSP-files- Specified by:
getDocumentDirectories
in interfacePath
- Returns:
- a
List
of all document directories - See Also:
Path.isDocument()
,Path.isJsp()
-
getPlatformUrl
public String getPlatformUrl()
Description copied from interface:Path
Returns the complete absolute URL thisPath
represents, which is theSite
s domain plus the servlet-path- Specified by:
getPlatformUrl
in interfacePath
- Returns:
- the complete URL
- See Also:
Path.getDomain()
,Path.getServletPath()
-
getOutputFormat
public String getOutputFormat()
Description copied from interface:Path
Returns the ID ofOutputFormat
.
AnOutputFormat
may be defined by adding_<format>
after the gui-path, e.g./ws/_html/site/application/page
.- Specified by:
getOutputFormat
in interfacePath
- Returns:
- the ID of the
OutputFormat
, if present - See Also:
Path.isGui()
-
getOutputType
public String getOutputType()
Description copied from interface:Path
Returns the ID ofOutputType
.
AnOutputType
may be defined by adding_<type>
after the output-format, e.g./ws/_html/_minimal/site/application/page
.- Specified by:
getOutputType
in interfacePath
- Returns:
- the ID of the
OutputType
, if present - See Also:
Path.isGui()
,Path.getOutputFormat()
-
hasOutputFormat
public boolean hasOutputFormat()
Description copied from interface:Path
Checks whether thisPath
has anOutputFormat
set.- Specified by:
hasOutputFormat
in interfacePath
- Returns:
true
if thisPath
has anOutputFormat
set,false
otherwise- See Also:
Path.getOutputFormat()
-
hasOutputType
public boolean hasOutputType()
Description copied from interface:Path
Checks whether thisPath
has anOutputType
set.- Specified by:
hasOutputType
in interfacePath
- Returns:
true
if thisPath
has anOutputType
set,false
otherwise- See Also:
Path.getOutputType()
-
getService
public String getService()
Description copied from interface:Path
Return the name of the service addressed by thisPath
- Specified by:
getService
in interfacePath
- Returns:
- the name of the service, if present
- See Also:
Path.isService()
,Path.getServicePath()
-
getServicePath
public String getServicePath()
Description copied from interface:Path
Returns the path element that addresses a service- Specified by:
getServicePath
in interfacePath
- Returns:
- the path element that addresses a service, if present
- See Also:
Path.isService()
,Path.getService()
-
isPathSelected
public boolean isPathSelected(String path)
Description copied from interface:Path
Checks whether the givenservletPath
is being addressed by thisPath
, which basically means the servlet-path represented by thisPath
must start with the givenservletPath
.- Specified by:
isPathSelected
in interfacePath
- Parameters:
path
- the servlet-path to check- Returns:
true
if thisPath
,false
otherwise- See Also:
Path.getServletPath()
-
getOutputPrefix
public String getOutputPrefix()
Description copied from interface:Path
Returns the path prefix that contains theOutputFormat
andOutputType
, if those are set.- Specified by:
getOutputPrefix
in interfacePath
- Returns:
- the path prefix
- See Also:
Path.getOutputFormat()
,Path.getOutputType()
-
getExtension
public String getExtension()
Description copied from interface:Path
Returns the file-extension for JSP-files- Specified by:
getExtension
in interfacePath
- Returns:
- the file-extension
- See Also:
Path.isJsp()
-
getForwardPath
public String getForwardPath(String wwwRootPath, File wwwRootFile)
Builds the the path to which aHttpServletRequest
has to be forwarded to in order the retrieve a file from a document directory. If the requested fiel is a JSP, the JSP Url-Parameters are being initialized.- Parameters:
wwwRootPath
- the relative path to aSite
s web-folder, under which the document-folders residewwwRootFile
- a file representing the very same relative path- Returns:
- the forward path
- See Also:
isDocument()
,getDocumentDirectories()
,isJsp()
-
getApplicationIndex
public int getApplicationIndex()
Description copied from interface:Path
Return the index of the element representing theApplication
name- Specified by:
getApplicationIndex
in interfacePath
- Returns:
- The index of the element representing the
Application
name - See Also:
Path.getApplicationName()
,Path.hasApplication()
,Path.getElementAt(int)
-
getElementCount
public int getElementCount()
Description copied from interface:Path
Returns the number of elements of thisPath
- Specified by:
getElementCount
in interfacePath
- Returns:
- the number of elements
-
-