public void makeLenient() { super.makeLenient(); setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.FALSE); } }
public void makeStrict() { super.makeStrict(); setParameters(PROTOCOL_STRICTNESS_PARAMETERS, Boolean.TRUE); }
/** * Returns the default * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager} * class. * @return {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager} * factory class. */ public Class getConnectionManagerClass() { return (Class) getParameter(CONNECTION_MANAGER_CLASS); }
/** * Sets {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager} * class to be used der default. * @param clazz * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager} * factory class. */ public void setConnectionManagerClass(Class clazz) { setParameter(CONNECTION_MANAGER_CLASS, clazz); }
/** * Sets the default charset to be used for writing content body, * when no charset explicitly specified. * @param charset The charset */ public void setContentCharset(String charset) { setParameter(HTTP_CONTENT_CHARSET, charset); }
/** * Sets the maximum number of connections allowed for this connection manager. * * @param maxTotalConnections the maximum number of connections allowed * * @deprecated Use {@link HttpConnectionManagerParams#setMaxTotalConnections(int)}, * {@link HttpConnectionManager#getParams()}. */ public void setMaxTotalConnections(int maxTotalConnections) { this.params.setMaxTotalConnections(maxTotalConnections); }
/** * Sets whether authentication should be attempted preemptively. * * @param value <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. */ public void setAuthenticationPreemptive(boolean value) { setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value); }
/** * Returns the virtual host name. * * @return The virtual host name */ public String getVirtualHost() { return (String) getParameter(HttpMethodParams.VIRTUAL_HOST); }
/** * Returns a hint the size of the underlying buffers used by the platform * for incoming network I/O. This value is a suggestion to the kernel from * the application about the size of buffers to use for the data to be received * over the socket. * * @return the hint size of the send buffer */ public int getReceiveBufferSize() { return getIntParameter(SO_RCVBUF, -1); }
/** * Sets the maximum number of connections allowed. * * @param maxTotalConnections The maximum number of connections allowed. * * @see #MAX_TOTAL_CONNECTIONS */ public void setMaxTotalConnections(int maxTotalConnections) { setIntParameter( HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, maxTotalConnections); }
/** * Creates a new collection of parameters with the collection returned * by {@link #getDefaultParams()} as a parent. The collection will defer * to its parent for a default value if a particular parameter is not * explicitly set in the collection itself. * * @see #getDefaultParams() */ public HttpMethodParams() { super(getDefaultParams()); }
/** * Returns the timeout in milliseconds used when retrieving an * {@link org.apache.commons.httpclient.HttpConnection HTTP connection} from the * {@link org.apache.commons.httpclient.HttpConnectionManager HTTP connection manager}. * * @return timeout in milliseconds. */ public long getConnectionManagerTimeout() { return getLongParameter(CONNECTION_MANAGER_TIMEOUT, 0); }
/** * Returns <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. * * @return <tt>true</tt> if authentication should be attempted preemptively, * <tt>false</tt> otherwise. */ public boolean isAuthenticationPreemptive() { return getBooleanParameter(PREEMPTIVE_AUTHENTICATION, false); }
/** * Sets the default socket timeout (<tt>SO_TIMEOUT</tt>) in milliseconds which is the * timeout for waiting for data. A timeout value of zero is interpreted as an infinite * timeout. This value is used when no socket timeout is set in the * {@link HttpMethodParams HTTP method parameters}. * * @param timeout Timeout in milliseconds */ public void setSoTimeout(int timeout) { setIntParameter(SO_TIMEOUT, timeout); }
/** * Tests whether stale connection check is to be used. Disabling * stale connection check may result in slight performance improvement * at the risk of getting an I/O error when executing a request over a * connection that has been closed at the server side. * * @return <tt>true</tt> if stale connection check is to be used, * <tt>false</tt> otherwise. */ public boolean isStaleCheckingEnabled() { return getBooleanParameter(STALE_CONNECTION_CHECK, true); }
/** * Gets the default HttpParams to be used. * * @return the value returned from <code>HttpParamsFactory#getDefaultParams()</code> * * @see HttpParamsFactory#getDefaultParams() */ public static HttpParams getDefaultParams() { return httpParamsFactory.getDefaultParams(); }
public synchronized HttpParams getDefaultParams() { if (httpParams == null) { httpParams = createParams(); } return httpParams; }
/** * Assigns the {@link CookiePolicy cookie policy} to be used by the * {@link org.apache.commons.httpclient.HttpMethod HTTP methods} * this collection of parameters applies to. * * @param policy the {@link CookiePolicy cookie policy} */ public void setCookiePolicy(String policy) { setParameter(COOKIE_POLICY, policy); }
/** * Returns linger-on-close timeout. Value <tt>0</tt> implies that the option is * disabled. Value <tt>-1</tt> implies that the JRE default is used. * * @return the linger-on-close timeout */ public int getLinger() { return getIntParameter(SO_LINGER, -1); }
/** * Returns a hint the size of the underlying buffers used by the platform for * outgoing network I/O. This value is a suggestion to the kernel from the * application about the size of buffers to use for the data to be sent over * the socket. * * @return the hint size of the send buffer */ public int getSendBufferSize() { return getIntParameter(SO_SNDBUF, -1); }