public class InterceptorAdapter extends Object implements IServerInterceptor
IServerInterceptor implementations. Provides a No-op implementation
of all methods, always returning trueIServerInterceptor.ActionRequestDetails| Constructor and Description |
|---|
InterceptorAdapter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
handleException(RequestDetails theRequestDetails,
BaseServerResponseException theException,
javax.servlet.http.HttpServletRequest theServletRequest,
javax.servlet.http.HttpServletResponse theServletResponse)
This method is called upon any exception being thrown within the server's request processing code.
|
boolean |
incomingRequestPostProcessed(RequestDetails theRequestDetails,
javax.servlet.http.HttpServletRequest theRequest,
javax.servlet.http.HttpServletResponse theResponse)
This method is called just before the actual implementing server method is invoked.
|
void |
incomingRequestPreHandled(RestOperationTypeEnum theOperation,
IServerInterceptor.ActionRequestDetails theProcessedRequest)
Invoked before an incoming request is processed
|
boolean |
incomingRequestPreProcessed(javax.servlet.http.HttpServletRequest theRequest,
javax.servlet.http.HttpServletResponse theResponse)
This method is called before any other processing takes place for each incoming request.
|
boolean |
outgoingResponse(RequestDetails theRequestDetails)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
boolean |
outgoingResponse(RequestDetails theRequestDetails,
Bundle bundle)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
boolean |
outgoingResponse(RequestDetails theRequestDetails,
Bundle theResponseObject,
javax.servlet.http.HttpServletRequest theServletRequest,
javax.servlet.http.HttpServletResponse theServletResponse)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
boolean |
outgoingResponse(RequestDetails theRequestDetails,
javax.servlet.http.HttpServletRequest theServletRequest,
javax.servlet.http.HttpServletResponse theServletResponse)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
boolean |
outgoingResponse(RequestDetails theRequestDetails,
IBaseResource theResponseObject)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
boolean |
outgoingResponse(RequestDetails theRequestDetails,
IBaseResource theResponseObject,
javax.servlet.http.HttpServletRequest theServletRequest,
javax.servlet.http.HttpServletResponse theServletResponse)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
boolean |
outgoingResponse(RequestDetails theRequestDetails,
TagList theResponseObject)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
boolean |
outgoingResponse(RequestDetails theRequestDetails,
TagList theResponseObject,
javax.servlet.http.HttpServletRequest theServletRequest,
javax.servlet.http.HttpServletResponse theServletResponse)
This method is called after the server implementation method has been called, but before any attempt to stream the
response back to the client
|
BaseServerResponseException |
preProcessOutgoingException(RequestDetails theRequestDetails,
Throwable theException,
javax.servlet.http.HttpServletRequest theServletRequest)
This method is called upon any exception being thrown within the server's request processing code.
|
public InterceptorAdapter()
public boolean handleException(RequestDetails theRequestDetails, BaseServerResponseException theException, javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletResponse theServletResponse) throws javax.servlet.ServletException, IOException
IServerInterceptorSearch and Read methods) as well as
any runtime exceptions thrown by the server itself. This also includes any AuthenticationExceptions
thrown.
Implementations of this method may choose to ignore/log/count/etc exceptions, and return true. In
this case, processing will continue, and the server will automatically generate an OperationOutcome. Implementations may also choose to provide their own response to the client. In this case, they
should return false, to indicate that they have handled the request and processing should stop.
handleException in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request. Note that the bean
properties are not all guaranteed to be populated, depending on how early during processing the
exception occurred.theServletRequest - The incoming requesttheServletResponse - The response. Note that interceptors may choose to provide a response (i.e. by calling
ServletResponse.getWriter()) but in that case it is important to return
false to indicate that the server itself should not also provide a response.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.javax.servlet.ServletException - If this exception is thrown, it will be re-thrown up to the container for handling.IOException - If this exception is thrown, it will be re-thrown up to the container for handling.public boolean incomingRequestPostProcessed(RequestDetails theRequestDetails, javax.servlet.http.HttpServletRequest theRequest, javax.servlet.http.HttpServletResponse theResponse) throws AuthenticationException
IServerInterceptorNote about exceptions:
incomingRequestPostProcessed in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request.theRequest - The incoming requesttheResponse - The response. Note that interceptors may choose to provide a response (i.e. by calling
ServletResponse.getWriter()) but in that case it is important to return false
to indicate that the server itself should not also provide a response.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.AuthenticationException - This exception may be thrown to indicate that the interceptor has detected an unauthorized access
attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.public void incomingRequestPreHandled(RestOperationTypeEnum theOperation, IServerInterceptor.ActionRequestDetails theProcessedRequest)
IServerInterceptorincomingRequestPreHandled in interface IServerInterceptortheOperation - The type of operation that the FHIR server has determined that the client is trying to invoketheProcessedRequest - An object which will be populated with the details which were extracted from the raw request by the
server, e.g. the FHIR operation type and the parsed resource body (if any).public boolean incomingRequestPreProcessed(javax.servlet.http.HttpServletRequest theRequest, javax.servlet.http.HttpServletResponse theResponse)
IServerInterceptorNote that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server)
incomingRequestPreProcessed in interface IServerInterceptortheRequest - The incoming requesttheResponse - The response. Note that interceptors may choose to provide a response (i.e. by calling
ServletResponse.getWriter()) but in that case it is important to return false
to indicate that the server itself should not also provide a response.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle theResponseObject, javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletResponse theServletResponse) throws AuthenticationException
IServerInterceptoroutgoingResponse in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, includingtheResponseObject - The actual object which is being streamed to the client as a responsetheServletRequest - The incoming requesttheServletResponse - The response. Note that interceptors may choose to provide a response (i.e. by calling
ServletResponse.getWriter()) but in that case it is important to return false
to indicate that the server itself should not also provide a response.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.AuthenticationException - This exception may be thrown to indicate that the interceptor has detected an unauthorized access
attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle bundle)
IServerInterceptoroutgoingResponse in interface IServerInterceptortrue if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.public boolean outgoingResponse(RequestDetails theRequestDetails, javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletResponse theServletResponse) throws AuthenticationException
IServerInterceptoroutgoingResponse in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request.theServletRequest - The incoming requesttheServletResponse - The response. Note that interceptors may choose to provide a response (i.e. by calling
ServletResponse.getWriter()) but in that case it is important to return false
to indicate that the server itself should not also provide a response.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.AuthenticationException - This exception may be thrown to indicate that the interceptor has detected an unauthorized access
attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.public boolean outgoingResponse(RequestDetails theRequestDetails)
IServerInterceptoroutgoingResponse in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.public boolean outgoingResponse(RequestDetails theRequestDetails, IBaseResource theResponseObject, javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletResponse theServletResponse) throws AuthenticationException
IServerInterceptoroutgoingResponse in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request.theResponseObject - The actual object which is being streamed to the client as a responsetheServletRequest - The incoming requesttheServletResponse - The response. Note that interceptors may choose to provide a response (i.e. by calling
ServletResponse.getWriter()) but in that case it is important to return false
to indicate that the server itself should not also provide a response.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.AuthenticationException - This exception may be thrown to indicate that the interceptor has detected an unauthorized access
attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.public boolean outgoingResponse(RequestDetails theRequestDetails, IBaseResource theResponseObject)
IServerInterceptoroutgoingResponse in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request.theResponseObject - The actual object which is being streamed to the client as a responsetrue if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject, javax.servlet.http.HttpServletRequest theServletRequest, javax.servlet.http.HttpServletResponse theServletResponse) throws AuthenticationException
IServerInterceptoroutgoingResponse in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request.theResponseObject - The actual object which is being streamed to the client as a responsetheServletRequest - The incoming requesttheServletResponse - The response. Note that interceptors may choose to provide a response (i.e. by calling
ServletResponse.getWriter()) but in that case it is important to return false
to indicate that the server itself should not also provide a response.true if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.AuthenticationException - This exception may be thrown to indicate that the interceptor has detected an unauthorized access
attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject)
IServerInterceptoroutgoingResponse in interface IServerInterceptortheRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
pulled out of the servlet request.theResponseObject - The actual object which is being streamed to the client as a responsetrue if processing should continue normally. This is generally the right thing to do.
If your interceptor is providing a response rather than letting HAPI handle the response normally, you
must return false. In this case, no further processing will occur and no further interceptors
will be called.public BaseServerResponseException preProcessOutgoingException(RequestDetails theRequestDetails, Throwable theException, javax.servlet.http.HttpServletRequest theServletRequest) throws javax.servlet.ServletException
IServerInterceptorSearch and Read methods) as well as
any runtime exceptions thrown by the server itself. This method is invoked for each interceptor (until one of them
returns a non-null response or the end of the list is reached), after which
IServerInterceptor.handleException(RequestDetails, BaseServerResponseException, HttpServletRequest, HttpServletResponse) is
called for each interceptor.
This may be used to add an OperationOutcome to a response, or to convert between exception types for any reason.
Implementations of this method may choose to ignore/log/count/etc exceptions, and return null. In
this case, processing will continue, and the server will automatically generate an OperationOutcome. Implementations may also choose to provide their own response to the client. In this case, they
should return a non-null, to indicate that they have handled the request and processing should stop.
preProcessOutgoingException in interface IServerInterceptornull if this interceptor is not trying to
modify the exception. For example, if this interceptor has nothing to do with exception processing, it
should always return null. If this interceptor adds an OperationOutcome to the exception, it
should return an exception.javax.servlet.ServletExceptionCopyright © 2014–2016 University Health Network. All rights reserved.