Package org.apache.tapestry5.http.internal.services

## Class ContextImpl

- java.lang.Object
- - org.apache.tapestry5.http.internal.services.ContextImpl

- All Implemented Interfaces:
    `Context`

      public class ContextImpl
      extends java.lang.Object
      implements Context

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ContextImpl​(ServletContext servletContext)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `getAttribute​(java.lang.String name)` | Returns an attribute previously stored into the context with the given name.
    `java.util.List<java.lang.String>` | `getAttributeNames()` | Returns the names of all attributes of the context, sorted alphabetically.
    `java.lang.String` | `getInitParameter​(java.lang.String name)` | Returns an initial parameter value defined by servlet.
    `java.lang.String` | `getMimeType​(java.lang.String file)` | Returns the MIME content type of the specified file, or null if no content type is known.
    `java.io.File` | `getRealFile​(java.lang.String path)` | Attempts to find the actual file, on the file system, that would be provided by the servlet container for the given path (which must start with a leading slash).
    `java.net.URL` | `getResource​(java.lang.String path)` | Returns a URL to a resource stored within the context.
    `java.util.List<java.lang.String>` | `getResourcePaths​(java.lang.String path)` | Looks for resources within the web application within the supplied path.

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

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

- - ### Constructor Detail

    - #### ContextImpl

          public ContextImpl​(ServletContext servletContext)

  - ### Method Detail

    - #### getResource

          public java.net.URL getResource​(java.lang.String path)

      Description copied from interface: `Context`
      Returns a URL to a resource stored within the context. The path should start with a leading slash.
      Specified by:
        `getResource` in interface `Context`
      Parameters:
        `path` - to the resource (with a leading slash)
      Returns:
        the URL for the path, or null if the path does not correspond to a file.

    - #### getRealFile

          public java.io.File getRealFile​(java.lang.String path)

      Description copied from interface: `Context`
      Attempts to find the actual file, on the file system, that would be provided by the servlet container for the given path (which must start with a leading slash). This may return null if no such file exists, or if the resource in question is packaged inside a WAR. If packaged inside a WAR, the contents may be accessed via `Context.getResource(String)`.
      Specified by:
        `getRealFile` in interface `Context`
      Parameters:
        `path` - to the resource (with a leading slash)
      Returns:
        the underlying File, or null if no such file

    - #### getInitParameter

          public java.lang.String getInitParameter​(java.lang.String name)

      Description copied from interface: `Context`
      Returns an initial parameter value defined by servlet.
      Specified by:
        `getInitParameter` in interface `Context`

    - #### getResourcePaths

          public java.util.List<java.lang.String> getResourcePaths​(java.lang.String path)

      Description copied from interface: `Context`
      Looks for resources within the web application within the supplied path. The list will be recurively expanded, as necessary. The path must start with a leading slash, and usually ends with a slash as well.
      Specified by:
        `getResourcePaths` in interface `Context`
      Parameters:
        `path` - to search for (should start with a leading slash)
      Returns:
        the matches, sorted alphabetically

    - #### getAttribute

          public java.lang.Object getAttribute​(java.lang.String name)

      Description copied from interface: `Context`
      Returns an attribute previously stored into the context with the given name.
      Specified by:
        `getAttribute` in interface `Context`
      Parameters:
        `name` - used to retrieve the attribute
      Returns:
        the attribute, or null if not found

    - #### getAttributeNames

          public java.util.List<java.lang.String> getAttributeNames()

      Description copied from interface: `Context`
      Returns the names of all attributes of the context, sorted alphabetically.
      Specified by:
        `getAttributeNames` in interface `Context`

    - #### getMimeType

          public java.lang.String getMimeType​(java.lang.String file)

      Description copied from interface: `Context`
      Returns the MIME content type of the specified file, or null if no content type is known. MIME types are built-in to servlet containers and may be futher specified via the web application deployment descriptor.
      Specified by:
        `getMimeType` in interface `Context`
      Parameters:
        `file` - name of file
      Returns:
        the presumed MIME content type, or null if not known