Package ratpack.http

Examples of ratpack.http.Status


                  final Headers headers = new NettyHeadersBackedHeaders(response.headers());
                  String contentType = headers.get(HttpHeaderConstants.CONTENT_TYPE.toString());
                  ByteBuf responseBuffer = initBufferReleaseOnExecutionClose(response.content(), execution);
                  final ByteBufBackedTypedData typedData = new ByteBufBackedTypedData(responseBuffer, DefaultMediaType.get(contentType));

                  final Status status = new DefaultStatus(response.getStatus());

                  int maxRedirects = requestSpecBacking.getMaxRedirects();
                  String locationValue = headers.get("Location");

                  URI locationUrl = null;
                  if (locationValue != null) {
                    locationUrl = new URI(locationValue);
                  }

                  //Check for redirect and location header if it is follow redirect if we have request forwarding left
                  if (shouldRedirect(status) && maxRedirects > 0 && locationUrl != null) {
                    Action<? super RequestSpec> redirectRequestConfig = Action.join(requestConfigurer, s -> {
                      if (status.getCode() == 301 || status.getCode() == 302) {
                        s.method("GET");
                      }
                      s.redirects(maxRedirects - 1);
                    });
                    RequestAction requestAction = new RequestAction(redirectRequestConfig, locationUrl, execution, eventLoopGroup, byteBufAllocator, maxContentLengthBytes);
View Full Code Here

TOP

Related Classes of ratpack.http.Status

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.