public class SourceHttpResourceFactory extends Object implements HttpResourceFactory
HttpResourceFactory
initialised from SourceProperties
.
It incorporates other HttpResourceFactory
implementations configured
from the SourceProperties
to achieve its functionality. This provides
reusable HttpResourceFactory
capabilities for the various HTTP Web
ManagedObjectSource
and WorkSource
implementations.
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_CLASS_PATH_PREFIX
Property to specify the class path prefix.
|
static String |
PROPERTY_DEFAULT_DIRECTORY_FILE_NAMES
Property to specify the listing of default directory file names.
|
static String |
PROPERTY_DIRECT_STATIC_CONTENT
Property to specify that all
HttpFile and HttpDirectory
instances are stored in memory with direct ByteBuffer content for
performance. |
static String |
PROPERTY_RESOURCE_DIRECTORIES
Property to specify the resource directories.
|
Modifier and Type | Method and Description |
---|---|
void |
addHttpFileDescriber(HttpFileDescriber httpFileDescriber)
Adds a
HttpFileDescriber to describe the HttpFile
instances. |
static void |
clearHttpResourceFactories()
Clears the
HttpResourceFactory instances. |
static void |
copyProperties(SourceProperties source,
PropertyConfigurable target)
Copies the
Property values of interest. |
HttpResource |
createHttpResource(String applicationCanonicalPath)
Creates the
HttpResponse . |
static HttpResourceFactory |
createHttpResourceFactory(SourceContext context)
Creates the
HttpResourceFactory . |
static void |
loadProperties(String classPathPrefix,
File[] resourceDirectories,
String[] defaultDirectoryFileNames,
Boolean isDirect,
PropertyConfigurable target)
Convenience method for programmatically loading configuration properties.
|
public static String PROPERTY_CLASS_PATH_PREFIX
public static String PROPERTY_RESOURCE_DIRECTORIES
public static String PROPERTY_DEFAULT_DIRECTORY_FILE_NAMES
public static String PROPERTY_DIRECT_STATIC_CONTENT
Property to specify that all HttpFile
and HttpDirectory
instances are stored in memory with direct ByteBuffer
content for
performance.
Should there be changing static content then this should be set to
false
. Typically this is only during development as in
production content is fixed.
public static void copyProperties(SourceProperties source, PropertyConfigurable target)
Copies the Property
values of interest.
This is to aid configuration within the OfficeFloorDeployer
to be
provided down to this.
source
- SourceProperties
.target
- PropertyConfigurable
.public static void loadProperties(String classPathPrefix, File[] resourceDirectories, String[] defaultDirectoryFileNames, Boolean isDirect, PropertyConfigurable target)
Convenience method for programmatically loading configuration properties.
This handles converting to the necessary configuration Property
values.
classPathPrefix
- Class path prefix. May be null
to use default.resourceDirectories
- Resource directories. May be null
or empty array
to not specify.defaultDirectoryFileNames
- Default directory file names. May be null
or
empty array to use default.isDirect
- Indicates if HttpResource
content is kept in memory
(direct ByteBuffer
instances). May be
null
to use default.target
- PropertyConfigurable
.public static HttpResourceFactory createHttpResourceFactory(SourceContext context) throws IOException
HttpResourceFactory
.context
- SourceContext
to configure the
HttpResourceFactory
(and its delegates).HttpResourceFactory
.IOException
- Should the configured resources not be accessible or not
exist.public static void clearHttpResourceFactories()
HttpResourceFactory
instances. This is useful for
testing to have a fresh HttpResourceFactory
.public void addHttpFileDescriber(HttpFileDescriber httpFileDescriber)
HttpResourceFactory
Adds a HttpFileDescriber
to describe the HttpFile
instances.
The HttpFileDescriber
instances are to be used in the order
added. Once a HttpFileDescription
is provided, the remaining
HttpFileDescriber
instances will not be used.
addHttpFileDescriber
in interface HttpResourceFactory
httpFileDescriber
- HttpFileDescriber
to describe the HttpFile
.public HttpResource createHttpResource(String applicationCanonicalPath) throws IOException
HttpResourceFactory
HttpResponse
.createHttpResource
in interface HttpResourceFactory
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.