Tabnine Logo
HttpVersion
Code IndexAdd Tabnine to your IDE (free)

How to use
HttpVersion
in
org.apache.commons.httpclient

Best Java code snippets using org.apache.commons.httpclient.HttpVersion (Showing top 20 results out of 315)

origin: commons-httpclient/commons-httpclient

if (this.effectiveVersion.greaterEquals(HttpVersion.HTTP_1_1)) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Should NOT close connection, using " + this.effectiveVersion.toString());
    LOG.debug("Should close connection, using " + this.effectiveVersion.toString());
return this.effectiveVersion.lessEquals(HttpVersion.HTTP_1_0);
origin: commons-httpclient/commons-httpclient

/**
 * @see java.lang.Object#equals(java.lang.Object)
 */
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof HttpVersion)) {
    return false;
  }
  return equals((HttpVersion)obj);  
}
origin: commons-httpclient/commons-httpclient

/**
 * Compares this HTTP protocol version with another one.
 * 
 * @param anotherVer the version to be compared with.
 *  
 * @return a negative integer, zero, or a positive integer as this version is less than, 
 *    equal to, or greater than the specified version.     
 */
public int compareTo(HttpVersion anotherVer) {
  if (anotherVer == null) {
    throw new IllegalArgumentException("Version parameter may not be null"); 
  }
  int delta = getMajor() - anotherVer.getMajor();
  if (delta == 0) {
    delta = getMinor() - anotherVer.getMinor();
  }
  return delta;
}
origin: commons-httpclient/commons-httpclient

this.effectiveVersion = HttpVersion.parse(versionStr);
origin: commons-httpclient/commons-httpclient

long len = getRequestContentLength();
if (len < 0) {
  if (getEffectiveVersion().greaterEquals(HttpVersion.HTTP_1_1)) {
    addRequestHeader("Transfer-Encoding", "chunked");
  } else {
origin: commons-httpclient/commons-httpclient

/**
 * Returns the request line.
 * 
 * @param conn the {@link HttpConnection connection} used to execute
 *        this HTTP method
 * 
 * @return The request line.
 */
private String getRequestLine(HttpConnection conn) {
  return  HttpMethodBase.generateRequestLine(conn, getName(),
      getPath(), getQueryString(), this.effectiveVersion.toString());
}
origin: org.mule.transports/mule-transport-http

  httpVersion = HttpVersion.parse(httpMethod.getStatusLine().getHttpVersion());
  uri = httpMethod.getURI().toString();
  statusCode = String.valueOf(httpMethod.getStatusCode());
headers.put(HttpConnector.HTTP_VERSION_PROPERTY, httpVersion.toString());
if (enableCookies)
origin: commons-httpclient/commons-httpclient

/**
 * Test if the HTTP protocol version is equal to the given number.
 * 
 * @return <tt>true</tt> if HTTP protocol version is given to the given number, 
 *         <tt>false</tt> otherwise.
 */
public boolean equals(HttpVersion version) {
  return compareTo(version) == 0;  
}
origin: commons-httpclient/commons-httpclient

  throw new ProtocolException("Invalid HTTP minor version number: " + s);
return new HttpVersion(major, minor);
origin: org.mule.transports/mule-transport-http

if (len < 0)
  if (response.getHttpVersion().lessEquals(HttpVersion.HTTP_1_0))
origin: org.mule.transports/mule-transport-http

public RequestLine(final String method, final String uri, final String httpversion)
    throws ProtocolException
{
  this(method, uri, HttpVersion.parse(httpversion));
}
origin: commons-httpclient/commons-httpclient

long expectedLength = getResponseContentLength();
if (expectedLength == -1) {
  if (canHaveBody && this.effectiveVersion.greaterEquals(HttpVersion.HTTP_1_1)) {
    Header connectionHeader = responseHeaders.getFirstHeader("Connection");
    String connectionDirective = null;
origin: edu.ucar/netcdf

public String getEffectiveVersion()
{
  String ver = null;
  if(this.method != null) {
    ver = this.method.getEffectiveVersion().toString();
  }
  return ver;
}
origin: commons-httpclient/commons-httpclient

/**
 * Test if the HTTP protocol version is less or equal to the given number.
 * 
 * @return <tt>true</tt> if HTTP protocol version is less or equal to given to the 
 *         given number, <tt>false</tt> otherwise.
 */
public boolean lessEquals(HttpVersion version) {
  return compareTo(version) <= 0;
}
origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

  throw new ProtocolException("Invalid HTTP minor version number: " + s);
return new HttpVersion(major, minor);
origin: org.apache.commons/com.springsource.org.apache.commons.httpclient

if (this.effectiveVersion.greaterEquals(HttpVersion.HTTP_1_1)) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Should NOT close connection, using " + this.effectiveVersion.toString());
    LOG.debug("Should close connection, using " + this.effectiveVersion.toString());
return this.effectiveVersion.lessEquals(HttpVersion.HTTP_1_0);
origin: foxinmy/weixin4j

@Override
public HttpVersion getProtocol() {
  org.apache.commons.httpclient.HttpVersion version = httpMethod
      .getParams().getVersion();
  if (version == null) {
    return null;
  }
  Header connection = httpMethod.getResponseHeader("Connection");
  if (protocol == null) {
    protocol = new HttpVersion("HTTP", version.getMajor(),
        version.getMinor(), connection != null
            && KEEP_ALIVE.equalsIgnoreCase(connection
                .getValue()));
  }
  return protocol;
}
origin: org.mule.transports/mule-transport-http

private void setStatus(HttpResponse response, MuleMessage message) throws MuleException
{
  if(status != null)
  {
    try
    {
      response.setStatusLine(HttpVersion.parse(version), Integer.valueOf(parse(status, message)));
    }
    catch(ProtocolException e)
    {
      throw new DefaultMuleException(e);
    }
  }
}
origin: commons-httpclient/commons-httpclient

&& getEffectiveVersion().greaterEquals(HttpVersion.HTTP_1_1) 
&& hasRequestContent())
origin: commons-httpclient/commons-httpclient

/**
 * Returns <tt>true</tt> if version 1.1 of the HTTP protocol should be 
 * used per default, <tt>false</tt> if version 1.0 should be used.
 *
 * @return <tt>true</tt> to use HTTP/1.1, <tt>false</tt> to use 1.0
 * 
 * @deprecated Use {@link HttpMethodParams#getVersion()}
 */
public boolean isHttp11() {
  return this.params.getVersion().equals(HttpVersion.HTTP_1_1);
}
org.apache.commons.httpclientHttpVersion

Javadoc

HTTP version, as specified in RFC 2616.

HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of the protocol. The protocol versioning policy is intended to allow the sender to indicate the format of a message and its capacity for understanding further HTTP communication, rather than the features obtained via that communication. No change is made to the version number for the addition of message components which do not affect communication behavior or which only add to extensible field values. The <minor> number is incremented when the changes made to the protocol add features which do not change the general message parsing algorithm, but which may add to the message semantics and imply additional capabilities of the sender. The <major> number is incremented when the format of a message within the protocol is changed. See RFC 2145 [36] for a fuller explanation.

The version of an HTTP message is indicated by an HTTP-Version field in the first line of the message.

 
HTTP-Version   = "HTTP" "/" 1*DIGIT "." 1*DIGIT 

Note that the major and minor numbers MUST be treated as separate integers and that each MAY be incremented higher than a single digit. Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is lower than HTTP/12.3. Leading zeros MUST be ignored by recipients and MUST NOT be sent.

Most used methods

  • parse
    Parses the textual representation of the given HTTP protocol version.
  • toString
  • equals
    Test if the HTTP protocol version is equal to the given number.
  • lessEquals
    Test if the HTTP protocol version is less or equal to the given number.
  • getMajor
    Returns the major version number of the HTTP protocol.
  • getMinor
    Returns the minor version number of the HTTP protocol.
  • greaterEquals
    Test if the HTTP protocol version is greater or equal to the given number.
  • <init>
    Create an HTTP protocol version designator.
  • compareTo
    Compares this HTTP protocol version with another one.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JCheckBox (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • 21 Best IntelliJ Plugins
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