|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uws.job.SerializableUWSObject uws.service.AbstractUWS<JL,J>
public abstract class AbstractUWS<JL extends JobList<J>,J extends AbstractJob>
An abstract facility to implement the Universal Worker Service pattern.
It can manage several jobs lists (create new, get and remove).
It also interprets HttpServletRequest
, applies the action specified in its given URL and parameters
(according to the IVOA Proposed Recommendation of 2010-02-10)
and returns the corresponding response in a HttpServletResponse
.
Any subclass of AbstractUWS
has one object called the UWS URL interpreter. It is stored in the field urlInterpreter
.
It lets interpreting the URL of any received request. Thus you can know on which jobs list, job and/or job attribute(s)
the request applies.
This interpreter must be initialized with the base URL/URI of this UWS. By using the default constructor (the one with no parameter),
the URL interpreter will be built at the first request (see UWSUrl.UWSUrl(HttpServletRequest)
) and so the base URI is
extracted directly from the request).
You want to set another base URI or to use a custom URL interpreter, you have to set yourself the interpreter
by using the method setUrlInterpreter(UWSUrl)
.
The most important abstract function of this class is createJob(Map)
. It allows to create an instance
of the type of job which is managed by this UWS. The only parameter is a map of a job attributes. It is the same map that
take the functions AbstractJob.AbstractJob(Map)
and AbstractJob.addOrUpdateParameters(Map)
.
There are two convenient implementations of this abstract method in BasicUWS
and ExtendedUWS
. These two implementations
are based on the Java Reflection.
All the actions described in the IVOA recommendation are already managed. Each of these actions are defined in
an instance of UWSAction
:
LIST_JOBS
: see the class ListJobs
ADD_JOB
: see the class AddJob
DESTROY_JOB
: see the class DestroyJob
JOB_SUMMARY
: see the class JobSummary
GET_JOB_PARAM
: see the class GetJobParam
SET_JOB_PARAM
: see the class SetJobParam
HOME_PAGE
: see the class ShowHomePage
However you can add your own UWS actions ! To do that you just need to implement the abstract class UWSAction
and to call the method addUWSAction(UWSAction)
with an instance of this implementation.
IMPORTANT: You must be careful when you override the function UWSAction.match(UWSUrl, String, HttpServletRequest)
so that your test is as precise as possible ! Indeed the order in which the actions of a UWS are evaluated is very important !
If you want to be sure your custom UWS action is always evaluated before any other UWS action you can use the function
addUWSAction(int, UWSAction)
with 0 as first parameter !
Note: You can also replace an existing UWS action thanks to the method replaceUWSAction(UWSAction)
or
setUWSAction(int, UWSAction)
!
Some UWS actions need to know the current user so that they can adapt their response (i.e. LIST_JOBS must return the jobs of only
one user: the current one). Thus, before executing a UWS action (and even before choosing the good action in function of the request)
the function UserIdentifier.extractUserId(UWSUrl, HttpServletRequest)
is called. Its goal
is to identify the current user in function of the received request.
Notes:
UserIdentifier
is an interface. So you must implement it and then set its extension to this UWS
by using setUserIdentifier(UserIdentifier)
.
One of the goals of a UWS is to manage an execution queue for all managed jobs. This task is given to an instance
of DefaultExecutionManager
, stored in the field executionManager
. Each time a job is created,
the UWS sets it the execution manager (see AddJob
). Thus the AbstractJob.start()
method will ask to the manager
whether it can execute now or whether it must be put in a QUEUED
phase until enough resources are available for its execution.
By extending the class DefaultExecutionManager
and by overriding DefaultExecutionManager.isReadyForExecution(AbstractJob)
you can change the condition which puts a job in the EXECUTING
or in the QUEUED
phase. By default, a job is put
in the QUEUED
phase if there are more running jobs than a given number.
With this manager it is also possible to list all running jobs in addition of all queued jobs, thanks to the methods:
DefaultExecutionManager.getRunningJobs()
, DefaultExecutionManager.getQueuedJobs()
, DefaultExecutionManager.getNbRunningJobs()
and DefaultExecutionManager.getNbQueuedJobs()
.
According to the IVOA recommendation, the XML format is the default format in which each UWS resource must be returned. However it
is told that other formats can also be managed. To allow that, AbstractUWS
manages a list of UWSSerializer
and
lets define which is the default one to use. By default, there are two serializers: XMLSerializer
(the default choice)
and JSONSerializer
.
One proposed way to choose automatically the format to use is to look at the Accept header of a HTTP-Request. This header field is
a list of MIME types (each one with a quality - a sort of priority). Thus each UWSSerializer
is associated with a MIME type so
that AbstractUWS
can choose automatically the preferred format and so, the serializer to use.
WARNING: Only one UWSSerializer
can be associated with a given MIME type in an AbstractUWS
instance !
Thus, if you add a UWSSerializer
to a UWS, and this UWS has already a serializer for the same MIME type,
it will be replaced by the added one.
Note: A XML document can be linked to a XSLT style-sheet. By using the method XMLSerializer.setXSLTPath(String)
you can define the path/URL of the XLST to link to each UWS resource.
Since the XMLSerializer
is the default format for a UWS resource you can also use the function
setXsltURL(String)
!
As for a job or a jobs list, a UWS is also a UWS resource. That's why it can also be serialized !
However in some cases it could more interesting to substitute this resource by a home page of the whole UWS by using the function:
setHomePage(String)
or setHomePage(URL, boolean)
.
Note: To go back to the UWS serialization (that is to say to abort a call to setHomePage(String)
),
use the method setDefaultHomePage()
!
AbstractJob
,
BasicUWS
,
ExtendedUWS
,
Serialized FormField Summary | |
---|---|
protected UWSSerializer |
choosenSerializer
The serializer choosen during the last call of executeRequest(HttpServletRequest, HttpServletResponse) . |
protected java.lang.String |
defaultSerializer
The MIME type of the default serialization format. |
protected java.lang.String |
description
Description of this UWS. |
protected UWSAction<JL,J> |
executedAction
The action executed during the last call of executeRequest(HttpServletRequest, HttpServletResponse) . |
protected java.lang.String |
homePage
URL of the home page. |
protected boolean |
homeRedirection
Indicates whether the home page must be a copy or a redirection to the given URL. |
protected java.util.Map<java.lang.String,JL> |
mapJobLists
List of all managed jobs lists. |
protected java.lang.String |
name
Name of this UWS. |
protected boolean |
reInitUrlInterpreter
Indicates whether the UWS URL interpreter must be re-initialize after each de-serialization. |
protected java.util.Map<java.lang.String,UWSSerializer> |
serializers
List of available serializers. |
protected UWSUrl |
urlInterpreter
The "interpreter" of UWS URLs. |
protected UserIdentifier |
userIdentifier
The object to use to extract the user ID from the received request. |
protected java.util.Vector<UWSAction<JL,J>> |
uwsActions
List of UWS actions (i.e. to list jobs, to get a job, to set a job parameter, etc...). |
Constructor Summary | |
---|---|
|
AbstractUWS()
Builds a UWS (the base URI will be extracted at the first request directly from the request itself). |
protected |
AbstractUWS(java.lang.String baseURI)
Builds a UWS with its base UWS URI. |
protected |
AbstractUWS(UWSUrl urlInterpreter)
Builds a UWS with the given UWS URL interpreter. |
Method Summary | |
---|---|
boolean |
addJobList(JL jl)
Adds a jobs list to this UWS. |
boolean |
addSerializer(UWSSerializer serializer)
Adds a serializer to this UWS WARNING: If there is already a serializer with the same MIME type in this UWS , it will be replaced by the given one ! |
boolean |
addUWSAction(int indAction,
UWSAction<JL,J> action)
Lets inserting the given action at the given position in the actions list of this UWS. |
boolean |
addUWSAction(UWSAction<JL,J> action)
Lets adding the given action to this UWS. |
abstract J |
createJob(java.util.Map<java.lang.String,java.lang.String> parameters)
Creates a job of the type (extension of AbstractJob ) which parameterized this implementation of AbstractUWS. |
void |
destroyAllJobLists()
Destroys all managed jobs lists. |
boolean |
destroyJobList(JL jl)
Destroys the given jobs list. |
boolean |
destroyJobList(java.lang.String name)
Destroys the specified jobs list. |
boolean |
executeRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Executes the given request according to the IVOA Proposed Recommendation of 2010-02-10. |
java.lang.String |
getBaseURI()
Gets the base UWS URL. |
UWSSerializer |
getChoosenSerializer()
Gets the serializer choosen during the last call of getSerializer(String) . |
java.lang.String |
getDefaultSerializer()
Gets the MIME type of the serializer to use by default. |
java.lang.String |
getDescription()
Gets the description of this UWS. |
DestructionManager |
getDestructionManager()
Gets the destruction manager. |
DestructionTimeController |
getDestructionTimeController()
Gets the object which lets the UWS controlling the destruction time of all managed jobs. |
UWSAction<JL,J> |
getExecutedAction()
Gets the UWS action executed during the last call of executeRequest(HttpServletRequest, HttpServletResponse) . |
ExecutionDurationController |
getExecutionDurationController()
Gets the object which lets the UWS controlling the execution duration of all managed jobs. |
ExecutionManager |
getExecutionManager()
Gets the execution manager. |
java.lang.String |
getHomePage()
Gets the URL of the resource which must be used as home page of this UWS. |
JL |
getJobList(java.lang.String name)
Lets retrieve a jobs list in function of its name. |
java.lang.String |
getName()
Gets the name of this UWS. |
int |
getNbJobList()
Gets the number of managed jobs lists. |
int |
getNbSerializers()
Gets the total number of serializers available in this UWS. |
int |
getNbUWSActions()
Gets the number of actions this UWS has. |
UWSSerializer |
getSerializer(java.lang.String mimeTypes)
Gets the serializer whose the MIME type is the same as the given one. |
java.util.Iterator<UWSSerializer> |
getSerializers()
Gets an iterator of the list of all serializers available in this UWS. |
UWSUrl |
getUrlInterpreter()
Gets the UWS URL interpreter of this UWS. |
UserIdentifier |
getUserIdentifier()
Gets the object which lets extracting the user ID from a received request. |
UWSAction<JL,J> |
getUWSAction(java.lang.String actionName)
Gets the action of this UWS which has the same name as the given one. |
java.util.Iterator<UWSAction<JL,J>> |
getUWSActions()
Gets all actions of this UWS. |
java.lang.String |
getXsltURL()
Gets the URL of the XSLT style-sheet that the XML serializer of this UWS is using. |
boolean |
hasSerializerFor(java.lang.String mimeType)
Tells whether this UWS has already a serializer with the given MIME type. |
boolean |
isDefaultHomePage()
Indicates whether the current home page is the default one (the UWS serialization) or if it has been specified manually using setHomePage(URL, boolean) . |
boolean |
isHomePageRedirection()
Tells whether a redirection to the specified home page must be done or not. |
java.util.Iterator<JL> |
iterator()
An iterator on the jobs lists list. |
void |
redirect(java.lang.String url,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sends a redirection (with the HTTP status code 303) to the given URL/URI into the given response. |
void |
removeAllJobLists()
Removes all managed jobs lists. |
boolean |
removeJobList(JL jl)
Removes the given jobs list from this UWS. |
JL |
removeJobList(java.lang.String name)
Removes the specified jobs list. |
UWSSerializer |
removeSerializer(java.lang.String mimeType)
Removes the serializer whose the MIME type is the same as the given one. |
UWSAction<JL,J> |
removeUWSAction(int indAction)
Removes the specified action from this UWS. |
UWSAction<JL,J> |
removeUWSAction(java.lang.String actionName)
Removes the action of this UWS which has the same name as the given one. |
UWSAction<JL,J> |
replaceUWSAction(UWSAction<JL,J> action)
Replaces the action which has the same name that the given action. |
void |
sendError(java.lang.Exception error,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Fills the response with the given error. |
void |
sendError(UWSException error,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Fills the response with the given error. |
java.lang.String |
serialize(UWSSerializer serializer,
java.lang.String ownerId)
Serializes the whole object considering the given owner ID (supposed to be the ID of the current user) and thanks to the given serializer. |
void |
setDefaultHomePage()
Forgets the home page specified by using setHomePage(URL, boolean) - if any -
and go back to the default home page (XML format). |
void |
setDefaultSerializer(java.lang.String mimeType)
Sets the MIME of the serializer to use by default. |
void |
setDescription(java.lang.String description)
Sets the description of this UWS. |
void |
setDestructionManager(DestructionManager newManager)
Sets its destruction manager. |
void |
setDestructionTimeController(DestructionTimeController controller)
Sets the object which lets the UWS controlling the destruction time of all managed jobs. |
void |
setExecutionDurationController(ExecutionDurationController controller)
Sets the object which lets the UWS controlling the execution duration of all managed jobs. |
void |
setExecutionManager(ExecutionManager newManager)
Sets its execution manager. |
void |
setHomePage(java.lang.String homePageURI)
Sets the URI of the resource which must be used as home page of this UWS. |
void |
setHomePage(java.net.URL homePageUrl,
boolean redirect)
Sets the URL of the resource which must be used as home page of this UWS. |
void |
setName(java.lang.String name)
Sets the name of this UWS. |
void |
setUrlInterpreter(UWSUrl urlInterpreter)
Sets the UWS URL interpreter to use in this UWS. |
void |
setUserIdentifier(UserIdentifier identifier)
Sets the object which lets extracting the use ID from a received request. |
boolean |
setUWSAction(int indAction,
UWSAction<JL,J> action)
Replaces the specified action by the given action. |
boolean |
setXsltURL(java.lang.String xsltPath)
Sets the URL of the XSLT style-sheet that the XML serializer of this UWS must use. |
void |
sync()
This method is called just after a de-serialization of this UWS. |
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent e)
Called by an HttpSession while adding an instance of AbstractUWS in its attributes list. |
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent e)
Called by an HttpSession while removing an instance of AbstractUWS from its attributes list. |
Methods inherited from class uws.job.SerializableUWSObject |
---|
serialize, serialize, serialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected java.lang.String description
protected final java.util.Map<java.lang.String,JL extends JobList<J>> mapJobLists
protected UWSUrl urlInterpreter
protected boolean reInitUrlInterpreter
protected final java.util.Map<java.lang.String,UWSSerializer> serializers
protected java.lang.String defaultSerializer
protected UWSSerializer choosenSerializer
executeRequest(HttpServletRequest, HttpServletResponse)
.
protected java.lang.String homePage
protected boolean homeRedirection
protected final java.util.Vector<UWSAction<JL extends JobList<J>,J extends AbstractJob>> uwsActions
protected UWSAction<JL extends JobList<J>,J extends AbstractJob> executedAction
executeRequest(HttpServletRequest, HttpServletResponse)
.
protected UserIdentifier userIdentifier
Constructor Detail |
---|
public AbstractUWS()
XMLSerializer
,
JSONSerializer
,
ListJobs
,
AddJob
,
DestroyJob
,
JobSummary
,
GetJobParam
,
SetJobParam
,
ShowHomePage
protected AbstractUWS(java.lang.String baseURI) throws UWSException
baseURI
- Base UWS URI.
UWSException
- If the given URI is null or empty.UWSUrl.UWSUrl(String)
protected AbstractUWS(UWSUrl urlInterpreter)
urlInterpreter
- The UWS URL interpreter to use in this UWS.Method Detail |
---|
public final void sync()
This method is called just after a de-serialization of this UWS. It re-initializes all the jobs lists.
JobList.sync()
public final java.lang.String getName()
public final void setName(java.lang.String name)
name
- Its new name.public final java.lang.String getDescription()
public final void setDescription(java.lang.String description)
description
- Its new description.public final java.lang.String getBaseURI()
UWSUrl.getBaseURI()
public final UWSUrl getUrlInterpreter()
public final void setUrlInterpreter(UWSUrl urlInterpreter)
urlInterpreter
- Its new UWS URL interpreter (may be null. In this case, it will be created from the next request ; see executeRequest(HttpServletRequest, HttpServletResponse)
).public final ExecutionDurationController getExecutionDurationController()
public final void setExecutionDurationController(ExecutionDurationController controller)
Sets the object which lets the UWS controlling the execution duration of all managed jobs.
Note: If the given controller is NULL, nothing is done.
controller
- Its new execution duration controller.public final DestructionTimeController getDestructionTimeController()
public final void setDestructionTimeController(DestructionTimeController controller)
Sets the object which lets the UWS controlling the destruction time of all managed jobs.
Note: If the given controller is NULL, nothing is done.
controller
- Its new destruction time controller.public final UserIdentifier getUserIdentifier()
public final void setUserIdentifier(UserIdentifier identifier)
identifier
- The UserIdentifier to use (may be null).public final DestructionManager getDestructionManager()
public final void setDestructionManager(DestructionManager newManager)
Sets its destruction manager.
Note: The given manager (even if NULL) is set for all managed jobs lists.
newManager
- Its new destruction manager.JobList.setDestructionManager(DestructionManager)
public final ExecutionManager getExecutionManager()
public final void setExecutionManager(ExecutionManager newManager) throws UWSException
Sets its execution manager.
Note: The execution manager is set for all managed jobs (whatever is their jobs list).
newManager
- Its new execution manager.
UWSException
- If the given manager is null
or if there is an error while setting the new execution manager to a job.AbstractJob.setExecutionManager(ExecutionManager)
public final java.lang.String getHomePage()
public final boolean isHomePageRedirection()
public final void setHomePage(java.net.URL homePageUrl, boolean redirect)
homePageUrl
- The URL of the home page (may be null).redirect
- true if a redirection to the specified resource must be done
or false to copy it.public final void setHomePage(java.lang.String homePageURI)
Sets the URI of the resource which must be used as home page of this UWS.
A redirection will always be done on the specified resource.
homePageURI
- The URL of the home page.public final boolean isDefaultHomePage()
setHomePage(URL, boolean)
.
public final void setDefaultHomePage()
setHomePage(URL, boolean)
- if any -
and go back to the default home page (XML format).
public final java.lang.String getDefaultSerializer()
public final void setDefaultSerializer(java.lang.String mimeType) throws UWSException
mimeType
- The MIME type (only one).
UWSException
- If there is no serializer with this MIME type available in this UWS.public final boolean addSerializer(UWSSerializer serializer)
Adds a serializer to this UWS
WARNING: If there is already a serializer with the same MIME type in this UWS , it will be replaced by the given one !
serializer
- The serializer to add.
UWSSerializer.getMimeType()
public final boolean hasSerializerFor(java.lang.String mimeType)
mimeType
- A MIME type (only one).
public final int getNbSerializers()
public final java.util.Iterator<UWSSerializer> getSerializers()
public final UWSSerializer getSerializer(java.lang.String mimeTypes) throws UWSException
Gets the serializer whose the MIME type is the same as the given one.
Note: If this UWS has no corresponding serializer, its default one will be returned !
mimeTypes
- The MIME type of the searched serializer (may be more than one MIME types
- comma separated ; see the format of the Accept header of a HTTP-Request).
UWSException
- If there is no corresponding serializer AND if the default serializer of this UWS can not be found.AcceptHeader.AcceptHeader(String)
,
AcceptHeader.getOrderedMimeTypes()
public final UWSSerializer getChoosenSerializer()
getSerializer(String)
.
public final UWSSerializer removeSerializer(java.lang.String mimeType)
mimeType
- MIME type of the serializer to remove.
public final java.lang.String getXsltURL()
public final boolean setXsltURL(java.lang.String xsltPath)
xsltPath
- The new XSLT URL.
public final java.util.Iterator<JL> iterator()
iterator
in interface java.lang.Iterable<JL extends JobList<J>>
Iterable.iterator()
public final JL getJobList(java.lang.String name)
name
- Name of the jobs list to get.
public final int getNbJobList()
public final boolean addJobList(JL jl)
jl
- The jobs list to add.
JobList.setUWS(AbstractUWS)
public final JL removeJobList(java.lang.String name)
name
- Name of the jobs list to remove.
removeJobList(JobList)
public boolean removeJobList(JL jl)
jl
- The jobs list to remove.
JobList.removeAll()
,
JobList.setUWS(AbstractUWS)
public final boolean destroyJobList(java.lang.String name)
name
- Name of the jobs list to destroy.
destroyJobList(JobList)
public boolean destroyJobList(JL jl)
jl
- The jobs list to destroy.
JobList.clear()
,
JobList.setUWS(AbstractUWS)
public final void removeAllJobLists()
removeJobList(String)
public final void destroyAllJobLists()
destroyJobList(String)
public final boolean addUWSAction(UWSAction<JL,J> action)
Lets adding the given action to this UWS.
WARNING: The action will be added at the end of the actions list of this UWS. That means, it will be evaluated (call of
the method UWSAction.match(UWSUrl, String, HttpServletRequest)
) lastly !
action
- The UWS action to add.
public final boolean addUWSAction(int indAction, UWSAction<JL,J> action) throws java.lang.ArrayIndexOutOfBoundsException
Lets inserting the given action at the given position in the actions list of this UWS.
indAction
- The index where the given action must be inserted.action
- The action to add.
java.lang.ArrayIndexOutOfBoundsException
- If the given index is incorrect (index < 0 || index >= uwsActions.size()).public final boolean setUWSAction(int indAction, UWSAction<JL,J> action) throws java.lang.ArrayIndexOutOfBoundsException
indAction
- Index of the action to replace.action
- The replacer.
java.lang.ArrayIndexOutOfBoundsException
- If the index is incorrect (index < 0 || index >= uwsActions.size()).public final UWSAction<JL,J> replaceUWSAction(UWSAction<JL,J> action)
action
- The replacer.
public final int getNbUWSActions()
public final UWSAction<JL,J> getUWSAction(java.lang.String actionName)
actionName
- The name of the searched action.
public final java.util.Iterator<UWSAction<JL,J>> getUWSActions()
public final UWSAction<JL,J> getExecutedAction()
executeRequest(HttpServletRequest, HttpServletResponse)
.
public final UWSAction<JL,J> removeUWSAction(int indAction) throws java.lang.ArrayIndexOutOfBoundsException
indAction
- The index of the UWS action to remove.
java.lang.ArrayIndexOutOfBoundsException
- If the given index is incorrect (index < 0 || index >= uwsActions.size()).public final UWSAction<JL,J> removeUWSAction(java.lang.String actionName)
actionName
- The name of the UWS to remove.
public abstract J createJob(java.util.Map<java.lang.String,java.lang.String> parameters) throws UWSException
AbstractJob
) which parameterized this implementation of AbstractUWS.
parameters
- The map of parameters to give to the constructor of AbstractJob
.
UWSException
- If any error occurs while creating the job.AddJob.apply(UWSUrl, String, HttpServletRequest, HttpServletResponse)
public boolean executeRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws UWSException, java.io.IOException
Executes the given request according to the IVOA Proposed Recommendation of 2010-02-10. The result is returned in the given response.
Here is the followed algorithm:
UWSUrl.load(HttpServletRequest)
)UserIdentifier.extractUserId(UWSUrl, HttpServletRequest)
)UWSAction.match(UWSUrl, String, HttpServletRequest)
and UWSAction.apply(UWSUrl, String, HttpServletRequest, HttpServletResponse)
)
request
- The UWS request.response
- The response of this request which will be edited by the found UWS actions.
UWSException
- If no action matches or if any error has occurred while applying the found action.
java.io.IOException
- If it is impossible to write in the given HttpServletResponse
.UWSUrl.UWSUrl(HttpServletRequest)
,
UWSUrl.load(HttpServletRequest)
,
UserIdentifier.extractUserId(UWSUrl, HttpServletRequest)
,
UWSAction.match(UWSUrl, String, HttpServletRequest)
,
UWSAction.apply(UWSUrl, String, HttpServletRequest, HttpServletResponse)
public void redirect(java.lang.String url, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, UWSException
Sends a redirection (with the HTTP status code 303) to the given URL/URI into the given response.
url
- The redirection URL/URI.request
- The HttpServletRequest
which may be used to make a redirection.response
- The HttpServletResponse
which must contain all information to make a redirection.
java.io.IOException
- If there is an error during the redirection.
UWSException
- If there is any other error.public void sendError(UWSException error, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, UWSException
Fills the response with the given error. The HTTP status code is set in function of the error code of the given UWSException.
If the error code is UWSException.SEE_OTHER
this method calls redirect(String, HttpServletRequest, HttpServletResponse)
.
Otherwise the function HttpServletResponse.sendError(int, String)
is called.
error
- The error to send/display.request
- The request which has caused the given error (not used by default).response
- The response in which the error must be published.
java.io.IOException
- If there is an error when calling redirect(String, HttpServletRequest, HttpServletResponse)
or HttpServletResponse.sendError(int, String)
.
UWSException
- If there is an error when calling redirect(String, HttpServletRequest, HttpServletResponse)
.redirect(String, HttpServletRequest, HttpServletResponse)
,
HttpServletResponse.sendError(int, String)
public void sendError(java.lang.Exception error, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, UWSException
Fills the response with the given error.
The stack trace of the error is printed on the standard output and then the function
HttpServletResponse.sendError(int, String)
is called with the HTTP status code is UWSException.INTERNAL_SERVER_ERROR
and the message of the given exception.
error
- The error to send/display.request
- The request which has caused the given error (not used by default).response
- The response in which the error must be published.
java.io.IOException
- If there is an error when calling HttpServletResponse.sendError(int, String)
.
UWSException
HttpServletResponse.sendError(int, String)
public java.lang.String serialize(UWSSerializer serializer, java.lang.String ownerId) throws UWSException
SerializableUWSObject
serialize
in class SerializableUWSObject
serializer
- The serializer to use.ownerId
- The ID of the current user.
UWSException
- If there is an error during the serialization.public void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
HttpSession
while adding an instance of AbstractUWS
in its attributes list.
valueBound
in interface javax.servlet.http.HttpSessionBindingListener
HttpSessionBindingListener.valueBound(javax.servlet.http.HttpSessionBindingEvent)
public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e)
HttpSession
while removing an instance of AbstractUWS
from its attributes list.
By default, all managed jobs lists are destroyed and so all running jobs are stopped and destroyed.
valueUnbound
in interface javax.servlet.http.HttpSessionBindingListener
HttpSessionBindingListener.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
,
removeAllJobLists()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |