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

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Option (scala)
  • Top 17 Plugins for Android Studio
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