public class WarHttpResourceFactory extends AbstractHttpResourceFactory
Locates a HttpFile
from a WAR directory or archive.
As per Servlet standards it will not provide access to files within the
WEB-INF
directory.
Modifier and Type | Method and Description |
---|---|
static void |
clearHttpResourceFactories()
Allows clearing the
HttpResourceFactory instances. |
HttpResource |
createHttpResource(File resource,
String resourcePath)
Creates the
HttpResource . |
HttpResource |
createHttpResource(String applicationCanonicalPath)
Creates the
HttpResponse . |
static ByteBuffer |
getHttpResourceContents(File file)
Obtains the contents of the
HttpResource for the File . |
static WarHttpResourceFactory |
getHttpResourceFactory(File warDirectory,
String... defaultDirectoryFileNames)
Obtains the
WarHttpResourceFactory for the WAR directory. |
addHttpFileDescriber, describeFile, getHttpResourceContents
public static WarHttpResourceFactory getHttpResourceFactory(File warDirectory, String... defaultDirectoryFileNames) throws IOException
WarHttpResourceFactory
for the WAR directory.warDirectory
- WAR directory.defaultDirectoryFileNames
- Default directory file names. Should the
WarHttpResourceFactory
already be created for the WAR
directory, these values are ignored.WarHttpResourceFactory
for the WAR directory.IOException
- If fails to obtain WarHttpResourceFactory
.public static void clearHttpResourceFactories()
HttpResourceFactory
instances.public static ByteBuffer getHttpResourceContents(File file)
HttpResource
for the File
.file
- File
.HttpResource
.public HttpResource createHttpResource(File resource, String resourcePath)
HttpResource
.resource
- File
.resourcePath
- Resource path.HttpResource
.public HttpResource createHttpResource(String applicationCanonicalPath) throws IOException
HttpResourceFactory
HttpResponse
.applicationCanonicalPath
- Application canonical path to the HttpResource
. See
the HttpApplicationLocation
for obtaining this path
from the HttpRequest
request URI.HttpResource
.IOException
- If failure in finding the HttpResource
.Copyright © 2005–2016. All rights reserved.