Package org.rapidcontext.app.web
Class FileWebService
java.lang.Object
org.rapidcontext.core.storage.StorableObject
org.rapidcontext.core.type.WebService
org.rapidcontext.app.web.FileWebService
- All Implemented Interfaces:
HttpUtil
- Direct Known Subclasses:
AppWebService
A file web service. This service is used for retrieving binary (or
text) files from the storage, usually the standard web site files
(HTML, CSS, JavaScript, etc). This web service only support HTTP GET
requests.
- Version:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.rapidcontext.util.HttpUtil
HttpUtil.HEADER, HttpUtil.Helper, HttpUtil.METHOD, HttpUtil.STATUS
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The dictionary key for the base storage path for files.Fields inherited from class org.rapidcontext.core.type.WebService
KEY_DESCRIPTION, KEY_MATCH, matchers, METHODS_GET, METHODS_GET_POST, METHODS_POST, PATH
Fields inherited from class org.rapidcontext.core.storage.StorableObject
dict, KEY_ACTIVATED_TIME, KEY_CLASSNAME, KEY_ID, KEY_TYPE, PREFIX_COMPUTED, PREFIX_HIDDEN
-
Constructor Summary
ConstructorsConstructorDescriptionFileWebService
(String id, String type, Dict dict) Creates a new file web service from a serialized representation. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Processes an HTTP GET request.lookupPaths
(Path filePath, boolean exact) Returns an ordered stream of file lookup paths.protected String[]
methodsImpl
(Request request) Returns the HTTP methods implemented for the specified request.path()
Returns the base storage path for file lookups.protected void
processFile
(Request request, Path filePath, boolean exact) Processes a storage file retrieval request (if possible).Methods inherited from class org.rapidcontext.core.type.WebService
all, description, doDelete, doHead, doOptions, doPatch, doPost, doPut, doTrace, errorBadRequest, errorForbidden, errorInternal, errorMethodNotAllowed, errorNotFound, errorUnauthorized, headerAllow, init, matchers, methods, process, session
Methods inherited from class org.rapidcontext.core.storage.StorableObject
activate, activatedTime, destroy, id, isActive, isModified, passivate, serialize, sterilize, toString, type
-
Field Details
-
KEY_PATH
The dictionary key for the base storage path for files.- See Also:
-
-
Constructor Details
-
FileWebService
Creates a new file web service from a serialized representation.- Parameters:
id
- the object identifiertype
- the object type namedict
- the serialized representation
-
-
Method Details
-
path
Returns the base storage path for file lookups.- Overrides:
path
in classStorableObject
- Returns:
- the base storage path
-
methodsImpl
Returns the HTTP methods implemented for the specified request. The OPTIONS or HEAD methods doesn't have to be added to the result (added automatically later).- Specified by:
methodsImpl
in classWebService
- Parameters:
request
- the request to check- Returns:
- the array of HTTP method names supported
- See Also:
-
doGet
Processes an HTTP GET request.- Overrides:
doGet
in classWebService
- Parameters:
request
- the request to process
-
processFile
Processes a storage file retrieval request (if possible).- Parameters:
request
- the request to processfilePath
- the storage path to the binary fileexact
- the exact path match flag
-
lookupPaths
Returns an ordered stream of file lookup paths. For non-exact matches this includes all parent "404.html" and "index.html" paths.- Parameters:
filePath
- the requested file pathexact
- the exact path match flag- Returns:
- the stream of lookup paths
-