public interface ServiceErrorWriter
HttpServletResponse
or in an error summary.Modifier and Type | Method and Description |
---|---|
java.lang.String |
getErrorDetailsMIMEType()
Get the MIME type of the error details written by
writeError(Throwable, ErrorSummary, UWSJob, OutputStream) in the error summary. |
boolean |
writeError(java.lang.String message,
ErrorType type,
int httpErrorCode,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
java.lang.String reqID,
JobOwner user,
java.lang.String action)
Write the described error in the given response.
|
void |
writeError(java.lang.Throwable t,
ErrorSummary error,
UWSJob job,
java.io.OutputStream output)
Write the given error in the given output stream.
|
boolean |
writeError(java.lang.Throwable t,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
java.lang.String reqID,
JobOwner user,
java.lang.String action)
Write the given exception in the given response.
|
boolean writeError(java.lang.Throwable t, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request, java.lang.String reqID, JobOwner user, java.lang.String action)
Write the given exception in the given response.
Note: If this function is called without at least an exception and an HTTP response, nothing should be done. No error may be thrown.
IMPORTANT:
If any IOException
occurs while writing the error in the given HttpServletResponse
output stream,
this function should stop and return false
. In such case, the error which was supposed to be written
may be logged.
t
- Exception to write/format.response
- Response in which the given exception must be written.request
- Request at the origin of the error (MAY BE NULL).reqID
- ID of the request (which let the user and the administrator identify the failed request). (MAY BE NULL if the request is not provided)user
- User which sends the given request (which generates the error) (MAY BE NULL).action
- Type/Name of the action which generates the error (MAY BE NULL).HttpServletResponse
,
false otherwise.boolean writeError(java.lang.String message, ErrorType type, int httpErrorCode, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request, java.lang.String reqID, JobOwner user, java.lang.String action)
Write the described error in the given response.
Note: If this function is called without at least a message and an HTTP response, nothing should be done. No error may be thrown.
IMPORTANT:
If any IOException
occurs while writing the error in the given HttpServletResponse
output stream,
this function should stop and return false
. In such case, the error which was supposed to be written
may be logged.
message
- Message to display.type
- Type of the error: FATAL or TRANSIENT.httpErrorCode
- HTTP error code (i.e. 404, 500).response
- Response in which the described error must be written.request
- Request which causes this error.reqID
- ID of the request (which let the user and the administrator identify the failed request).user
- User which sends the HTTP request.action
- Action corresponding to the given request.HttpServletResponse
,
false otherwise.void writeError(java.lang.Throwable t, ErrorSummary error, UWSJob job, java.io.OutputStream output) throws java.io.IOException
Write the given error in the given output stream.
This function is used only for the error summary of a job (that's to say to report in the ../error/details parameter any error which occurs while executing a job).
Important note:
The error details written in the given output MUST always have the same MIME type.
This latter MUST be returned by getErrorDetailsMIMEType()
.
t
- Error to write. If error is not null, it will be displayed instead of the message of this throwable.error
- Summary of the error. It may particularly contain a message different from the one of the given exception. In this case, it will displayed instead of the exception's message.job
- The job which fails.output
- Stream in which the error must be written.java.io.IOException
- If there an error while writing the error in the given stream.getErrorDetailsMIMEType()
java.lang.String getErrorDetailsMIMEType()
Get the MIME type of the error details written by writeError(Throwable, ErrorSummary, UWSJob, OutputStream)
in the error summary.
Important note: If NULL is returned, the MIME type will be considered as text/plain.
writeError(Throwable, ErrorSummary, UWSJob, OutputStream)