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

How to use
startsWith
method
in
rawhttp.core.RawHttp

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

origin: com.athaydes.rawhttp/rawhttp-core

/**
 * Determines whether a response with the given status-line should have a body.
 * <p>
 * If provided, the request-line of the request which produced such response is taken into
 * consideration. See <a href="https://tools.ietf.org/html/rfc7230#section-3.3">Section 3.3</a>
 * of RFC-7230 for details.
 *
 * @param statusLine  status-line of response
 * @param requestLine request-line of request, if any
 * @return true if such response has a body, false otherwise
 */
public static boolean responseHasBody(StatusLine statusLine,
                   @Nullable RequestLine requestLine) {
  if (requestLine != null) {
    if (requestLine.getMethod().equalsIgnoreCase("HEAD")) {
      return false; // HEAD response must never have a body
    }
    if (requestLine.getMethod().equalsIgnoreCase("CONNECT") &&
        startsWith(2, statusLine.getStatusCode())) {
      return false; // CONNECT successful means start tunelling
    }
  }
  int statusCode = statusLine.getStatusCode();
  // All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
  // responses do not include a message body.
  boolean hasNoBody = startsWith(1, statusCode) || statusCode == 204 || statusCode == 304;
  return !hasNoBody;
}
origin: renatoathaydes/rawhttp

/**
 * Determines whether a response with the given status-line should have a body.
 * <p>
 * If provided, the request-line of the request which produced such response is taken into
 * consideration. See <a href="https://tools.ietf.org/html/rfc7230#section-3.3">Section 3.3</a>
 * of RFC-7230 for details.
 *
 * @param statusLine  status-line of response
 * @param requestLine request-line of request, if any
 * @return true if such response has a body, false otherwise
 */
public static boolean responseHasBody(StatusLine statusLine,
                   @Nullable RequestLine requestLine) {
  if (requestLine != null) {
    if (requestLine.getMethod().equalsIgnoreCase("HEAD")) {
      return false; // HEAD response must never have a body
    }
    if (requestLine.getMethod().equalsIgnoreCase("CONNECT") &&
        startsWith(2, statusLine.getStatusCode())) {
      return false; // CONNECT successful means start tunelling
    }
  }
  int statusCode = statusLine.getStatusCode();
  // All 1xx (Informational), 204 (No Content), and 304 (Not Modified)
  // responses do not include a message body.
  boolean hasNoBody = startsWith(1, statusCode) || statusCode == 204 || statusCode == 304;
  return !hasNoBody;
}
rawhttp.coreRawHttpstartsWith

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

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • From CI to AI: The AI layer in your organization
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