org.openrdf.http.server
Class ServerInterceptor
java.lang.Object
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
org.openrdf.http.server.ServerInterceptor
- All Implemented Interfaces:
- org.springframework.web.servlet.HandlerInterceptor
- Direct Known Subclasses:
- ProtocolInterceptor, RepositoryInterceptor
public abstract class ServerInterceptor
- extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
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
|
Method Summary |
void |
afterCompletion(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler,
Exception exception)
|
protected void |
cleanUpResources()
Clean up resources used in handling this request. |
protected abstract String |
getThreadName()
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 org.springframework.web.servlet.handler.HandlerInterceptorAdapter |
postHandle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServerInterceptor
public ServerInterceptor()
preHandle
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- Overrides:
preHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
- Throws:
Exception
afterCompletion
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- Overrides:
afterCompletion in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
- Throws:
Exception
getThreadName
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
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
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
Copyright © 2001-2009 Aduna. All Rights Reserved.