HTTPCLIENT-749: HttpParams beans
Contributed by Stojce Dimski <sdmiski at yahoo.it> git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@632313 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2588e16238
commit
8f53912519
|
@ -1,6 +1,9 @@
|
|||
Changes since 4.0 Alpha 3
|
||||
-------------------
|
||||
|
||||
* [HTTPCLIENT-749] HttpParams beans
|
||||
Contributed by Stojce Dimski <sdmiski at yahoo.it>
|
||||
|
||||
* [HTTPCLIENT-755] Workaround for known bugs in java.net.URI.resolve()
|
||||
Bug ID: 4708535
|
||||
Contributed by Johannes Koch <johannes.koch at fit.fraunhofer.de>
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* $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.HttpAbstractParamBean;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
public class AuthParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public AuthParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setCredentialCharset (final String charset) {
|
||||
AuthParams.setCredentialCharset(params, charset);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* $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 java.util.Collection;
|
||||
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.params.HttpAbstractParamBean;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
public class ClientParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public ClientParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setConnectionManagerTimeout (final long timeout) {
|
||||
params.setLongParameter(ClientPNames.CONNECTION_MANAGER_TIMEOUT, timeout);
|
||||
}
|
||||
|
||||
public void setConnectionManagerFactory (final String factory) {
|
||||
params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY, factory);
|
||||
}
|
||||
|
||||
public void setHandleRedirects (final boolean handle) {
|
||||
params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, handle);
|
||||
}
|
||||
|
||||
public void setRejectRelativeRedirect (final boolean reject) {
|
||||
params.setBooleanParameter(ClientPNames.REJECT_RELATIVE_REDIRECT, reject);
|
||||
}
|
||||
|
||||
public void setMaxRedirects (final int maxRedirects) {
|
||||
params.setIntParameter(ClientPNames.MAX_REDIRECTS, maxRedirects);
|
||||
}
|
||||
|
||||
public void setAllowCircularRedirects (final boolean allow) {
|
||||
params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, allow);
|
||||
}
|
||||
|
||||
public void setHandleAuthentication (final boolean handle) {
|
||||
params.setBooleanParameter(ClientPNames.HANDLE_AUTHENTICATION, handle);
|
||||
}
|
||||
|
||||
public void setPreemptiveAuthentication (final boolean preemptive) {
|
||||
params.setBooleanParameter(ClientPNames.PREEMPTIVE_AUTHENTICATION, preemptive);
|
||||
}
|
||||
|
||||
public void setCookiePolicy (final String policy) {
|
||||
params.setParameter(ClientPNames.COOKIE_POLICY, policy);
|
||||
}
|
||||
|
||||
public void setVirtualHost (final HttpHost host) {
|
||||
params.setParameter(ClientPNames.VIRTUAL_HOST, host);
|
||||
}
|
||||
|
||||
public void setDefaultHeaders (final Collection <Header> headers) {
|
||||
params.setParameter(ClientPNames.DEFAULT_HEADERS, headers);
|
||||
}
|
||||
|
||||
public void setDefaultHost (final HttpHost host) {
|
||||
params.setParameter(ClientPNames.DEFAULT_HOST, host);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* $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.protocol;
|
||||
|
||||
import org.apache.http.client.CookieStore;
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
|
||||
public class ClientContextConfigurer {
|
||||
private final HttpContext context;
|
||||
|
||||
public ClientContextConfigurer (final HttpContext context) {
|
||||
if (context == null)
|
||||
throw new IllegalArgumentException("'context' must be set");
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setCookieStore (final CookieStore cookieStore) {
|
||||
context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* $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.HttpAbstractParamBean;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
public class ConnConnectionParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public ConnConnectionParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setMaxStatusLineGarbage (final int maxStatusLineGarbage) {
|
||||
params.setIntParameter(ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, maxStatusLineGarbage);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* $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.HttpAbstractParamBean;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
public class ConnManagerParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public ConnManagerParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setMaxHostConnections (final int maxConnections) {
|
||||
params.setIntParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS, maxConnections);
|
||||
}
|
||||
|
||||
public void setMaxTotalConnections (final int maxConnections) {
|
||||
params.setIntParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, maxConnections);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* $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 java.net.InetAddress;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.conn.routing.HttpRoute;
|
||||
import org.apache.http.params.HttpAbstractParamBean;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
public class ConnRouteParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public ConnRouteParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setDefaultProxy (final HttpHost defaultProxy) {
|
||||
params.setParameter(ConnRoutePNames.DEFAULT_PROXY, defaultProxy);
|
||||
}
|
||||
|
||||
public void setLocalAddress (final InetAddress address) {
|
||||
params.setParameter(ConnRoutePNames.LOCAL_ADDRESS, address);
|
||||
}
|
||||
|
||||
public void setForcedRoute (final HttpRoute route) {
|
||||
params.setParameter(ConnRoutePNames.FORCED_ROUTE, route);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* $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.cookie.params;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.http.params.HttpAbstractParamBean;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
public class CookieSpecParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public CookieSpecParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setDatePatterns (final Collection <String> patterns) {
|
||||
params.setParameter(CookieSpecPNames.DATE_PATTERNS, patterns);
|
||||
}
|
||||
|
||||
public void setSingleHeader (final boolean singleHeader) {
|
||||
params.setBooleanParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, singleHeader);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue