Class CDORestRequest
java.lang.Object
org.eclipse.emf.cdo.server.rest.CDORestRequest
Describes one HTTP request at the transport-neutral REST service boundary. The path is the raw encoded path relative
to the adapter's configured mount point; the query string remains in its encoded HTTP form so that the service can
reject malformed escapes consistently. Request headers are copied into an immutable, case-insensitive map so
transport-neutral extensions can inspect the original HTTP request metadata.
- Author:
- Eike Stepper
-
Constructor Summary
ConstructorsConstructorDescriptionCDORestRequest(String method, String path, String queryString, String contentType, InputStream body) Creates a request description for a single service invocation.CDORestRequest(String method, String path, String queryString, String contentType, InputStream body, Map<String, ? extends List<String>> headers) Creates a request description including its HTTP headers.CDORestRequest(String method, String path, String queryString, String contentType, InputStream body, Map<String, ? extends List<String>> headers, Principal principal) Creates a request description including headers and a principal asserted by a trusted transport integration. -
Method Summary
Modifier and TypeMethodDescriptiongetBody()Returns the caller-owned request body stream.Returns the media type supplied by the caller.Returns an immutable copy of all supplied HTTP headers.getHeaderValues(String name) Returns the values of one supplied HTTP header, matching its name without regard to case.Returns the normalized HTTP method used for route selection.getPath()Returns the raw encoded path relative to the configured mount point.Returns the optional principal supplied by a trusted transport integration.Returns the raw encoded query string so the REST service can apply consistent validation and decoding.
-
Constructor Details
-
CDORestRequest
public CDORestRequest(String method, String path, String queryString, String contentType, InputStream body) Creates a request description for a single service invocation.- Parameters:
method- the HTTP method, such asGETorPOST; it is normalized to upper casepath- the raw encoded path relative to the service mount, beginning with a slashqueryString- the raw query string, ornullwhen no query was suppliedcontentType- the request media type, ornullwhen the request has no bodybody- the body stream, ornullwhen the request has no body
-
CDORestRequest
public CDORestRequest(String method, String path, String queryString, String contentType, InputStream body, Map<String, ? extends List<String>> headers) Creates a request description including its HTTP headers.Header names are matched without regard to case, and both the map and its value lists are copied and made immutable. Header values are retained in their supplied order. Header metadata is untrusted unless an authenticator validates it.
- Parameters:
method- the HTTP method, such asGETorPOST; it is normalized to upper casepath- the raw encoded path relative to the service mount, beginning with a slashqueryString- the raw query string, ornullwhen no query was suppliedcontentType- the request media type, ornullwhen the request has no bodybody- the body stream, ornullwhen the request has no bodyheaders- the HTTP header names and values supplied by the transport- Throws:
NullPointerException- if a required request field, header name, or header value list isnull
-
CDORestRequest
public CDORestRequest(String method, String path, String queryString, String contentType, InputStream body, Map<String, ? extends List<String>> headers, Principal principal) Creates a request description including headers and a principal asserted by a trusted transport integration.The principal must come from a transport's standard authenticated-principal mechanism, such as a Jakarta Servlet container. A header that merely names a user must never be supplied as this value.
- Parameters:
method- the HTTP method, such asGETorPOST; it is normalized to upper casepath- the raw encoded path relative to the service mount, beginning with a slashqueryString- the raw query string, ornullwhen no query was suppliedcontentType- the request media type, ornullwhen the request has no bodybody- the body stream, ornullwhen the request has no bodyheaders- the HTTP header names and values supplied by the transportprincipal- an optional principal supplied by a trusted transport, ornull- Throws:
NullPointerException- if a required request field, header name, or header value list isnull
-
-
Method Details
-
getMethod
Returns the normalized HTTP method used for route selection.- Returns:
- the upper-case HTTP method
-
getPath
Returns the raw encoded path relative to the configured mount point.- Returns:
- a path beginning with a slash
-
getQueryString
Returns the raw encoded query string so the REST service can apply consistent validation and decoding.- Returns:
- the query string, or
nullwhen absent
-
getContentType
Returns the media type supplied by the caller.- Returns:
- the content type, or
nullwhen absent
-
getHeaders
-
getPrincipal
Returns the optional principal supplied by a trusted transport integration.- Returns:
- the trusted principal, or
nullwhen the transport has not asserted one
-
getHeaderValues
Returns the values of one supplied HTTP header, matching its name without regard to case.- Parameters:
name- the header name to find- Returns:
- the ordered header values, or an empty list if the header was not supplied
- Throws:
NullPointerException- ifnameisnull
-
getBody
Returns the caller-owned request body stream. The service reads at most its configured request-size limit and does not close the stream.- Returns:
- the request body, or
nullwhen absent
-