Package org.eclipse.rdf4j.http.server
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.servlet.HandlerInterceptor
postHandle
-
Constructor Details
-
ServerInterceptor
public ServerInterceptor()
-
-
Method Details
-
preHandle
-
afterCompletion
-
getThreadName
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
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 clientServerHTTPException
- if it was impossible to set one or more attributes due to an internal error
-
cleanUpResources
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
-