Tabnine Logo
RawHttp.requestHasBody
Code IndexAdd Tabnine to your IDE (free)

How to use
requestHasBody
method
in
rawhttp.core.RawHttp

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

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);
}
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);
}
rawhttp.coreRawHttprequestHasBody

Javadoc

Determines whether a request with the given headers should have a body.

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
  • createBodyReader
  • 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

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • addToBackStack (FragmentTransaction)
  • requestLocationUpdates (LocationManager)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Permission (java.security)
    Legacy security code; do not use.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • 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