public class FNGAPIAction extends CachedAction
CachedAction.OutputProvider| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
ACQUISITION_SI |
protected java.lang.String |
ARTIST_SI |
protected java.lang.String |
ARTWORK_PARTIAL_SI |
protected java.lang.String |
ARTWORK_SI |
protected java.lang.String |
AUTHOR_SI |
protected java.lang.String |
BIRTH_SI |
protected java.lang.String |
COLLECTION_SI |
protected java.lang.String |
dataHandlerClassName |
protected java.lang.String |
DEATH_SI |
protected java.lang.String |
defaultOutputMode |
protected java.lang.String |
IS_IDENTIFIED_BY_ROLE1_SI |
protected java.lang.String |
IS_IDENTIFIED_BY_SI |
protected java.lang.String |
KEYWORD_SI |
protected java.lang.String |
LOCATION_SI |
protected int |
maxTopics |
protected java.lang.String |
outputModeParamKey |
protected java.lang.String |
PERSON_SI |
protected java.lang.String |
TECHNIQUE_SI |
protected java.lang.String |
TIME_SI |
protected TopicMapManager |
tmManager |
protected java.lang.String |
topicParamKey |
cache, caching, threadPoolactionParamKey, handledActions, httpHeaders, isDefaultAction, replacements, replacementsInitialized, servletModuleengine, initScript, persistentObjects, scriptManager, startScript, stopScriptautoStart, isInitialized, isRunning, logging, loggingModule, moduleManager| Constructor and Description |
|---|
FNGAPIAction() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
doOutput(javax.servlet.http.HttpServletRequest req,
ModulesServlet.HttpMethod method,
java.lang.String action,
CachedAction.OutputProvider out,
User user)
Does the output that might be either cached or returned directly.
|
protected java.lang.String |
getCacheKey(javax.servlet.http.HttpServletRequest req,
ModulesServlet.HttpMethod method,
java.lang.String action)
Should return a string that uniquely identifies this request.
|
protected java.util.LinkedHashMap<java.lang.String,java.lang.String> |
getCacheKeyParams(javax.servlet.http.HttpServletRequest req,
ModulesServlet.HttpMethod method,
java.lang.String action) |
java.util.Collection<Module> |
getDependencies(ModuleManager manager)
Returns all the modules this module depends on.
|
void |
init(ModuleManager manager,
java.util.HashMap<java.lang.String,java.lang.Object> settings)
Initialises the module.
|
protected java.lang.String |
outputTopics(java.lang.String query,
java.lang.String outputMode,
TopicMap tm) |
protected void |
returnOutput(java.io.InputStream cacheIn,
javax.servlet.http.HttpServletResponse resp)
Writes a page read from an input stream into an HTTP servlet response.
|
void |
start(ModuleManager manager)
Starts the module.
|
void |
stop(ModuleManager manager)
Stops the module.
|
protected void |
trimLastComma(java.lang.StringBuilder sb) |
buildCacheKey, handleAction, readMetadata, writeMetadataaddHandledAction, doReplacements, handleRequest, isHandleAction, setActionParamKey, setHttpHeadersgetScriptEngineisInitialized, isRunning, requireLogging, toStringprotected java.lang.String ARTIST_SI
protected java.lang.String ARTWORK_SI
protected java.lang.String ARTWORK_PARTIAL_SI
protected java.lang.String COLLECTION_SI
protected java.lang.String AUTHOR_SI
protected java.lang.String KEYWORD_SI
protected java.lang.String TIME_SI
protected java.lang.String IS_IDENTIFIED_BY_SI
protected java.lang.String IS_IDENTIFIED_BY_ROLE1_SI
protected java.lang.String BIRTH_SI
protected java.lang.String DEATH_SI
protected java.lang.String PERSON_SI
protected java.lang.String LOCATION_SI
protected java.lang.String ACQUISITION_SI
protected java.lang.String TECHNIQUE_SI
protected java.lang.String outputModeParamKey
protected java.lang.String defaultOutputMode
protected java.lang.String topicParamKey
protected TopicMapManager tmManager
protected int maxTopics
protected java.lang.String dataHandlerClassName
public java.util.Collection<Module> getDependencies(ModuleManager manager) throws ModuleException
ModulegetDependencies in interface ModulegetDependencies in class CachedActionmanager - The module manager handling this module.ModuleExceptionpublic void start(ModuleManager manager) throws ModuleException
Modulestart in interface Modulestart in class CachedActionmanager - The module manager handling this module.ModuleExceptionpublic void stop(ModuleManager manager)
Modulestop in interface Modulestop in class CachedActionmanager - The module manager handling this module.public void init(ModuleManager manager, java.util.HashMap<java.lang.String,java.lang.Object> settings) throws ModuleException
ModuleInitialises the module. After constructor, this is the first method called in the life cycle of a module. It should not perform anything time consuming or anything with notable outside side effects. It should only read the parameters and initialise the module so that it can later be started. Note that a module being initialised doesn't mean that it necessarily will ever be started.
A ModuleException may be thrown if something vital is missing from the parameters or they are not sensible. In some cases you may not want to throw an exception even if vital initialisation information is missing. If, for example, it is possible that the module is initialised in some other way between the init and the start method calls. A ModuleException may also be thrown at the start method if the module is still not initialised.
init in interface Moduleinit in class CachedActionmanager - The module manager handling this module. You may keep a
reference to it if needed.ModuleExceptionprotected void returnOutput(java.io.InputStream cacheIn,
javax.servlet.http.HttpServletResponse resp)
throws java.io.IOException
CachedActionWrites a page read from an input stream into an HTTP servlet response. The input stream might be coming from a cached file, or directly from the doOutput method if caching is not in use. In any case, the contents of it need to be written to the response object. Note that any HTTP headers must be set before writing anything else.
If you used writeMetadata in doOutput, you have to override this method and use readMetadata correspondingly to read the metadata from the start of the stream. You can then, for example, set any HTTP headers you read from the metadata. After this, you can call this super implementation which will do the rest of the stream copying.
Make absolutely certain that the input stream is closed before returning from this method. Failing to do so may cause the caching service to become locked which can then lock the whole application. It is best to put the contents in a try-finally block and then call cacheIn.close in the finally part. Do this even if you call the super implementation as your code could possibly fail before reaching that part.
returnOutput in class CachedActionjava.io.IOExceptionprotected java.lang.String outputTopics(java.lang.String query,
java.lang.String outputMode,
TopicMap tm)
throws TopicMapException,
ActionException
TopicMapExceptionActionExceptionprotected boolean doOutput(javax.servlet.http.HttpServletRequest req,
ModulesServlet.HttpMethod method,
java.lang.String action,
CachedAction.OutputProvider out,
User user)
throws javax.servlet.ServletException,
java.io.IOException,
ActionException
CachedActionDoes the output that might be either cached or returned directly. The OutputProvider is used to get the output stream where the output should be written. Before you get this stream, you may abort the action by returning false but after the output stream is retrieved, you are committed to outputting the page that then might be cached for future use. Therefore you should do all the preparations first, and only then get the output stream when you know that you will be able to output something sensible.
If you opened the output stream using the output provider, you must make sure that the stream is properly closed. It is best to place all your code after this in a try-finally block and close the stream in the finally part. Failing to do this may cause the caching service to become locked, which in turn could potentially lock the whole application.
doOutput in class CachedActionjavax.servlet.ServletExceptionjava.io.IOExceptionActionExceptionprotected java.util.LinkedHashMap<java.lang.String,java.lang.String> getCacheKeyParams(javax.servlet.http.HttpServletRequest req,
ModulesServlet.HttpMethod method,
java.lang.String action)
throws ActionException
ActionExceptionprotected java.lang.String getCacheKey(javax.servlet.http.HttpServletRequest req,
ModulesServlet.HttpMethod method,
java.lang.String action)
CachedActiongetCacheKey in class CachedActionreq - The HTTP request which, result of which is to be cached.method - The method of the HTTP request.action - The parsed action parameter from the request.protected void trimLastComma(java.lang.StringBuilder sb)
Copyright 2004-2015 Wandora Team