Codota Logo
RawHttpResponse.<init>
Code IndexAdd Codota to your IDE (free)

How to use
rawhttp.core.RawHttpResponse
constructor

Best Java code snippets using rawhttp.core.RawHttpResponse.<init> (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: com.athaydes.rawhttp/rawhttp-core

/**
 * Create a copy of this HTTP response, replacing its statusLine with the provided one.
 *
 * @param statusLine to replace
 * @return copy of this HTTP message with the provided statusLine
 */
public RawHttpResponse<Response> withStatusLine(StatusLine statusLine) {
  return new RawHttpResponse<>(libResponse, request, statusLine,
      getHeaders(), getBody().orElse(null));
}
origin: renatoathaydes/rawhttp

/**
 * Create a copy of this HTTP response, replacing its statusLine with the provided one.
 *
 * @param statusLine to replace
 * @return copy of this HTTP message with the provided statusLine
 */
public RawHttpResponse<Response> withStatusLine(StatusLine statusLine) {
  return new RawHttpResponse<>(libResponse, request, statusLine,
      getHeaders(), getBody().orElse(null));
}
origin: com.athaydes.rawhttp/rawhttp-core

@Override
public RawHttpResponse<Response> withBody(HttpMessageBody body) {
  return new RawHttpResponse<>(libResponse, request, statusLine,
      body.headersFrom(getHeaders()), body.toBodyReader());
}
origin: renatoathaydes/rawhttp

@Override
public RawHttpResponse<Response> withBody(HttpMessageBody body) {
  return new RawHttpResponse<>(libResponse, request, statusLine,
      body.headersFrom(getHeaders()), body.toBodyReader());
}
origin: com.athaydes.rawhttp/rawhttp-core

@Override
public RawHttpResponse<Response> withHeaders(RawHttpHeaders headers, boolean append) {
  return new RawHttpResponse<>(libResponse, request, statusLine,
      append ? getHeaders().and(headers) : headers.and(getHeaders()),
      getBody().orElse(null));
}
origin: renatoathaydes/rawhttp

@Override
public RawHttpResponse<Response> withHeaders(RawHttpHeaders headers, boolean append) {
  return new RawHttpResponse<>(libResponse, request, statusLine,
      append ? getHeaders().and(headers) : headers.and(getHeaders()),
      getBody().orElse(null));
}
origin: renatoathaydes/rawhttp

/**
 * Parses the HTTP response produced by the given stream.
 *
 * @param inputStream producing a HTTP response
 * @param requestLine optional {@link RequestLine} of the request which results in this response.
 *                    If provided, it is taken into consideration when deciding whether the response contains
 *                    a body. See <a href="https://tools.ietf.org/html/rfc7230#section-3.3">Section 3.3</a>
 *                    of RFC-7230 for details.
 * @return a parsed HTTP response object
 * @throws InvalidHttpResponse if the response is invalid
 * @throws IOException         if a problem occurs accessing the stream
 */
public RawHttpResponse<Void> parseResponse(InputStream inputStream,
                      @Nullable RequestLine requestLine) throws IOException {
  StatusLine statusLine = metadataParser.parseStatusLine(inputStream);
  RawHttpHeaders headers = metadataParser.parseHeaders(inputStream, (message, lineNumber) ->
      // add 1 to the line number to correct for the start-line
      new InvalidHttpResponse(message, lineNumber + 1));
  @Nullable BodyReader bodyReader = responseHasBody(statusLine, requestLine)
      ? createBodyReader(inputStream, statusLine, headers)
      : null;
  return new RawHttpResponse<>(null, null, statusLine, headers, bodyReader);
}
origin: com.athaydes.rawhttp/rawhttp-core

/**
 * Parses the HTTP response produced by the given stream.
 *
 * @param inputStream producing a HTTP response
 * @param requestLine optional {@link RequestLine} of the request which results in this response.
 *                    If provided, it is taken into consideration when deciding whether the response contains
 *                    a body. See <a href="https://tools.ietf.org/html/rfc7230#section-3.3">Section 3.3</a>
 *                    of RFC-7230 for details.
 * @return a parsed HTTP response object
 * @throws InvalidHttpResponse if the response is invalid
 * @throws IOException         if a problem occurs accessing the stream
 */
public RawHttpResponse<Void> parseResponse(InputStream inputStream,
                      @Nullable RequestLine requestLine) throws IOException {
  StatusLine statusLine = metadataParser.parseStatusLine(inputStream);
  RawHttpHeaders headers = metadataParser.parseHeaders(inputStream, (message, lineNumber) ->
      // add 1 to the line number to correct for the start-line
      new InvalidHttpResponse(message, lineNumber + 1));
  @Nullable BodyReader bodyReader = responseHasBody(statusLine, requestLine)
      ? createBodyReader(inputStream, statusLine, headers)
      : null;
  return new RawHttpResponse<>(null, null, statusLine, headers, bodyReader);
}
origin: renatoathaydes/rawhttp

public RawHttpResponse<CloseableHttpResponse> send(RawHttpRequest request) throws IOException {
  RequestBuilder builder = RequestBuilder.create(request.getMethod());
  builder.setUri(request.getUri());
  builder.setVersion(toProtocolVersion(request.getStartLine().getHttpVersion()));
  request.getHeaders().getHeaderNames().forEach((name) ->
      request.getHeaders().get(name).forEach(value ->
          builder.addHeader(new BasicHeader(name, value))));
  request.getBody().ifPresent(b -> builder.setEntity(new InputStreamEntity(b.asRawStream())));
  CloseableHttpResponse response = httpClient.execute(builder.build());
  RawHttpHeaders headers = readHeaders(response);
  StatusLine statusLine = adaptStatus(response.getStatusLine());
  @Nullable LazyBodyReader body;
  if (response.getEntity() != null) {
    FramedBody framedBody = http.getFramedBody(statusLine, headers);
    body = new LazyBodyReader(framedBody, response.getEntity().getContent());
  } else {
    body = null;
  }
  return new RawHttpResponse<>(response, request, statusLine, headers, body);
}
rawhttp.coreRawHttpResponse<init>

Popular methods of RawHttpResponse

  • getBody
  • writeTo
  • eagerly
    Ensure that this response is read eagerly, downloading the full body if necessary. The returned obje
  • getHeaders
  • getStatusCode
  • withHeaders
  • getLibResponse
  • getRequest
  • getStartLine
  • withBody

Popular in Java

  • Updating database using SQL prepared statement
  • getContentResolver (Context)
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Table (org.hibernate.mapping)
    A relational table
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now