public interface BayeuxContext
The Bayeux Context provides information about the current context of a Bayeux message.
This information may be from an associated HTTP request, or from a HTTP request originally used to establish the connection to the server (for example in a WebSocket upgrade).
-
Method Summary
Modifier and TypeMethodDescriptiongetContextAttribute(String name) getHeaderValues(String name) getParameter(String name) getParameterValues(String name) getRequestAttribute(String name) getSessionAttribute(String name) Returns an HTTP session attribute value.Returns the HTTP session id, ornullif there is no HTTP session.getURL()booleanisSecure()booleanisUserInRole(String role)
-
Method Details
-
getUserPrincipal
Principal getUserPrincipal()- Returns:
- the user
Principal(if any)
-
isUserInRole
- Parameters:
role- the role to check whether the user belongs to- Returns:
- true if there is a known user and they are in the given role
-
getRemoteAddress
SocketAddress getRemoteAddress()- Returns:
- the remote socket address
-
getLocalAddress
SocketAddress getLocalAddress()- Returns:
- the local socket address
-
getHeader
- Parameters:
name- the name of the request header- Returns:
- the value of the header, or
nullif there is no such header
-
getHeaderValues
- Parameters:
name- the name of the request header- Returns:
- the values of the header, or
nullif no such header
-
getParameter
- Parameters:
name- the name of the query parameter- Returns:
- the value of the query parameter, or
nullif no such parameter
-
getParameterValues
- Parameters:
name- the name of the query parameter- Returns:
- the values of the query parameter, or
nullif no such parameter
-
getCookie
- Parameters:
name- the name of the cookie- Returns:
- the value of the cookie value, or
nullif no such cookie
-
getContextAttribute
- Parameters:
name- the context attribute name- Returns:
- the context attribute value, or
nullif no such attribute
-
getRequestAttribute
- Parameters:
name- the request attribute name- Returns:
- the request attribute value, or
nullif no such attribute
-
getSessionId
String getSessionId()Returns the HTTP session id, or
nullif there is no HTTP session.- Returns:
- the HTTP session id, or
nullif there is no HTTP session
-
getSessionAttribute
Returns an HTTP session attribute value.
Session.getAttribute(String)should be used to retrieve attribute values in session scope.- Parameters:
name- the HTTP session attribute name- Returns:
- the HTTP session attribute value, or
nullif no such attribute
-
getContextPath
String getContextPath()- Returns:
- the web application context path
-
getURL
String getURL()- Returns:
- the full request URI complete with query string if present
-
getLocales
-
getProtocol
String getProtocol()- Returns:
- a string containing the protocol name and version number
-
isSecure
boolean isSecure()- Returns:
- whether the request was made over a secure transport
-