private static final class RestCsrfPreventionFilter.ServletFilterHttpInteraction extends Object implements RestCsrfPreventionFilter.HttpInteraction
RestCsrfPreventionFilter.HttpInteraction
implementation for use in the servlet filter.Modifier and Type | Field and Description |
---|---|
private javax.servlet.FilterChain |
chain |
private javax.servlet.http.HttpServletRequest |
httpRequest |
private javax.servlet.http.HttpServletResponse |
httpResponse |
Constructor and Description |
---|
ServletFilterHttpInteraction(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
javax.servlet.FilterChain chain)
Creates a new ServletFilterHttpInteraction.
|
Modifier and Type | Method and Description |
---|---|
String |
getHeader(String header)
Returns the value of a header.
|
String |
getMethod()
Returns the method.
|
void |
proceed()
Called by the filter after it decides that the request may proceed.
|
void |
sendError(int code,
String message)
Called by the filter after it decides that the request is a potential
CSRF attack and therefore must be rejected.
|
private final javax.servlet.FilterChain chain
private final javax.servlet.http.HttpServletRequest httpRequest
private final javax.servlet.http.HttpServletResponse httpResponse
public ServletFilterHttpInteraction(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, javax.servlet.FilterChain chain)
httpRequest
- request to processhttpResponse
- response to processchain
- filter chain to forward to if HTTP interaction is allowedpublic String getHeader(String header)
RestCsrfPreventionFilter.HttpInteraction
getHeader
in interface RestCsrfPreventionFilter.HttpInteraction
header
- name of headerpublic String getMethod()
RestCsrfPreventionFilter.HttpInteraction
getMethod
in interface RestCsrfPreventionFilter.HttpInteraction
public void proceed() throws IOException, javax.servlet.ServletException
RestCsrfPreventionFilter.HttpInteraction
proceed
in interface RestCsrfPreventionFilter.HttpInteraction
IOException
- if there is an I/O errorjavax.servlet.ServletException
- if the implementation relies on the servlet API
and a servlet API call has failedpublic void sendError(int code, String message) throws IOException
RestCsrfPreventionFilter.HttpInteraction
sendError
in interface RestCsrfPreventionFilter.HttpInteraction
code
- status code to sendmessage
- response messageIOException
- if there is an I/O errorCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.