congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
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

  • Start an intent from android
  • getSystemService (Context)
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JOptionPane (javax.swing)
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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