Class ServerInterceptor

java.lang.Object
org.eclipse.rdf4j.http.server.ServerInterceptor
All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor
Direct Known Subclasses:
ProtocolInterceptor, RepositoryInterceptor

public abstract class ServerInterceptor extends Object implements org.springframework.web.servlet.HandlerInterceptor
Base class for single-use request interceptors. This implementation sets the thread name to something sensible at the start of the request handling and resets the name at the end. This is useful for logging frameworks that make use of thread names, such as Log4J. Should not be a singleton bean! Configure as inner bean in openrdf-servlet.xml
Author:
Herko ter Horst
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    void
    afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception exception)
     
    protected void
    Clean up resources used in handling this request.
    protected abstract String
    Determine the thread name to use.
    boolean
    preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler)
     
    protected void
    setRequestAttributes(javax.servlet.http.HttpServletRequest request)
    Set attributes for this request.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.web.servlet.HandlerInterceptor Link icon

    postHandle
  • Constructor Details Link icon

    • ServerInterceptor Link icon

      public ServerInterceptor()
  • Method Details Link icon

    • preHandle Link icon

      public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) throws Exception
      Specified by:
      preHandle in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • afterCompletion Link icon

      public void afterCompletion(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, Exception exception) throws Exception
      Specified by:
      afterCompletion in interface org.springframework.web.servlet.HandlerInterceptor
      Throws:
      Exception
    • getThreadName Link icon

      protected abstract String getThreadName() throws ServerHTTPException
      Determine the thread name to use. Called before the request is forwarded to a handler.
      Returns:
      a name that makes sense based on the request
      Throws:
      ServerHTTPException - if it was impossible to determine a name due to an internal error
    • setRequestAttributes Link icon

      protected void setRequestAttributes(javax.servlet.http.HttpServletRequest request) throws ClientHTTPException, ServerHTTPException
      Set attributes for this request. Called before the request is forwarded to a handler. By default, this method does nothing.
      Parameters:
      request - the request
      Throws:
      ClientHTTPException - if it was impossible to set one or more attributes due to a bad request on the part of the client
      ServerHTTPException - if it was impossible to set one or more attributes due to an internal error
    • cleanUpResources Link icon

      protected void cleanUpResources() throws ServerHTTPException
      Clean up resources used in handling this request. Called after the request is handled and a the view is rendered (or an exception has occurred). By default, this method does nothing.
      Throws:
      ServerHTTPException - if some resources could not be cleaned up because of an internal error