165 return new Request() {
166 private InputStream inputStream;
169 public String getMethod() {
170 return request.getRequestMethod();
174 public String getURI() {
176 return URLDecoder.decode(
request.getRequestURI().toString(),
"UTF-8");
177 }
catch (UnsupportedEncodingException e) {
178 throw new RuntimeException(
"Failed to decode request URI", e);
183 public String getRelativePath() {
184 return request.getRequestPath();
188 public boolean isSecure() {
189 return request.getRequestURI().getScheme().equals(
"https");
193 public String getFirstParam(String param) {
194 return request.getFirstParameterValue(param);
198 public String getQueryParamValue(String param) {
199 URI requestURI =
request.getRequestURI();
200 String query = requestURI.getQuery();
202 String[] parameters = query.split(
"&");
203 for (String parameter : parameters) {
204 String[] keyValue = parameter.split(
"=");
205 if (keyValue[0].equals(param)) {
214 public Cookie getCookie(
final String cookieName) {
215 List<HttpServerCookie> cookies =
request.getCookies();
217 if (cookies != null) {
218 for (HttpServerCookie cookie : cookies) {
219 if (cookie.getName().equals(cookieName)) {
220 return new Cookie(cookie.getName(), cookie.getValue(), cookie.getVersion(), cookie.getDomain(), cookie.getPath());
229 public String getHeader(String name) {
230 return request.getFirstRequestHeaderValue(name);
234 public List<String> getHeaders(String name) {
235 return request.getRequestHeaderValues(name);
239 public InputStream getInputStream() {
240 return getInputStream(
false);
244 public InputStream getInputStream(
boolean buffered) {
245 if (inputStream != null) {
250 return inputStream =
new BufferedInputStream(
request.getInputStream());
253 return request.getInputStream();
257 public String getRemoteAddr() {
258 InetSocketAddress sourceAddress =
request.getSourceAddress();
259 if (sourceAddress == null) {
262 InetAddress address = sourceAddress.getAddress();
263 if (address == null) {
267 return sourceAddress.getHostString();
269 return address.getHostAddress();
273 public void setError(AuthenticationError error) {
274 request.getScope(Scope.EXCHANGE).setAttachment(AuthenticationError.class.getName(), error);
278 public void setError(LogoutError error) {
279 request.getScope(Scope.EXCHANGE).setAttachment(LogoutError.class.getName(), error);
final HttpServerRequest request
Definition: ElytronHttpFacade.java:68