congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RawHttp.createBodyReader
Code IndexAdd Tabnine to your IDE (free)

How to use
createBodyReader
method
in
rawhttp.core.RawHttp

Best Java code snippets using rawhttp.core.RawHttp.createBodyReader (Showing top 4 results out of 315)

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

/**
 * 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

/**
 * Parses the HTTP request produced by the given stream.
 *
 * @param inputStream   producing a HTTP request
 * @param senderAddress the address of the request sender, if known
 * @return a parsed HTTP request object
 * @throws InvalidHttpRequest if the request is invalid
 * @throws IOException        if a problem occurs accessing the stream
 */
public RawHttpRequest parseRequest(InputStream inputStream,
                  @Nullable InetAddress senderAddress) throws IOException {
  RequestLine requestLine = metadataParser.parseRequestLine(inputStream);
  RawHttpHeaders originalHeaders = metadataParser.parseHeaders(inputStream, (message, lineNumber) ->
      // add 1 to the line number to correct for the start-line
      new InvalidHttpRequest(message, lineNumber + 1));
  RawHttpHeaders.Builder modifiableHeaders = RawHttpHeaders.newBuilder(originalHeaders);
  // do a little cleanup to make sure the request is actually valid
  requestLine = verifyHost(requestLine, modifiableHeaders);
  RawHttpHeaders headers = modifiableHeaders.build();
  @Nullable BodyReader bodyReader = requestHasBody(headers)
      ? createBodyReader(inputStream, requestLine, headers)
      : null;
  return new RawHttpRequest(requestLine, headers, bodyReader, senderAddress);
}
origin: com.athaydes.rawhttp/rawhttp-core

/**
 * Parses the HTTP request produced by the given stream.
 *
 * @param inputStream   producing a HTTP request
 * @param senderAddress the address of the request sender, if known
 * @return a parsed HTTP request object
 * @throws InvalidHttpRequest if the request is invalid
 * @throws IOException        if a problem occurs accessing the stream
 */
public RawHttpRequest parseRequest(InputStream inputStream,
                  @Nullable InetAddress senderAddress) throws IOException {
  RequestLine requestLine = metadataParser.parseRequestLine(inputStream);
  RawHttpHeaders originalHeaders = metadataParser.parseHeaders(inputStream, (message, lineNumber) ->
      // add 1 to the line number to correct for the start-line
      new InvalidHttpRequest(message, lineNumber + 1));
  RawHttpHeaders.Builder modifiableHeaders = RawHttpHeaders.newBuilder(originalHeaders);
  // do a little cleanup to make sure the request is actually valid
  requestLine = verifyHost(requestLine, modifiableHeaders);
  RawHttpHeaders headers = modifiableHeaders.build();
  @Nullable BodyReader bodyReader = requestHasBody(headers)
      ? createBodyReader(inputStream, requestLine, headers)
      : null;
  return new RawHttpRequest(requestLine, headers, bodyReader, senderAddress);
}
rawhttp.coreRawHttpcreateBodyReader

Popular methods of RawHttp

  • <init>
    Create a configured instance of RawHttp.
  • parseRequest
    Parses the given HTTP request.
  • parseResponse
    Parses the given HTTP response.
  • getFramedBody
    Get the framed body of a HTTP message with the given start-line and headers. This method assumes th
  • requestHasBody
    Determines whether a request with the given headers should have a body.
  • responseHasBody
    Determines whether a response with the given status-line should have a body. If provided, the reques
  • startsWith
  • verifyHost
  • waitForPortToBeTaken
    Wait for the given port to be taken before proceeding. This is useful for waiting for a server to cl

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now