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);
/** * @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); }
/** * 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; }
this.effectiveVersion = HttpVersion.parse(versionStr);
long len = getRequestContentLength(); if (len < 0) { if (getEffectiveVersion().greaterEquals(HttpVersion.HTTP_1_1)) { addRequestHeader("Transfer-Encoding", "chunked"); } else {
/** * 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()); }
/** * 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; }
throw new ProtocolException("Invalid HTTP minor version number: " + s); return new HttpVersion(major, minor);
if (len < 0) if (response.getHttpVersion().lessEquals(HttpVersion.HTTP_1_0))
public RequestLine(final String method, final String uri, final String httpversion) throws ProtocolException { this(method, uri, HttpVersion.parse(httpversion)); }
long expectedLength = getResponseContentLength(); if (expectedLength == -1) { if (canHaveBody && this.effectiveVersion.greaterEquals(HttpVersion.HTTP_1_1)) { Header connectionHeader = responseHeaders.getFirstHeader("Connection"); String connectionDirective = null;
public String getEffectiveVersion() { String ver = null; if(this.method != null) { ver = this.method.getEffectiveVersion().toString(); } return ver; }
/** * 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; }
throw new ProtocolException("Invalid HTTP minor version number: " + s); return new HttpVersion(major, minor);
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);
@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; }
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); } } }
&& getEffectiveVersion().greaterEquals(HttpVersion.HTTP_1_1) && hasRequestContent())
/** * 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); }