Class RepositoryInterceptor
- java.lang.Object
-
- org.eclipse.rdf4j.http.server.ServerInterceptor
-
- org.eclipse.rdf4j.http.server.repository.RepositoryInterceptor
-
- All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor
public class RepositoryInterceptor extends ServerInterceptor
Interceptor for repository requests. Should not be a singleton bean! Configure as inner bean in openrdf-servlet.xml- Author:
- Herko ter Horst, Arjohn Kampman
-
-
Constructor Summary
Constructors Constructor Description RepositoryInterceptor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Repository
getRepository(javax.servlet.http.HttpServletRequest request)
static RepositoryConnection
getRepositoryConnection(javax.servlet.http.HttpServletRequest request)
Obtain a newRepositoryConnection
with suitable parser/writer configuration for handling the incoming HTTP request.static String
getRepositoryID(javax.servlet.http.HttpServletRequest request)
protected String
getThreadName()
Determine the thread name to use.boolean
preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse respons, Object handler)
void
setRepositoryManager(RepositoryManager repMan)
protected void
setRequestAttributes(javax.servlet.http.HttpServletRequest request)
Set attributes for this request.-
Methods inherited from class org.eclipse.rdf4j.http.server.ServerInterceptor
afterCompletion, cleanUpResources
-
-
-
-
Method Detail
-
setRepositoryManager
public void setRepositoryManager(RepositoryManager repMan)
-
preHandle
public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse respons, Object handler) throws Exception
- Specified by:
preHandle
in interfaceorg.springframework.web.servlet.HandlerInterceptor
- Overrides:
preHandle
in classServerInterceptor
- Throws:
Exception
-
getThreadName
protected String getThreadName()
Description copied from class:ServerInterceptor
Determine the thread name to use. Called before the request is forwarded to a handler.- Specified by:
getThreadName
in classServerInterceptor
- Returns:
- a name that makes sense based on the request
-
setRequestAttributes
protected void setRequestAttributes(javax.servlet.http.HttpServletRequest request) throws ClientHTTPException, ServerHTTPException
Description copied from class:ServerInterceptor
Set attributes for this request. Called before the request is forwarded to a handler. By default, this method does nothing.- Overrides:
setRequestAttributes
in classServerInterceptor
- 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
-
getRepositoryID
public static String getRepositoryID(javax.servlet.http.HttpServletRequest request)
-
getRepository
public static Repository getRepository(javax.servlet.http.HttpServletRequest request)
-
getRepositoryConnection
public static RepositoryConnection getRepositoryConnection(javax.servlet.http.HttpServletRequest request)
Obtain a newRepositoryConnection
with suitable parser/writer configuration for handling the incoming HTTP request. The caller of this method is responsible for closing the connection.- Parameters:
request
- theHttpServletRequest
for which aRepositoryConnection
is to be returned- Returns:
- a configured
RepositoryConnection
-
-