Package com.yahoo.jdisc.http.filter
Class DiscFilterRequest
- java.lang.Object
-
- com.yahoo.jdisc.http.filter.DiscFilterRequest
-
- Direct Known Subclasses:
JdiscFilterRequest
public class DiscFilterRequest extends Object
The Request class on which all filters will operate upon.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DiscFilterRequest.ThreadLocalSimpleDateFormat
The set of SimpleDateFormat formats to use in getDateHeader().
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_HTTP_PORT
protected static int
DEFAULT_HTTPS_PORT
protected static DiscFilterRequest.ThreadLocalSimpleDateFormat[]
formats
protected static String
HTTPS_PREFIX
protected Map<String,List<String>>
untreatedParams
-
Constructor Summary
Constructors Constructor Description DiscFilterRequest(HttpRequest parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCookie(JDiscCookieWrapper cookie)
Can be called multiple times to add Cookiesvoid
addHeader(String name, String value)
Sets a header with the given name and value.RequestView
asRequestView()
void
clearCookies()
boolean
containsAttribute(String name)
Object
getAttribute(String name)
Enumeration<String>
getAttributeNames()
String
getCharacterEncoding()
Get character encodingList<X509Certificate>
getClientCertificateChain()
long
getConnectedAt(TimeUnit unit)
String
getContentType()
Returns the content-type for the requestList<Cookie>
getCookies()
long
getDateHeader(String name)
String
getHeader(String name)
Enumeration<String>
getHeaderNames()
List<String>
getHeaderNamesAsList()
Enumeration<String>
getHeaders(String name)
List<String>
getHeadersAsList(String name)
int
getIntHeader(String name)
String
getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.int
getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.String
getMethod()
String
getParameter(String name)
Map<String,List<String>>
getParameterMap()
Enumeration<String>
getParameterNames()
List<String>
getParameterNamesAsList()
Enumeration<String>
getParameterValues(String name)
List<String>
getParameterValuesAsList(String name)
HttpRequest
getParentRequest()
Deprecated, for removal: This API element is subject to removal in a future version.Use methods onDiscFilterRequest
instead to inspect requestString
getProtocol()
String
getQueryString()
Returns the query string that is contained in the request URL.String
getRemoteAddr()
Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.String
getRemoteHost()
Returns the hostName of remoteHost, or null if noneint
getRemotePort()
Returns the port of remote hostString
getRemoteUser()
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.String
getRequestedSessionId()
String
getRequestURI()
String
getScheme()
String
getServerName()
int
getServerPort()
List<Cookie>
getUntreatedCookies()
Returns the untreatedCookies from parent requestcom.yahoo.jdisc.HeaderFields
getUntreatedHeaders()
Returns the untreatedHeaders from parent requestMap<String,List<String>>
getUntreatedParams()
Returns a unmodifiable map of untreatedParameters from the parent request.URI
getUri()
Principal
getUserPrincipal()
HttpRequest.Version
getVersion()
JDiscCookieWrapper[]
getWrappedCookies()
static boolean
isMultipart(DiscFilterRequest request)
boolean
isSecure()
boolean
isUserInRole(String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role".void
removeAttribute(String name)
void
removeHeaders(String name)
void
setAttribute(String name, Object value)
void
setCharacterEncoding(String encoding)
Set character encodingvoid
setCookies(List<Cookie> cookies)
void
setHeaders(String name, String value)
Sets a header with the given name and value.void
setHeaders(String name, List<String> values)
Sets a header with the given name and value.void
setOverrideIsUserInRole(boolean overrideIsUserInRole)
void
setRemoteAddr(String remoteIpAddress)
Set the IP address of the remote client associated with this Request.void
setRemoteHost(String remoteAddr)
void
setRemoteUser(String remoteUser)
void
setScheme(String scheme, boolean isSecure)
Deprecated.void
setUri(URI uri)
Deprecated.void
setUserPrincipal(Principal principal)
void
setUserRoles(String[] roles)
-
-
-
Field Detail
-
HTTPS_PREFIX
protected static final String HTTPS_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_HTTP_PORT
protected static final int DEFAULT_HTTP_PORT
- See Also:
- Constant Field Values
-
DEFAULT_HTTPS_PORT
protected static final int DEFAULT_HTTPS_PORT
- See Also:
- Constant Field Values
-
formats
protected static DiscFilterRequest.ThreadLocalSimpleDateFormat[] formats
-
-
Constructor Detail
-
DiscFilterRequest
public DiscFilterRequest(HttpRequest parent)
-
-
Method Detail
-
getMethod
public String getMethod()
-
getVersion
public HttpRequest.Version getVersion()
-
getUri
public URI getUri()
-
setUri
@Deprecated public void setUri(URI uri)
Deprecated.
-
getParentRequest
@Deprecated(forRemoval=true, since="7.511") public HttpRequest getParentRequest()
Deprecated, for removal: This API element is subject to removal in a future version.Use methods onDiscFilterRequest
instead to inspect request
-
getRemoteAddr
public String getRemoteAddr()
Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
-
setRemoteAddr
public void setRemoteAddr(String remoteIpAddress)
Set the IP address of the remote client associated with this Request.
-
getLocalAddr
public String getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.
-
getAttributeNames
public Enumeration<String> getAttributeNames()
-
containsAttribute
public boolean containsAttribute(String name)
-
removeAttribute
public void removeAttribute(String name)
-
getParameterNames
public Enumeration<String> getParameterNames()
-
getParameterValues
public Enumeration<String> getParameterValues(String name)
-
getRemoteHost
public String getRemoteHost()
Returns the hostName of remoteHost, or null if none
-
getLocalPort
public int getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
-
getRemotePort
public int getRemotePort()
Returns the port of remote host
-
getUntreatedParams
public Map<String,List<String>> getUntreatedParams()
Returns a unmodifiable map of untreatedParameters from the parent request.
-
getUntreatedHeaders
public com.yahoo.jdisc.HeaderFields getUntreatedHeaders()
Returns the untreatedHeaders from parent request
-
getUntreatedCookies
public List<Cookie> getUntreatedCookies()
Returns the untreatedCookies from parent request
-
addHeader
public void addHeader(String name, String value)
Sets a header with the given name and value. If the header had already been set, the new value overwrites the previous one.
-
getDateHeader
public long getDateHeader(String name)
-
getHeaderNames
public Enumeration<String> getHeaderNames()
-
getHeaders
public Enumeration<String> getHeaders(String name)
-
removeHeaders
public void removeHeaders(String name)
-
setHeaders
public void setHeaders(String name, String value)
Sets a header with the given name and value. If the header had already been set, the new value overwrites the previous one.
-
setHeaders
public void setHeaders(String name, List<String> values)
Sets a header with the given name and value. If the header had already been set, the new value overwrites the previous one.
-
getIntHeader
public int getIntHeader(String name)
-
asRequestView
public RequestView asRequestView()
-
getConnectedAt
public long getConnectedAt(TimeUnit unit)
-
getProtocol
public String getProtocol()
-
getQueryString
public String getQueryString()
Returns the query string that is contained in the request URL. Returns the undecoded value uri.getRawQuery()
-
getRemoteUser
public String getRemoteUser()
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
-
getRequestURI
public String getRequestURI()
-
getRequestedSessionId
public String getRequestedSessionId()
-
getScheme
public String getScheme()
-
setScheme
@Deprecated public void setScheme(String scheme, boolean isSecure)
Deprecated.
-
getServerName
public String getServerName()
-
getServerPort
public int getServerPort()
-
getUserPrincipal
public Principal getUserPrincipal()
-
isSecure
public boolean isSecure()
-
isUserInRole
public boolean isUserInRole(String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
-
setOverrideIsUserInRole
public void setOverrideIsUserInRole(boolean overrideIsUserInRole)
-
setRemoteHost
public void setRemoteHost(String remoteAddr)
-
setRemoteUser
public void setRemoteUser(String remoteUser)
-
setUserPrincipal
public void setUserPrincipal(Principal principal)
-
getClientCertificateChain
public List<X509Certificate> getClientCertificateChain()
- Returns:
- The client certificate chain in ascending order of trust. The first certificate is the one sent from the client. Returns an empty list if the client did not provide a certificate.
-
setUserRoles
public void setUserRoles(String[] roles)
-
getContentType
public String getContentType()
Returns the content-type for the request
-
getCharacterEncoding
public String getCharacterEncoding()
Get character encoding
-
setCharacterEncoding
public void setCharacterEncoding(String encoding)
Set character encoding
-
addCookie
public void addCookie(JDiscCookieWrapper cookie)
Can be called multiple times to add Cookies
-
clearCookies
public void clearCookies()
-
getWrappedCookies
public JDiscCookieWrapper[] getWrappedCookies()
-
isMultipart
public static boolean isMultipart(DiscFilterRequest request)
-
-