Tabnine Logo
IServerInterceptor
Code IndexAdd Tabnine to your IDE (free)

How to use
IServerInterceptor
in
ca.uhn.fhir.rest.server.interceptor

Best Java code snippets using ca.uhn.fhir.rest.server.interceptor.IServerInterceptor (Showing top 12 results out of 315)

origin: jamesagnew/hapi-fhir

/**
 * This method may be invoked by user code to notify interceptors that a nested
 * operation is being invoked which is denoted by this request details.
 */
public void notifyIncomingRequestPreHandled(RestOperationTypeEnum theOperationType) {
  RequestDetails requestDetails = getRequestDetails();
  if (requestDetails == null) {
    return;
  }
  IRestfulServerDefaults server = requestDetails.getServer();
  if (server == null) {
    return;
  }
  List<IServerInterceptor> interceptors = server.getInterceptors();
  for (IServerInterceptor next : interceptors) {
    next.incomingRequestPreHandled(theOperationType, this);
  }
}
origin: jamesagnew/hapi-fhir

  boolean continueProcessing = next.incomingRequestPreProcessed(theRequest, theResponse);
  if (!continueProcessing) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
  boolean continueProcessing = next.incomingRequestPostProcessed(requestDetails, theRequest, theResponse);
  if (!continueProcessing) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
  IServerInterceptor next = getInterceptors().get(i);
  try {
    next.processingCompletedNormally(requestDetails);
  } catch (Throwable t) {
    ourLog.error("Failure in interceptor method", t);
  if (!next.handleException(requestDetails, e, theRequest, theResponse)) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
    return;
for (int i = getInterceptors().size() - 1; i >= 0; i--) {
  IServerInterceptor next = getInterceptors().get(i);
  exception = next.preProcessOutgoingException(requestDetails, e, theRequest);
  if (exception != null) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
  if (!next.handleException(requestDetails, exception, theRequest, theResponse)) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
    return;
origin: jamesagnew/hapi-fhir

@Override
public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws BaseServerResponseException, IOException {
  IBaseResource response = doInvokeServer(theServer, theRequest);
  Set<SummaryEnum> summaryMode = RestfulServerUtils.determineSummaryMode(theRequest);
  ResponseDetails responseDetails = new ResponseDetails();
  responseDetails.setResponseResource(response);
  responseDetails.setResponseCode(Constants.STATUS_HTTP_200_OK);
  HttpServletRequest servletRequest = null;
  HttpServletResponse servletResponse = null;
  if (theRequest instanceof ServletRequestDetails) {
    servletRequest = ((ServletRequestDetails) theRequest).getServletRequest();
    servletResponse = ((ServletRequestDetails) theRequest).getServletResponse();
  }
  for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
    IServerInterceptor next = theServer.getInterceptors().get(i);
    boolean continueProcessing = next.outgoingResponse(theRequest, response);
    if (!continueProcessing) {
      return null;
    }
    continueProcessing = next.outgoingResponse(theRequest, responseDetails, servletRequest, servletResponse);
    if (!continueProcessing) {
      return null;
    }
  }
  boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest);
  return theRequest.getResponse().streamResponseAsResource(responseDetails.getResponseResource(), prettyPrint, summaryMode, responseDetails.getResponseCode(), null, theRequest.isRespondGzip(), isAddContentLocationHeader());
}
origin: ca.uhn.hapi.fhir/hapi-fhir-server

  boolean continueProcessing = next.incomingRequestPreProcessed(theRequest, theResponse);
  if (!continueProcessing) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
  boolean continueProcessing = next.incomingRequestPostProcessed(requestDetails, theRequest, theResponse);
  if (!continueProcessing) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
  IServerInterceptor next = getInterceptors().get(i);
  try {
    next.processingCompletedNormally(requestDetails);
  } catch (Throwable t) {
    ourLog.error("Failure in interceptor method", t);
  if (!next.handleException(requestDetails, e, theRequest, theResponse)) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
    return;
for (int i = getInterceptors().size() - 1; i >= 0; i--) {
  IServerInterceptor next = getInterceptors().get(i);
  exception = next.preProcessOutgoingException(requestDetails, e, theRequest);
  if (exception != null) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
  if (!next.handleException(requestDetails, exception, theRequest, theResponse)) {
    ourLog.debug("Interceptor {} returned false, not continuing processing");
    return;
origin: jamesagnew/hapi-fhir

protected final Object invokeServerMethod(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) {
  // Handle server action interceptors
  RestOperationTypeEnum operationType = getRestOperationType(theRequest);
  if (operationType != null) {
    for (IServerInterceptor next : theServer.getInterceptors()) {
      ActionRequestDetails details = new ActionRequestDetails(theRequest);
      populateActionRequestDetailsForInterceptor(theRequest, details, theMethodParams);
      next.incomingRequestPreHandled(operationType, details);
    }
  }
  // Actually invoke the method
  try {
    Method method = getMethod();
    return method.invoke(getProvider(), theMethodParams);
  } catch (InvocationTargetException e) {
    if (e.getCause() instanceof BaseServerResponseException) {
      throw (BaseServerResponseException) e.getCause();
    }
    throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);
  } catch (Exception e) {
    throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);
  }
}
origin: jamesagnew/hapi-fhir

boolean continueProcessing = next.outgoingResponse(theRequest, outcome);
if (!continueProcessing) {
  return null;
continueProcessing = next.outgoingResponse(theRequest, responseDetails, servletRequest, servletResponse);
if (!continueProcessing) {
  return null;
origin: jamesagnew/hapi-fhir

public void notifyInterceptors(RestOperationTypeEnum theOperationType, ActionRequestDetails theRequestDetails) {
  if (theRequestDetails.getId() != null && theRequestDetails.getId().hasResourceType() && isNotBlank(theRequestDetails.getResourceType())) {
    if (theRequestDetails.getId().getResourceType().equals(theRequestDetails.getResourceType()) == false) {
      throw new InternalErrorException(
        "Inconsistent server state - Resource types don't match: " + theRequestDetails.getId().getResourceType() + " / " + theRequestDetails.getResourceType());
    }
  }
  if (theRequestDetails.getUserData().get(PROCESSING_SUB_REQUEST) == Boolean.TRUE) {
    theRequestDetails.notifyIncomingRequestPreHandled(theOperationType);
  }
  List<IServerInterceptor> interceptors = getConfig().getInterceptors();
  for (IServerInterceptor next : interceptors) {
    next.incomingRequestPreHandled(theOperationType, theRequestDetails);
  }
}
origin: ca.uhn.hapi.fhir/hapi-fhir-server

@Override
public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws BaseServerResponseException, IOException {
  IBaseResource response = doInvokeServer(theServer, theRequest);
  Set<SummaryEnum> summaryMode = RestfulServerUtils.determineSummaryMode(theRequest);
  ResponseDetails responseDetails = new ResponseDetails();
  responseDetails.setResponseResource(response);
  responseDetails.setResponseCode(Constants.STATUS_HTTP_200_OK);
  HttpServletRequest servletRequest = null;
  HttpServletResponse servletResponse = null;
  if (theRequest instanceof ServletRequestDetails) {
    servletRequest = ((ServletRequestDetails) theRequest).getServletRequest();
    servletResponse = ((ServletRequestDetails) theRequest).getServletResponse();
  }
  for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
    IServerInterceptor next = theServer.getInterceptors().get(i);
    boolean continueProcessing = next.outgoingResponse(theRequest, response);
    if (!continueProcessing) {
      return null;
    }
    continueProcessing = next.outgoingResponse(theRequest, responseDetails, servletRequest, servletResponse);
    if (!continueProcessing) {
      return null;
    }
  }
  boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theServer, theRequest);
  return theRequest.getResponse().streamResponseAsResource(responseDetails.getResponseResource(), prettyPrint, summaryMode, responseDetails.getResponseCode(), null, theRequest.isRespondGzip(), isAddContentLocationHeader());
}
origin: ca.uhn.hapi.fhir/hapi-fhir-server

/**
 * This method may be invoked by user code to notify interceptors that a nested
 * operation is being invoked which is denoted by this request details.
 */
public void notifyIncomingRequestPreHandled(RestOperationTypeEnum theOperationType) {
  RequestDetails requestDetails = getRequestDetails();
  if (requestDetails == null) {
    return;
  }
  IRestfulServerDefaults server = requestDetails.getServer();
  if (server == null) {
    return;
  }
  List<IServerInterceptor> interceptors = server.getInterceptors();
  for (IServerInterceptor next : interceptors) {
    next.incomingRequestPreHandled(theOperationType, this);
  }
}
origin: ca.uhn.hapi.fhir/hapi-fhir-server

boolean continueProcessing = next.outgoingResponse(theRequest, outcome);
if (!continueProcessing) {
  return null;
continueProcessing = next.outgoingResponse(theRequest, responseDetails, servletRequest, servletResponse);
if (!continueProcessing) {
  return null;
origin: ca.uhn.hapi.fhir/hapi-fhir-server

protected final Object invokeServerMethod(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) {
  // Handle server action interceptors
  RestOperationTypeEnum operationType = getRestOperationType(theRequest);
  if (operationType != null) {
    for (IServerInterceptor next : theServer.getInterceptors()) {
      ActionRequestDetails details = new ActionRequestDetails(theRequest);
      populateActionRequestDetailsForInterceptor(theRequest, details, theMethodParams);
      next.incomingRequestPreHandled(operationType, details);
    }
  }
  // Actually invoke the method
  try {
    Method method = getMethod();
    return method.invoke(getProvider(), theMethodParams);
  } catch (InvocationTargetException e) {
    if (e.getCause() instanceof BaseServerResponseException) {
      throw (BaseServerResponseException) e.getCause();
    }
    throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);
  } catch (Exception e) {
    throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);
  }
}
origin: ca.uhn.hapi.fhir/hapi-fhir-jpaserver-base

public void notifyInterceptors(RestOperationTypeEnum theOperationType, ActionRequestDetails theRequestDetails) {
  if (theRequestDetails.getId() != null && theRequestDetails.getId().hasResourceType() && isNotBlank(theRequestDetails.getResourceType())) {
    if (theRequestDetails.getId().getResourceType().equals(theRequestDetails.getResourceType()) == false) {
      throw new InternalErrorException(
        "Inconsistent server state - Resource types don't match: " + theRequestDetails.getId().getResourceType() + " / " + theRequestDetails.getResourceType());
    }
  }
  if (theRequestDetails.getUserData().get(PROCESSING_SUB_REQUEST) == Boolean.TRUE) {
    theRequestDetails.notifyIncomingRequestPreHandled(theOperationType);
  }
  List<IServerInterceptor> interceptors = getConfig().getInterceptors();
  for (IServerInterceptor next : interceptors) {
    next.incomingRequestPreHandled(theOperationType, theRequestDetails);
  }
}
ca.uhn.fhir.rest.server.interceptorIServerInterceptor

Javadoc

Provides methods to intercept requests and responses. Note that implementations of this interface may wish to use InterceptorAdapter in order to not need to implement every method.

See: See the server interceptor documentation for more information on how to use this class.

Most used methods

  • incomingRequestPreHandled
    Invoked before an incoming request is processed. Note that this method is called after the server ha
  • handleException
    This method is called upon any exception being thrown within the server's request processing code. T
  • incomingRequestPostProcessed
    This method is called just before the actual implementing server method is invoked.
  • incomingRequestPreProcessed
    This method is called before any other processing takes place for each incoming request. It may be u
  • outgoingResponse
    This method is called after the server implementation method has been called, but before any attempt
  • preProcessOutgoingException
    This method is called upon any exception being thrown within the server's request processing code. T
  • processingCompletedNormally
    This method is called after all processing is completed for a request, but only if the request compl

Popular in Java

  • Making http post requests using okhttp
  • compareTo (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • runOnUiThread (Activity)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now