org.appng.api

## Class PathInfo

- java.lang.Object
- - org.appng.api.PathInfo

- All Implemented Interfaces:
    Path

      public class PathInfo
      extends Object
      implements Path

  Default `Path`-implementation
  Author:
    Matthias Müller

- - ### Field Summary

    - ### Fields inherited from interface org.appng.api.Path

      `SEPARATOR`

  - ### Constructor Summary

    Constructors
    Constructor and 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 new `PathInfo`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkPathLength(int minLength)` Checks whether this `Path` has the given minimum number of elements and throws an `IOException` otherwise
    `String` | `getActionName()` Returns the name of the currently selected action, if present
    `String` | `getActionValue()` Returns the value of the currently selected action, if present
    `int` | `getApplicationIndex()` Return the index of the element representing the `Application` name
    `String` | `getApplicationName()` Returns the name of the `Application` which is being addressed by this `Path`
    `List<String>` | `getApplicationUrlParameters()` Returns a `List` containing the values of the `UrlParams` of a `Application`s page or service-call.
    `List<String>` | `getBlobDirectories()` Returns a `List` of all directories which are being used to store BLOBs
    `String` | `getCurrentPath()` Returns the current path to the application, e.g.
    `List<String>` | `getDocumentDirectories()` Returns a `List` of all document directories, which contain the JSP-files
    `String` | `getDomain()` Returns the domain of the currently selected `Site`, if present
    `String` | `getElementAt(int idx)` Returns the element at index `idx`, if present
    `int` | `getElementCount()` Returns the number of elements of this `Path`
    `String` | `getExtension()` Returns the file-extension for JSP-files
    `String` | `getForwardPath(String wwwRootPath, File wwwRootFile)` Builds the the path to which a `HttpServletRequest` 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 selected `Site`, if present
    `List<String>` | `getJspUrlParameters()` Returns a `List` containing the values of the JSP-Paramters of a JSP-call.
    `String` | `getLastElement()` Returns the last element of this `Path`.
    `String` | `getOutputFormat()` Returns the ID of `OutputFormat`. An `OutputFormat` may be defined by adding `_<format>` after the gui-path, e.g.
    `String` | `getOutputPrefix()` Returns the path prefix that contains the `OutputFormat` and `OutputType`, if those are set.
    `String` | `getOutputType()` Returns the ID of `OutputType`. An `OutputType` may be defined by adding `_<type>` after the output-format, e.g.
    `String` | `getPage()` Returns the name of the currently selected page, if present
    `String` | `getPlatformUrl()` Returns the complete absolute URL this `Path` represents, which is the `Site`s domain plus the servlet-path
    `String` | `getRootPath()` Returns the root-path of this `Path`, which is the first element, or `/` if there is no first element
    `String` | `getService()` Return the name of the service addressed by this `Path`
    `String` | `getServicePath()` Returns the path element that addresses a service
    `String` | `getServletPath()` Returns the complete servlet-path this `Path` was built from
    `String` | `getSiteName()` Returns the name of the `Site` which is being addressed by this `Path`
    `boolean` | `hasAction()` Checks whether this `Path` has an action selected
    `boolean` | `hasApplication()` Checks whether this `Path` contains an element determining the current `Application`
    `boolean` | `hasElementAt(int idx)` Returns `true` if this `Path` has an elements at index `idx`.
    `boolean` | `hasOutputFormat()` Checks whether this `Path` has an `OutputFormat` set.
    `boolean` | `hasOutputType()` Checks whether this `Path` has an `OutputType` set.
    `boolean` | `hasSite()` Checks whether this `Path` contains an element determining the current `Site`
    `boolean` | `isDocument()` Checks whether this `Path` represents a document from a document-folder.
    `boolean` | `isGui()` Checks whether this `Path` represents a call to the appNG webapplication GUI
    `boolean` | `isJsp()` Checks whether this `Path` represents the call of a JSP file.
    `boolean` | `isMonitoring()` Checks whether this `Path` represents a monitoring path
    `boolean` | `isPathSelected(String path)` Checks whether the given `servletPath` is being addressed by this `Path`, which basically means the servlet-path represented by this `Path` must start with the given `servletPath`.
    `boolean` | `isRepository()` Checks whether this `Path` represents the repository-folder of appNG
    `boolean` | `isRoot()` Checks whether this `Path` represents the root-path
    `boolean` | `isRootIgnoreTrailingSlash()`
    `boolean` | `isService()` Checks whether this `Path` represents a call to a service (`Webservice`/`AttachmentWebservice`, `SoapService` or an XML/JSON call of an `ActionProvider` or `DataProvider`.
    `boolean` | `isStaticContent()` Checks whether this `Path` represents a static resource from a blob-directory
    `void` | `setAction(String actionName, String actionValue)` Manually sets the name and value for an action within a `Application`
    `void` | `setApplicationName(String application)` Manually sets the name of the selected `Application`
    `void` | `setPage(String page)` Manually sets the page within a `Application`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 new `PathInfo`
      Parameters:
        `host` - the host of the current `Site`
        `domain` - the domain of the current `Site`
        `currentSite` - the name of the current `Site`
        `servletPath` - the current servletPath, as returned by `HttpServletRequest.getServletPath()`
        `guiPath` - value of the property "manager-path" of the current `Site`
        `servicePath` - value of the property "service-path" of the current `Site`
        `blobDirectories` - a list parsed from the property "assetsDir" of the current `Site`
        `documentDirectories` - a list parsed from the property "documentDir" of the current `Site`
        `repositoryPath` - value of the platform property "repositoryPath"
        `monitoringPath` - the path to appNGs built in monitoring
        `extension` - value of the platform property "jspFileType"

    - #### PathInfo

          public PathInfo(String host,
                          String domain,
                          String currentSite,
                          String servletPath,
                          String guiPath,
                          String servicePath,
                          List<String> blobDirectories,
                          List<String> documentDirectories,
                          String repositoryPath,
                          String extension)

      See Also:
        `PathInfo(String, String, String, String, String, String, List, List, String, String, String)`

  - ### Method Detail

    - #### hasElementAt

          public boolean hasElementAt(int idx)

      Description copied from interface: `Path`
      Returns `true` if this `Path` has an elements at index `idx`.
      Specified by:
        `hasElementAt` in interface `Path`
      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 this `Path`.
      Specified by:
        `getLastElement` in interface `Path`
      Returns:
        the last element

    - #### getElementAt

          public String getElementAt(int idx)

      Description copied from interface: `Path`
      Returns the element at index `idx`, if present
      Specified by:
        `getElementAt` in interface `Path`
      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 this `Path` has the given minimum number of elements and throws an `IOException` otherwise
      Specified by:
        `checkPathLength` in interface `Path`
      Parameters:
        `minLength` - the minimum length to check
      Throws:
        `IOException` - if this `Path` does not have the required minimum length

    - #### isStaticContent

          public boolean isStaticContent()

      Description copied from interface: `Path`
      Checks whether this `Path` represents a static resource from a blob-directory
      Specified by:
        `isStaticContent` in interface `Path`
      Returns:
        `true` if this `Path` represents a static resource, `false` otherwise
      See Also:
        `Path.getBlobDirectories()`

    - #### isDocument

          public boolean isDocument()

      Description copied from interface: `Path`
      Checks whether this `Path` represents a document from a document-folder.
      Specified by:
        `isDocument` in interface `Path`
      Returns:
        `true` if this `Path` 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 this `Path` represents a call to the appNG webapplication GUI
      Specified by:
        `isGui` in interface `Path`
      Returns:
        `true` if this `Path` 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 this `Path` represents a call to a service (`Webservice`/`AttachmentWebservice`, `SoapService` or an XML/JSON call of an `ActionProvider` or `DataProvider`.
      Specified by:
        `isService` in interface `Path`
      Returns:
        `true` if this `Path` represents a call to a service, `false` otherwise

    - #### isJsp

          public boolean isJsp()

      Description copied from interface: `Path`
      Checks whether this `Path` represents the call of a JSP file.
      Specified by:
        `isJsp` in interface `Path`
      Returns:
        `true` if this `Path` 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 the `Site` which is being addressed by this `Path`
      Specified by:
        `getSiteName` in interface `Path`
      Returns:
        the site name, if present
      See Also:
        `Path.hasSite()`

    - #### hasSite

          public boolean hasSite()

      Description copied from interface: `Path`
      Checks whether this `Path` contains an element determining the current `Site`
      Specified by:
        `hasSite` in interface `Path`
      Returns:
        `true` if this `Path` contains an element determining the current `Site`, `false` otherwise

    - #### setApplicationName

          public void setApplicationName(String application)

      Manually sets the name of the selected `Application`
      Parameters:
        `application` - the name of the `Application`

    - #### getApplicationName

          public String getApplicationName()

      Description copied from interface: `Path`
      Returns the name of the `Application` which is being addressed by this `Path`
      Specified by:
        `getApplicationName` in interface `Path`
      Returns:
        the application name, if present
      See Also:
        `Path.hasApplication()`

    - #### hasApplication

          public boolean hasApplication()

      Description copied from interface: `Path`
      Checks whether this `Path` contains an element determining the current `Application`
      Specified by:
        `hasApplication` in interface `Path`
      Returns:
        `true` if this `Path` contains an element determining the current `Application`, `false` otherwise

    - #### setPage

          public void setPage(String page)

      Manually sets the page within a `Application`
      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 interface `Path`
      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 a `Application`
      Parameters:
        `actionName` - the name of the action
        `actionValue` - 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 interface `Path`
      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 interface `Path`
      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 this `Path` has an action selected
      Specified by:
        `hasAction` in interface `Path`
      Returns:
        `true` if this `Path` , `false` otherwise
      See Also:
        `Path.getActionName()`, `Path.getActionValue()`

    - #### getApplicationUrlParameters

          public List<String> getApplicationUrlParameters()

      Description copied from interface: `Path`
      Returns a `List` containing the values of the `UrlParams` of a `Application`s page or service-call.
      Specified by:
        `getApplicationUrlParameters` in interface `Path`
      Returns:
        a `List` of parameter values
      See Also:
        `Path.isGui()`, `Path.isService()`

    - #### getJspUrlParameters

          public List<String> getJspUrlParameters()

      Description copied from interface: `Path`
      Returns a `List` 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`, with `en` being a document folder and `index` the JSP name, the list will contain `"foo"` and `"bar"`.
      Specified by:
        `getJspUrlParameters` in interface `Path`
      Returns:
        a `List` of parameter values
      See Also:
        `Path.isJsp()`

    - #### getRootPath

          public String getRootPath()

      Description copied from interface: `Path`
      Returns the root-path of this `Path`, which is the first element, or `/` if there is no first element
      Specified by:
        `getRootPath` in interface `Path`
      Returns:
        the root-path

    - #### getHost

          public String getHost()

      Description copied from interface: `Path`
      Returns the host of the currently selected `Site`, if present
      Specified by:
        `getHost` in interface `Path`
      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 selected `Site`, if present
      Specified by:
        `getDomain` in interface `Path`
      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 this `Path` was built from
      Specified by:
        `getServletPath` in interface `Path`
      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 interface `Path`
      Returns:
        the current path to the application

    - #### isRoot

          public boolean isRoot()

      Description copied from interface: `Path`
      Checks whether this `Path` represents the root-path
      Specified by:
        `isRoot` in interface `Path`
      Returns:
        `true` if this `Path` 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 this `Path` represents the repository-folder of appNG
      Specified by:
        `isRepository` in interface `Path`
      Returns:
        `true` if this `Path` represents the repository-folder of appNG, `false` otherwise

    - #### isMonitoring

          public boolean isMonitoring()

      Description copied from interface: `Path`
      Checks whether this `Path` represents a monitoring path
      Specified by:
        `isMonitoring` in interface `Path`
      Returns:
        `true` if this `Path` 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 interface `Path`
      Returns:
        the path to the appNG webapplication
      See Also:
        `Path.isGui()`

    - #### getBlobDirectories

          public List<String> getBlobDirectories()

      Description copied from interface: `Path`
      Returns a `List` of all directories which are being used to store BLOBs
      Specified by:
        `getBlobDirectories` in interface `Path`
      Returns:
        a `List` of all blob directories

    - #### getDocumentDirectories

          public List<String> getDocumentDirectories()

      Description copied from interface: `Path`
      Returns a `List` of all document directories, which contain the JSP-files
      Specified by:
        `getDocumentDirectories` in interface `Path`
      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 this `Path` represents, which is the `Site`s domain plus the servlet-path
      Specified by:
        `getPlatformUrl` in interface `Path`
      Returns:
        the complete URL
      See Also:
        `Path.getDomain()`, `Path.getServletPath()`

    - #### getOutputFormat

          public String getOutputFormat()

      Description copied from interface: `Path`
      Returns the ID of `OutputFormat`.
      An `OutputFormat` may be defined by adding `_<format>` after the gui-path, e.g. `/ws/_html/site/application/page`.
      Specified by:
        `getOutputFormat` in interface `Path`
      Returns:
        the ID of the `OutputFormat`, if present
      See Also:
        `Path.isGui()`

    - #### getOutputType

          public String getOutputType()

      Description copied from interface: `Path`
      Returns the ID of `OutputType`.
      An `OutputType` may be defined by adding `_<type>` after the output-format, e.g. `/ws/_html/_minimal/site/application/page`.
      Specified by:
        `getOutputType` in interface `Path`
      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 this `Path` has an `OutputFormat` set.
      Specified by:
        `hasOutputFormat` in interface `Path`
      Returns:
        `true` if this `Path` has an `OutputFormat` set, `false` otherwise
      See Also:
        `Path.getOutputFormat()`

    - #### hasOutputType

          public boolean hasOutputType()

      Description copied from interface: `Path`
      Checks whether this `Path` has an `OutputType` set.
      Specified by:
        `hasOutputType` in interface `Path`
      Returns:
        `true` if this `Path` has an `OutputType` set, `false` otherwise
      See Also:
        `Path.getOutputType()`

    - #### getService

          public String getService()

      Description copied from interface: `Path`
      Return the name of the service addressed by this `Path`
      Specified by:
        `getService` in interface `Path`
      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 interface `Path`
      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 given `servletPath` is being addressed by this `Path`, which basically means the servlet-path represented by this `Path` must start with the given `servletPath`.
      Specified by:
        `isPathSelected` in interface `Path`
      Parameters:
        `path` - the servlet-path to check
      Returns:
        `true` if this `Path` , `false` otherwise
      See Also:
        `Path.getServletPath()`

    - #### getOutputPrefix

          public String getOutputPrefix()

      Description copied from interface: `Path`
      Returns the path prefix that contains the `OutputFormat` and `OutputType`, if those are set.
      Specified by:
        `getOutputPrefix` in interface `Path`
      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 interface `Path`
      Returns:
        the file-extension
      See Also:
        `Path.isJsp()`

    - #### getForwardPath

          public String getForwardPath(String wwwRootPath,
                                       File wwwRootFile)

      Builds the the path to which a `HttpServletRequest` 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 a `Site`s web-folder, under which the document-folders reside
        `wwwRootFile` - 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 the `Application` name
      Specified by:
        `getApplicationIndex` in interface `Path`
      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 this `Path`
      Specified by:
        `getElementCount` in interface `Path`
      Returns:
        the number of elements

Copyright © 2011–2023 aiticon GmbH. All rights reserved.