parameter names in interfaces, part 1
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@576068 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e06ad24e3d
commit
4c696dcc14
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* $HeadURL$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.auth.params;
|
||||
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
|
||||
|
||||
/**
|
||||
* Parameter names for HttpAuth.
|
||||
*
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface AuthPNames {
|
||||
|
||||
/**
|
||||
* Defines the charset to be used when encoding
|
||||
* {@link org.apache.http.auth.Credentials}.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* If not defined, then
|
||||
* {@link org.apache.http.params.HttpProtocolParams#HTTP_ELEMENT_CHARSET
|
||||
* HttpProtocolParams.HTTP_ELEMENT_CHARSET}
|
||||
* should be used.
|
||||
* </p>
|
||||
*/
|
||||
public static final String CREDENTIAL_CHARSET = "http.auth.credential-charset";
|
||||
|
||||
}
|
|
@ -43,49 +43,44 @@ import org.apache.http.protocol.HTTP;
|
|||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @see AuthPNames
|
||||
*/
|
||||
public final class AuthParams {
|
||||
|
||||
/**
|
||||
* Defines the charset to be used when encoding
|
||||
* {@link org.apache.http.auth.Credentials}.
|
||||
* If not defined then the
|
||||
* {@link org.apache.http.params.HttpProtocolParams#HTTP_ELEMENT_CHARSET
|
||||
* HttpProtocolParams.HTTP_ELEMENT_CHARSET}
|
||||
* should be used.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String CREDENTIAL_CHARSET = "http.protocol.credential-charset";
|
||||
|
||||
|
||||
private AuthParams() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the charset to be used when encoding
|
||||
* Obtains the charset for encoding
|
||||
* {@link org.apache.http.auth.Credentials}.
|
||||
* If not configured,
|
||||
* {@link HTTP#DEFAULT_PROTOCOL_CHARSET HTTP.DEFAULT_PROTOCOL_CHARSET}
|
||||
* is used instead.
|
||||
*
|
||||
* @return The charset
|
||||
*
|
||||
* @see AuthPNames#CREDENTIAL_CHARSET
|
||||
*/
|
||||
public static String getCredentialCharset(final HttpParams params) {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
String charset = (String) params.getParameter(CREDENTIAL_CHARSET);
|
||||
String charset = (String) params.getParameter
|
||||
(AuthPNames.CREDENTIAL_CHARSET);
|
||||
//@@@ TODO: inconsistent with JavaDoc in AuthPNames,
|
||||
//@@@ TODO: check HTTP_ELEMENT_CHARSET first, or fix JavaDocs
|
||||
if (charset == null) {
|
||||
charset = HTTP.DEFAULT_PROTOCOL_CHARSET;
|
||||
}
|
||||
return charset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the charset to be used when encoding {@link org.apache.http.auth.Credentials}.
|
||||
* Sets the charset to be used when encoding
|
||||
* {@link org.apache.http.auth.Credentials}.
|
||||
*
|
||||
* @param charset The charset
|
||||
*/
|
||||
|
@ -93,7 +88,7 @@ public final class AuthParams {
|
|||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
params.setParameter(CREDENTIAL_CHARSET, charset);
|
||||
params.setParameter(AuthPNames.CREDENTIAL_CHARSET, charset);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* $HeadURL$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.client.params;
|
||||
|
||||
|
||||
import org.apache.http.auth.params.AuthPNames;
|
||||
import org.apache.http.cookie.params.CookieSpecPNames;
|
||||
import org.apache.http.conn.params.ConnManagerPNames;
|
||||
import org.apache.http.conn.params.ConnConnectionPNames;
|
||||
import org.apache.http.conn.params.ConnRoutePNames;
|
||||
|
||||
|
||||
/**
|
||||
* Collected parameter names for the HttpClient module.
|
||||
* This interface combines the parameter definitions of the HttpClient
|
||||
* module and all dependency modules or informational units.
|
||||
* It does not define additional parameter names, but references
|
||||
* other interfaces defining parameter names.
|
||||
* <br/>
|
||||
* This interface is meant as a navigation aid for developers.
|
||||
* When referring to parameter names, you should use the interfaces
|
||||
* in which the respective constants are actually defined.
|
||||
*
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface AllClientPNames extends
|
||||
ClientPNames, AuthPNames, CookieSpecPNames,
|
||||
ConnConnectionPNames, ConnManagerPNames, ConnRoutePNames {
|
||||
|
||||
// no additional definitions
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* $HeadURL$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.client.params;
|
||||
|
||||
|
||||
/**
|
||||
* Parameter names for the HttpClient module.
|
||||
* This does not include parameters for informational units
|
||||
* HttpAuth, HttpCookie, or HttpConn.
|
||||
*
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface ClientPNames {
|
||||
|
||||
/**
|
||||
* Defines the timeout in milliseconds used when retrieving an instance of
|
||||
* {@link org.apache.http.conn.ManagedClientConnection} from the
|
||||
* {@link org.apache.http.conn.ClientConnectionManager}.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Long}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String CONNECTION_MANAGER_TIMEOUT = "http.connection-manager.timeout";
|
||||
|
||||
/**
|
||||
* Defines the class name of the default {@link org.apache.http.conn.ClientConnectionManager}
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String CONNECTION_MANAGER_FACTORY = "http.connection-manager.factory";
|
||||
|
||||
/**
|
||||
* Defines whether redirects should be handled automatically
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String HANDLE_REDIRECTS = "http.protocol.handle-redirects";
|
||||
|
||||
/**
|
||||
* Defines whether relative redirects should be rejected.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String REJECT_RELATIVE_REDIRECT = "http.protocol.reject-relative-redirect";
|
||||
|
||||
/**
|
||||
* Defines the maximum number of redirects to be followed.
|
||||
* The limit on number of redirects is intended to prevent infinite loops.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_REDIRECTS = "http.protocol.max-redirects";
|
||||
|
||||
/**
|
||||
* Defines whether circular redirects (redirects to the same location) should be allowed.
|
||||
* The HTTP spec is not sufficiently clear whether circular redirects are permitted,
|
||||
* therefore optionally they can be enabled
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String ALLOW_CIRCULAR_REDIRECTS = "http.protocol.allow-circular-redirects";
|
||||
|
||||
/**
|
||||
* Defines whether authentication should be handled automatically.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String HANDLE_AUTHENTICATION = "http.protocol.handle-authentication";
|
||||
|
||||
/**
|
||||
* Defines whether authentication should be attempted preemptively.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String PREEMPTIVE_AUTHENTICATION = "http.protocol.authentication-preemptive";
|
||||
|
||||
/**
|
||||
* The key used to look up the list of IDs of supported
|
||||
* {@link AuthPolicy authentication schemes} in their order of preference.
|
||||
* The scheme IDs are stored in a {@link java.util.Collection} as
|
||||
* instances of {@link java.lang.String}.
|
||||
*
|
||||
* <p>
|
||||
* If several schemes are returned in the <tt>WWW-Authenticate</tt>
|
||||
* or <tt>Proxy-Authenticate</tt> header, this parameter defines which
|
||||
* {@link AuthPolicy authentication schemes} takes precedence over others.
|
||||
* The first item in the collection represents the most preferred
|
||||
* {@link AuthPolicy authentication scheme}, the last item represents
|
||||
* the ID of the least preferred one.
|
||||
* </p>
|
||||
*/
|
||||
public static final String AUTH_SCHEME_PRIORITY = "http.protocol-auth-scheme-priority";
|
||||
|
||||
/**
|
||||
* Defines the name of the cookie specification to be used for HTTP state management.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String COOKIE_POLICY = "http.protocol.cookie-policy";
|
||||
|
||||
/**
|
||||
* Defines the virtual host name.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link org.apache.http.HttpHost}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String VIRTUAL_HOST = "http.virtual-host";
|
||||
|
||||
/**
|
||||
* Defines the request headers to be sent per default with each request.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link java.util.Collection}. The
|
||||
* collection is expected to contain {@link org.apache.http.Header}s.
|
||||
* </p>
|
||||
*/
|
||||
public static final String DEFAULT_HEADERS = "http.default-headers";
|
||||
|
||||
/**
|
||||
* Defines the default host. The default value will be used if the target host is
|
||||
* not explicitly specified in the request URI.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link org.apache.http.HttpHost}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String DEFAULT_HOST = "http.default-host";
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link Long}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String CONNECTION_MANAGER_TIMEOUT = "http.connection-manager.timeout";
|
||||
public static final String xxxCONNECTION_MANAGER_TIMEOUT = "http.connection-manager.timeout";
|
||||
|
||||
/**
|
||||
* Defines the class name of the default {@link org.apache.http.conn.ClientConnectionManager}
|
||||
|
@ -59,7 +59,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String CONNECTION_MANAGER_FACTORY = "http.connection-manager.factory";
|
||||
public static final String xxxCONNECTION_MANAGER_FACTORY = "http.connection-manager.factory";
|
||||
|
||||
/**
|
||||
* Defines whether redirects should be handled automatically
|
||||
|
@ -67,7 +67,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String HANDLE_REDIRECTS = "http.protocol.handle-redirects";
|
||||
public static final String xxxHANDLE_REDIRECTS = "http.protocol.handle-redirects";
|
||||
|
||||
/**
|
||||
* Defines whether relative redirects should be rejected.
|
||||
|
@ -75,7 +75,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String REJECT_RELATIVE_REDIRECT = "http.protocol.reject-relative-redirect";
|
||||
public static final String xxxREJECT_RELATIVE_REDIRECT = "http.protocol.reject-relative-redirect";
|
||||
|
||||
/**
|
||||
* Defines the maximum number of redirects to be followed.
|
||||
|
@ -84,7 +84,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_REDIRECTS = "http.protocol.max-redirects";
|
||||
public static final String xxxMAX_REDIRECTS = "http.protocol.max-redirects";
|
||||
|
||||
/**
|
||||
* Defines whether circular redirects (redirects to the same location) should be allowed.
|
||||
|
@ -94,7 +94,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String ALLOW_CIRCULAR_REDIRECTS = "http.protocol.allow-circular-redirects";
|
||||
public static final String xxxALLOW_CIRCULAR_REDIRECTS = "http.protocol.allow-circular-redirects";
|
||||
|
||||
/**
|
||||
* Defines whether authentication should be handled automatically.
|
||||
|
@ -102,7 +102,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String HANDLE_AUTHENTICATION = "http.protocol.handle-authentication";
|
||||
public static final String xxxHANDLE_AUTHENTICATION = "http.protocol.handle-authentication";
|
||||
|
||||
/**
|
||||
* Defines whether authentication should be attempted preemptively.
|
||||
|
@ -110,7 +110,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String PREEMPTIVE_AUTHENTICATION = "http.protocol.authentication-preemptive";
|
||||
public static final String xxxPREEMPTIVE_AUTHENTICATION = "http.protocol.authentication-preemptive";
|
||||
|
||||
/**
|
||||
* The key used to look up the list of IDs of supported
|
||||
|
@ -127,7 +127,7 @@ public class HttpClientParams {
|
|||
* the ID of the least preferred one.
|
||||
* </p>
|
||||
*/
|
||||
public static final String AUTH_SCHEME_PRIORITY = "http.protocol-auth-scheme-priority";
|
||||
public static final String xxxAUTH_SCHEME_PRIORITY = "http.protocol-auth-scheme-priority";
|
||||
|
||||
/**
|
||||
* Defines the name of the cookie specification to be used for HTTP state management.
|
||||
|
@ -135,7 +135,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String COOKIE_POLICY = "http.protocol.cookie-policy";
|
||||
public static final String xxxCOOKIE_POLICY = "http.protocol.cookie-policy";
|
||||
|
||||
/**
|
||||
* Defines the virtual host name.
|
||||
|
@ -143,7 +143,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link org.apache.http.HttpHost}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String VIRTUAL_HOST = "http.virtual-host";
|
||||
public static final String xxxVIRTUAL_HOST = "http.virtual-host";
|
||||
|
||||
/**
|
||||
* Defines the request headers to be sent per default with each request.
|
||||
|
@ -152,7 +152,7 @@ public class HttpClientParams {
|
|||
* collection is expected to contain {@link org.apache.http.Header}s.
|
||||
* </p>
|
||||
*/
|
||||
public static final String DEFAULT_HEADERS = "http.default-headers";
|
||||
public static final String xxxDEFAULT_HEADERS = "http.default-headers";
|
||||
|
||||
/**
|
||||
* Defines the default host. The default value will be used if the target host is
|
||||
|
@ -161,7 +161,7 @@ public class HttpClientParams {
|
|||
* This parameter expects a value of type {@link org.apache.http.HttpHost}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String DEFAULT_HOST = "http.default-host";
|
||||
public static final String xxxDEFAULT_HOST = "http.default-host";
|
||||
|
||||
private HttpClientParams() {
|
||||
super();
|
||||
|
@ -178,7 +178,8 @@ public class HttpClientParams {
|
|||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
return params.getLongParameter(CONNECTION_MANAGER_TIMEOUT, 0);
|
||||
return params.getLongParameter
|
||||
(ClientPNames.CONNECTION_MANAGER_TIMEOUT, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,35 +193,40 @@ public class HttpClientParams {
|
|||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
params.setLongParameter(CONNECTION_MANAGER_TIMEOUT, timeout);
|
||||
params.setLongParameter
|
||||
(ClientPNames.CONNECTION_MANAGER_TIMEOUT, timeout);
|
||||
}
|
||||
|
||||
public static boolean isRedirecting(final HttpParams params) {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
return params.getBooleanParameter(HANDLE_REDIRECTS, true);
|
||||
return params.getBooleanParameter
|
||||
(ClientPNames.HANDLE_REDIRECTS, true);
|
||||
}
|
||||
|
||||
public static void setRedirecting(final HttpParams params, boolean value) {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
params.setBooleanParameter(HANDLE_REDIRECTS, value);
|
||||
params.setBooleanParameter
|
||||
(ClientPNames.HANDLE_REDIRECTS, value);
|
||||
}
|
||||
|
||||
public static boolean isAuthenticating(final HttpParams params) {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
return params.getBooleanParameter(HANDLE_AUTHENTICATION, true);
|
||||
return params.getBooleanParameter
|
||||
(ClientPNames.HANDLE_AUTHENTICATION, true);
|
||||
}
|
||||
|
||||
public static void setAuthenticating(final HttpParams params, boolean value) {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
params.setBooleanParameter(HANDLE_AUTHENTICATION, value);
|
||||
params.setBooleanParameter
|
||||
(ClientPNames.HANDLE_AUTHENTICATION, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -234,7 +240,8 @@ public class HttpClientParams {
|
|||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
return params.getBooleanParameter(PREEMPTIVE_AUTHENTICATION, false);
|
||||
return params.getBooleanParameter
|
||||
(ClientPNames.PREEMPTIVE_AUTHENTICATION, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,14 +254,16 @@ public class HttpClientParams {
|
|||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
params.setBooleanParameter(PREEMPTIVE_AUTHENTICATION, value);
|
||||
params.setBooleanParameter
|
||||
(ClientPNames.PREEMPTIVE_AUTHENTICATION, value);
|
||||
}
|
||||
|
||||
public static String getCookiePolicy(final HttpParams params) {
|
||||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
String cookiePolicy = (String) params.getParameter(COOKIE_POLICY);
|
||||
String cookiePolicy = (String)
|
||||
params.getParameter(ClientPNames.COOKIE_POLICY);
|
||||
if (cookiePolicy == null) {
|
||||
return CookiePolicy.BROWSER_COMPATIBILITY;
|
||||
}
|
||||
|
@ -265,7 +274,7 @@ public class HttpClientParams {
|
|||
if (params == null) {
|
||||
throw new IllegalArgumentException("HTTP parameters may not be null");
|
||||
}
|
||||
params.setParameter(COOKIE_POLICY, cookiePolicy);
|
||||
params.setParameter(ClientPNames.COOKIE_POLICY, cookiePolicy);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* $HeadURL$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.conn.params;
|
||||
|
||||
|
||||
/**
|
||||
* Parameter names for connections in HttpConn.
|
||||
*
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface ConnConnectionPNames {
|
||||
|
||||
|
||||
/**
|
||||
* Defines the maximum number of ignorable lines before we expect
|
||||
* a HTTP response's status line.
|
||||
* <p>
|
||||
* With HTTP/1.1 persistent connections, the problem arises that
|
||||
* broken scripts could return a wrong Content-Length
|
||||
* (there are more bytes sent than specified).
|
||||
* Unfortunately, in some cases, this cannot be detected after the
|
||||
* bad response, but only before the next one.
|
||||
* So HttpClient must be able to skip those surplus lines this way.
|
||||
* </p>
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* 0 disallows all garbage/empty lines before the status line.
|
||||
* Use {@link java.lang.Integer#MAX_VALUE} for unlimited
|
||||
* (default in lenient mode).
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_STATUS_LINE_GARBAGE = "http.connection.max-status-line-garbage";
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* $HeadURL$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.conn.params;
|
||||
|
||||
|
||||
/**
|
||||
* Parameter names for connection managers in HttpConn.
|
||||
*
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface ConnManagerPNames {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Defines the maximum number of connections to a host.
|
||||
* This limit is interpreted by client connection managers
|
||||
* and applies to individual manager instances.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link java.util.Map}.
|
||||
* The value should map instances of {@link org.apache.http.conn.HttpRoute}
|
||||
* to {@link Integer integers}.
|
||||
* The default value is mapped to a special, private key.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_HOST_CONNECTIONS = "http.connection-manager.max-per-host";
|
||||
|
||||
/**
|
||||
* Defines the maximum number of connections in total.
|
||||
* This limit is interpreted by client connection managers
|
||||
* and applies to individual manager instances.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_TOTAL_CONNECTIONS = "http.connection-manager.max-total";
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* $HeadURL$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.http.conn.params;
|
||||
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
/**
|
||||
* Parameter names for routing in HttpConn.
|
||||
*
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface ConnRoutePNames {
|
||||
|
||||
/**
|
||||
* Parameter for the default proxy.
|
||||
* The default value will be used by some
|
||||
* {@link org.apache.http.conn.HttpRoutePlanner HttpRoutePlanner}
|
||||
* implementations, in particular the default implementation.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link org.apache.http.HttpHost}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String DEFAULT_PROXY = "http.default-proxy";
|
||||
|
||||
}
|
||||
|
|
@ -47,6 +47,8 @@ import org.apache.http.params.HttpParams;
|
|||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @see ConnManagerPNames
|
||||
*/
|
||||
public final class HttpConnectionManagerParams {
|
||||
|
||||
|
@ -60,54 +62,13 @@ public final class HttpConnectionManagerParams {
|
|||
private static final String ROUTE_DEFAULT = "*Route*Default*";
|
||||
|
||||
|
||||
/**
|
||||
* Defines the maximum number of connections allowed per host configuration.
|
||||
* These values only apply to the number of connections from a particular instance
|
||||
* of HttpConnectionManager.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link java.util.Map}. The value
|
||||
* should map instances of {@link HttpRoute}
|
||||
* to {@link Integer integers}.
|
||||
* The default value is mapped to a special, private key.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_HOST_CONNECTIONS = "http.connection-manager.max-per-host";
|
||||
|
||||
/**
|
||||
* Defines the maximum number of connections allowed overall. This value only applies
|
||||
* to the number of connections from a particular instance of HttpConnectionManager.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_TOTAL_CONNECTIONS = "http.connection-manager.max-total";
|
||||
|
||||
/**
|
||||
* Defines the maximum number of ignorable lines before we expect
|
||||
* a HTTP response's status code.
|
||||
* <p>
|
||||
* With HTTP/1.1 persistent connections, the problem arises that
|
||||
* broken scripts could return a wrong Content-Length
|
||||
* (there are more bytes sent than specified).<br />
|
||||
* Unfortunately, in some cases, this is not possible after the bad response,
|
||||
* but only before the next one. <br />
|
||||
* So, HttpClient must be able to skip those surplus lines this way.
|
||||
* </p>
|
||||
* <p>
|
||||
* Set this to 0 to disallow any garbage/empty lines before the status line.<br />
|
||||
* To specify no limit, use {@link java.lang.Integer#MAX_VALUE} (default in lenient mode).
|
||||
* </p>
|
||||
*
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
*/
|
||||
public static final String MAX_STATUS_LINE_GARBAGE = "http.connection.max-status-line-garbage";
|
||||
|
||||
/**
|
||||
* Sets the default maximum number of connections allowed for routes.
|
||||
*
|
||||
* @param max The default maximum.
|
||||
*
|
||||
* @see #MAX_HOST_CONNECTIONS
|
||||
* @see ConnManagerPNames#MAX_HOST_CONNECTIONS
|
||||
*/
|
||||
public static void setDefaultMaxConnectionsPerHost(final HttpParams params,
|
||||
final int max) {
|
||||
|
@ -121,7 +82,7 @@ public final class HttpConnectionManagerParams {
|
|||
* @param max the maximum number of connections,
|
||||
* must be greater than 0
|
||||
*
|
||||
* @see #MAX_HOST_CONNECTIONS
|
||||
* @see ConnManagerPNames#MAX_HOST_CONNECTIONS
|
||||
*/
|
||||
public static void setMaxConnectionsPerHost(final HttpParams params,
|
||||
final HttpRoute route,
|
||||
|
@ -153,7 +114,8 @@ public final class HttpConnectionManagerParams {
|
|||
("The maximum must be greater than 0.");
|
||||
}
|
||||
|
||||
Map currentValues = (Map) params.getParameter(MAX_HOST_CONNECTIONS);
|
||||
Map currentValues = (Map) params.getParameter
|
||||
(ConnManagerPNames.MAX_HOST_CONNECTIONS);
|
||||
// param values are meant to be immutable so we'll make a copy
|
||||
// to modify
|
||||
Map newValues = null;
|
||||
|
@ -163,7 +125,7 @@ public final class HttpConnectionManagerParams {
|
|||
newValues = new HashMap(currentValues);
|
||||
}
|
||||
newValues.put(key, new Integer(max));
|
||||
params.setParameter(MAX_HOST_CONNECTIONS, newValues);
|
||||
params.setParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS, newValues);
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,7 +135,7 @@ public final class HttpConnectionManagerParams {
|
|||
*
|
||||
* @return The default maximum.
|
||||
*
|
||||
* @see #MAX_HOST_CONNECTIONS
|
||||
* @see ConnManagerPNames#MAX_HOST_CONNECTIONS
|
||||
*/
|
||||
public static int getDefaultMaxConnectionsPerHost(
|
||||
final HttpParams params) {
|
||||
|
@ -189,7 +151,7 @@ public final class HttpConnectionManagerParams {
|
|||
*
|
||||
* @return The maximum number of connections allowed for the given route.
|
||||
*
|
||||
* @see #MAX_HOST_CONNECTIONS
|
||||
* @see ConnManagerPNames#MAX_HOST_CONNECTIONS
|
||||
*/
|
||||
public static int getMaxConnectionsPerHost(final HttpParams params,
|
||||
final HttpRoute route) {
|
||||
|
@ -221,7 +183,8 @@ public final class HttpConnectionManagerParams {
|
|||
// if neither a specific nor a default maximum is configured...
|
||||
int result = DEFAULT_MAX_HOST_CONNECTIONS;
|
||||
|
||||
Map m = (Map) params.getParameter(MAX_HOST_CONNECTIONS);
|
||||
Map m = (Map) params.getParameter
|
||||
(ConnManagerPNames.MAX_HOST_CONNECTIONS);
|
||||
if (m != null) {
|
||||
Integer max = (Integer) m.get(key);
|
||||
if ((max == null) && (key != ROUTE_DEFAULT)) {
|
||||
|
@ -242,7 +205,7 @@ public final class HttpConnectionManagerParams {
|
|||
*
|
||||
* @param maxTotalConnections The maximum number of connections allowed.
|
||||
*
|
||||
* @see #MAX_TOTAL_CONNECTIONS
|
||||
* @see ConnManagerPNames#MAX_TOTAL_CONNECTIONS
|
||||
*/
|
||||
public static void setMaxTotalConnections(
|
||||
final HttpParams params,
|
||||
|
@ -252,7 +215,7 @@ public final class HttpConnectionManagerParams {
|
|||
("HTTP parameters must not be null.");
|
||||
}
|
||||
params.setIntParameter(
|
||||
HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS,
|
||||
ConnManagerPNames.MAX_TOTAL_CONNECTIONS,
|
||||
maxTotalConnections);
|
||||
}
|
||||
|
||||
|
@ -261,7 +224,7 @@ public final class HttpConnectionManagerParams {
|
|||
*
|
||||
* @return The maximum number of connections allowed.
|
||||
*
|
||||
* @see #MAX_TOTAL_CONNECTIONS
|
||||
* @see ConnManagerPNames#MAX_TOTAL_CONNECTIONS
|
||||
*/
|
||||
public static int getMaxTotalConnections(
|
||||
final HttpParams params) {
|
||||
|
@ -270,7 +233,7 @@ public final class HttpConnectionManagerParams {
|
|||
("HTTP parameters must not be null.");
|
||||
}
|
||||
return params.getIntParameter(
|
||||
HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS,
|
||||
ConnManagerPNames.MAX_TOTAL_CONNECTIONS,
|
||||
DEFAULT_MAX_TOTAL_CONNECTIONS);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ package org.apache.http.cookie.params;
|
|||
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
|
||||
/**
|
||||
* This class implements an adaptor around the {@link HttpParams} interface
|
||||
* to simplify manipulation of cookie management specific parameters.
|
||||
* Parameter names for cookie specifications in HttpCookie.
|
||||
*
|
||||
* @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
|
||||
*
|
||||
|
@ -43,21 +43,25 @@ import org.apache.http.params.HttpParams;
|
|||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public final class CookieSpecParams {
|
||||
public interface CookieSpecPNames {
|
||||
|
||||
/**
|
||||
* The key used to look up the date patterns used for parsing. The String patterns are stored
|
||||
* in a {@link java.util.Collection} and must be compatible with
|
||||
* {@link java.text.SimpleDateFormat}.
|
||||
* Parameter for the date patterns used for parsing.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link java.util.Collection}.
|
||||
* The collection elements are of type {@link String}
|
||||
* and must be compatible with the syntax of
|
||||
* {@link java.text.SimpleDateFormat}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String DATE_PATTERNS = "http.protocol.cookie-datepatterns";
|
||||
|
||||
/**
|
||||
* Defines whether {@link org.apache.http.cookie.Cookie cookies} should be put on
|
||||
* Parameter for Cookie header formatting.
|
||||
* Defines whether {@link org.apache.http.cookie.Cookie cookies}
|
||||
* should be put on
|
||||
* a single {@link org.apache.http.Header request header}.
|
||||
* If not, each cookie is formatted in a seperate Cookie header.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
|
@ -58,7 +58,8 @@ import org.apache.http.util.EncodingUtils;
|
|||
* </p>
|
||||
* <p>
|
||||
* Credential charset is configured via the
|
||||
* {@link AuthParams#CREDENTIAL_CHARSET credential charset} parameter.
|
||||
* {@link org.apache.http.auth.params.AuthPNames#CREDENTIAL_CHARSET
|
||||
* credential charset} parameter.
|
||||
* Since the digest username is included as clear text in the generated
|
||||
* Authentication header, the charset of the username must be compatible
|
||||
* with the
|
||||
|
|
|
@ -50,7 +50,7 @@ import org.apache.http.auth.AuthSchemeRegistry;
|
|||
import org.apache.http.auth.AuthenticationException;
|
||||
import org.apache.http.auth.MalformedChallengeException;
|
||||
import org.apache.http.client.AuthenticationHandler;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.params.ClientPNames;
|
||||
import org.apache.http.client.protocol.ClientContext;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
|
@ -160,7 +160,7 @@ public class DefaultAuthenticationHandler implements AuthenticationHandler {
|
|||
|
||||
HttpParams params = response.getParams();
|
||||
Collection authPrefs = (Collection) params.getParameter(
|
||||
HttpClientParams.AUTH_SCHEME_PRIORITY);
|
||||
ClientPNames.AUTH_SCHEME_PRIORITY);
|
||||
if (authPrefs == null || authPrefs.isEmpty()) {
|
||||
authPrefs = DEFAULT_SCHEME_PRIORITY;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.apache.http.client.RedirectHandler;
|
|||
import org.apache.http.client.RoutedRequest;
|
||||
import org.apache.http.client.methods.AbortableHttpRequest;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.params.ClientPNames;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.protocol.ClientContext;
|
||||
import org.apache.http.conn.BasicManagedEntity;
|
||||
|
@ -184,7 +185,7 @@ public class DefaultClientRequestDirector
|
|||
this.managedConn = null;
|
||||
|
||||
this.redirectCount = 0;
|
||||
this.maxRedirects = this.params.getIntParameter(HttpClientParams.MAX_REDIRECTS, 100);
|
||||
this.maxRedirects = this.params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100);
|
||||
this.targetAuthState = new AuthState();
|
||||
this.proxyAuthState = new AuthState();
|
||||
} // constructor
|
||||
|
@ -260,7 +261,7 @@ public class DefaultClientRequestDirector
|
|||
|
||||
// Add default headers
|
||||
Collection defHeaders = (Collection) orig.getParams().getParameter(
|
||||
HttpClientParams.DEFAULT_HEADERS);
|
||||
ClientPNames.DEFAULT_HEADERS);
|
||||
if (defHeaders != null) {
|
||||
for (Iterator it = defHeaders.iterator(); it.hasNext(); ) {
|
||||
orig.addHeader((Header) it.next());
|
||||
|
@ -315,7 +316,7 @@ public class DefaultClientRequestDirector
|
|||
|
||||
// Use virtual host if set
|
||||
HttpHost target = (HttpHost) request.getParams().getParameter(
|
||||
HttpClientParams.VIRTUAL_HOST);
|
||||
ClientPNames.VIRTUAL_HOST);
|
||||
|
||||
if (target == null) {
|
||||
target = route.getTargetHost();
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.apache.http.client.RedirectHandler;
|
|||
import org.apache.http.client.RoutedRequest;
|
||||
import org.apache.http.client.params.AuthPolicy;
|
||||
import org.apache.http.client.params.CookiePolicy;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.params.ClientPNames;
|
||||
import org.apache.http.client.protocol.ClientContext;
|
||||
import org.apache.http.client.protocol.RequestAddCookies;
|
||||
import org.apache.http.client.protocol.RequestProxyAuthentication;
|
||||
|
@ -155,7 +155,7 @@ public class DefaultHttpClient extends AbstractHttpClient {
|
|||
|
||||
HttpParams params = getParams();
|
||||
String className = (String) params.getParameter(
|
||||
HttpClientParams.CONNECTION_MANAGER_FACTORY);
|
||||
ClientPNames.CONNECTION_MANAGER_FACTORY);
|
||||
|
||||
if (className != null) {
|
||||
try {
|
||||
|
@ -282,7 +282,7 @@ public class DefaultHttpClient extends AbstractHttpClient {
|
|||
|
||||
if (target == null) {
|
||||
target = (HttpHost) request.getParams().getParameter(
|
||||
HttpClientParams.DEFAULT_HOST);
|
||||
ClientPNames.DEFAULT_HOST);
|
||||
}
|
||||
if (target == null) {
|
||||
throw new IllegalStateException
|
||||
|
|
|
@ -45,16 +45,18 @@ import org.apache.http.HttpStatus;
|
|||
import org.apache.http.ProtocolException;
|
||||
import org.apache.http.client.CircularRedirectException;
|
||||
import org.apache.http.client.RedirectHandler;
|
||||
import org.apache.http.client.params.HttpClientParams;
|
||||
import org.apache.http.client.params.ClientPNames;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
import org.apache.http.protocol.ExecutionContext;
|
||||
|
||||
|
||||
/**
|
||||
* Default implementation of a redirect handler.
|
||||
*
|
||||
* @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
|
||||
*
|
||||
*
|
||||
* <!-- empty lines to avoid svn diff problems -->
|
||||
* @version $Revision$
|
||||
*
|
||||
|
@ -118,7 +120,7 @@ public class DefaultRedirectHandler implements RedirectHandler {
|
|||
// rfc2616 demands the location value be a complete URI
|
||||
// Location = "Location" ":" absoluteURI
|
||||
if (!uri.isAbsolute()) {
|
||||
if (params.isParameterTrue(HttpClientParams.REJECT_RELATIVE_REDIRECT)) {
|
||||
if (params.isParameterTrue(ClientPNames.REJECT_RELATIVE_REDIRECT)) {
|
||||
throw new ProtocolException("Relative redirect location '"
|
||||
+ uri + "' not allowed");
|
||||
}
|
||||
|
@ -143,7 +145,7 @@ public class DefaultRedirectHandler implements RedirectHandler {
|
|||
}
|
||||
}
|
||||
|
||||
if (params.isParameterFalse(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS)) {
|
||||
if (params.isParameterFalse(ClientPNames.ALLOW_CIRCULAR_REDIRECTS)) {
|
||||
|
||||
Set redirectLocations = (Set) context.getAttribute(REDIRECT_LOCATIONS);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.http.HttpResponseFactory;
|
|||
import org.apache.http.NoHttpResponseException;
|
||||
import org.apache.http.ProtocolException;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.http.conn.params.HttpConnectionManagerParams;
|
||||
import org.apache.http.conn.params.ConnConnectionPNames;
|
||||
import org.apache.http.impl.io.AbstractMessageParser;
|
||||
import org.apache.http.io.SessionInputBuffer;
|
||||
import org.apache.http.message.LineParser;
|
||||
|
@ -65,7 +65,7 @@ public class DefaultResponseParser extends AbstractMessageParser {
|
|||
this.responseFactory = responseFactory;
|
||||
this.lineBuf = new CharArrayBuffer(128);
|
||||
this.maxGarbageLines = params.getIntParameter(
|
||||
HttpConnectionManagerParams.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE);
|
||||
ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.apache.http.impl.cookie;
|
|||
|
||||
import org.apache.http.cookie.CookieSpec;
|
||||
import org.apache.http.cookie.CookieSpecFactory;
|
||||
import org.apache.http.cookie.params.CookieSpecParams;
|
||||
import org.apache.http.cookie.params.CookieSpecPNames;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,7 @@ public class BrowserCompatSpecFactory implements CookieSpecFactory {
|
|||
public CookieSpec newInstance(final HttpParams params) {
|
||||
if (params != null) {
|
||||
return new BrowserCompatSpec(
|
||||
(String []) params.getParameter(CookieSpecParams.DATE_PATTERNS));
|
||||
(String []) params.getParameter(CookieSpecPNames.DATE_PATTERNS));
|
||||
} else {
|
||||
return new BrowserCompatSpec();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.apache.http.impl.cookie;
|
|||
|
||||
import org.apache.http.cookie.CookieSpec;
|
||||
import org.apache.http.cookie.CookieSpecFactory;
|
||||
import org.apache.http.cookie.params.CookieSpecParams;
|
||||
import org.apache.http.cookie.params.CookieSpecPNames;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
/**
|
||||
|
@ -47,8 +47,8 @@ public class RFC2109SpecFactory implements CookieSpecFactory {
|
|||
public CookieSpec newInstance(final HttpParams params) {
|
||||
if (params != null) {
|
||||
return new RFC2109Spec(
|
||||
(String []) params.getParameter(CookieSpecParams.DATE_PATTERNS),
|
||||
params.getBooleanParameter(CookieSpecParams.SINGLE_COOKIE_HEADER, false));
|
||||
(String []) params.getParameter(CookieSpecPNames.DATE_PATTERNS),
|
||||
params.getBooleanParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, false));
|
||||
} else {
|
||||
return new RFC2109Spec();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue