mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
pt 1 in reviving the android build (copied from pm 28a1, wish me luck)
This commit is contained in:
parent
efa9662725
commit
d7788a6d6d
4249 changed files with 468189 additions and 0 deletions
124
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/AbstractHttpParams.java
vendored
Normal file
124
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/AbstractHttpParams.java
vendored
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Abstract base class for parameter collections.
|
||||
* Type specific setters and getters are mapped to the abstract,
|
||||
* generic getters and setters.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractHttpParams implements HttpParams, HttpParamsNames {
|
||||
|
||||
/**
|
||||
* Instantiates parameters.
|
||||
*/
|
||||
protected AbstractHttpParams() {
|
||||
super();
|
||||
}
|
||||
|
||||
public long getLongParameter(final String name, final long defaultValue) {
|
||||
final Object param = getParameter(name);
|
||||
if (param == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return ((Long) param).longValue();
|
||||
}
|
||||
|
||||
public HttpParams setLongParameter(final String name, final long value) {
|
||||
setParameter(name, Long.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getIntParameter(final String name, final int defaultValue) {
|
||||
final Object param = getParameter(name);
|
||||
if (param == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return ((Integer) param).intValue();
|
||||
}
|
||||
|
||||
public HttpParams setIntParameter(final String name, final int value) {
|
||||
setParameter(name, Integer.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getDoubleParameter(final String name, final double defaultValue) {
|
||||
final Object param = getParameter(name);
|
||||
if (param == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return ((Double) param).doubleValue();
|
||||
}
|
||||
|
||||
public HttpParams setDoubleParameter(final String name, final double value) {
|
||||
setParameter(name, Double.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getBooleanParameter(final String name, final boolean defaultValue) {
|
||||
final Object param = getParameter(name);
|
||||
if (param == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return ((Boolean) param).booleanValue();
|
||||
}
|
||||
|
||||
public HttpParams setBooleanParameter(final String name, final boolean value) {
|
||||
setParameter(name, value ? Boolean.TRUE : Boolean.FALSE);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isParameterTrue(final String name) {
|
||||
return getBooleanParameter(name, false);
|
||||
}
|
||||
|
||||
public boolean isParameterFalse(final String name) {
|
||||
return !getBooleanParameter(name, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p/>
|
||||
* Dummy implementation - must be overridden by subclasses.
|
||||
*
|
||||
* @since 4.2
|
||||
* @throws UnsupportedOperationException - always
|
||||
*/
|
||||
public Set<String> getNames(){
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
} // class AbstractHttpParams
|
||||
190
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/BasicHttpParams.java
vendored
Normal file
190
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/BasicHttpParams.java
vendored
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import ch.boye.httpclientandroidlib.annotation.ThreadSafe;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link HttpParams} interface.
|
||||
* <p>
|
||||
* Please note access to the internal structures of this class is not
|
||||
* synchronized and therefore this class may be thread-unsafe.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
@ThreadSafe
|
||||
public class BasicHttpParams extends AbstractHttpParams implements Serializable, Cloneable {
|
||||
|
||||
private static final long serialVersionUID = -7086398485908701455L;
|
||||
|
||||
/** Map of HTTP parameters that this collection contains. */
|
||||
private final Map<String, Object> parameters = new ConcurrentHashMap<String, Object>();
|
||||
|
||||
public BasicHttpParams() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Object getParameter(final String name) {
|
||||
return this.parameters.get(name);
|
||||
}
|
||||
|
||||
public HttpParams setParameter(final String name, final Object value) {
|
||||
if (name == null) {
|
||||
return this;
|
||||
}
|
||||
if (value != null) {
|
||||
this.parameters.put(name, value);
|
||||
} else {
|
||||
this.parameters.remove(name);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean removeParameter(final String name) {
|
||||
//this is to avoid the case in which the key has a null value
|
||||
if (this.parameters.containsKey(name)) {
|
||||
this.parameters.remove(name);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns the value to all the parameter with the given names
|
||||
*
|
||||
* @param names array of parameter names
|
||||
* @param value parameter value
|
||||
*/
|
||||
public void setParameters(final String[] names, final Object value) {
|
||||
for (final String name : names) {
|
||||
setParameter(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the parameter set?
|
||||
* <p>
|
||||
* Uses {@link #getParameter(String)} (which is overrideable) to
|
||||
* fetch the parameter value, if any.
|
||||
* <p>
|
||||
* Also @see {@link #isParameterSetLocally(String)}
|
||||
*
|
||||
* @param name parameter name
|
||||
* @return true if parameter is defined and non-null
|
||||
*/
|
||||
public boolean isParameterSet(final String name) {
|
||||
return getParameter(name) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the parameter set in this object?
|
||||
* <p>
|
||||
* The parameter value is fetched directly.
|
||||
* <p>
|
||||
* Also @see {@link #isParameterSet(String)}
|
||||
*
|
||||
* @param name parameter name
|
||||
* @return true if parameter is defined and non-null
|
||||
*/
|
||||
public boolean isParameterSetLocally(final String name) {
|
||||
return this.parameters.get(name) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all parameters from this collection.
|
||||
*/
|
||||
public void clear() {
|
||||
this.parameters.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of these parameters.
|
||||
* This implementation calls {@link #clone()}.
|
||||
*
|
||||
* @return a new set of params holding a copy of the
|
||||
* <i>local</i> parameters in this object.
|
||||
*
|
||||
* @throws UnsupportedOperationException if the clone() fails
|
||||
*/
|
||||
public HttpParams copy() {
|
||||
try {
|
||||
return (HttpParams) clone();
|
||||
} catch (final CloneNotSupportedException ex) {
|
||||
throw new UnsupportedOperationException("Cloning not supported");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones the instance.
|
||||
* Uses {@link #copyParams(HttpParams)} to copy the parameters.
|
||||
*/
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
final BasicHttpParams clone = (BasicHttpParams) super.clone();
|
||||
copyParams(clone);
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the locally defined parameters to the argument parameters.
|
||||
* This method is called from {@link #clone()}.
|
||||
*
|
||||
* @param target the parameters to which to copy
|
||||
* @since 4.2
|
||||
*/
|
||||
public void copyParams(final HttpParams target) {
|
||||
for (final Map.Entry<String, Object> me : this.parameters.entrySet()) {
|
||||
target.setParameter(me.getKey(), me.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current set of names.
|
||||
*
|
||||
* Changes to the underlying HttpParams are not reflected
|
||||
* in the set - it is a snapshot.
|
||||
*
|
||||
* @return the names, as a Set<String>
|
||||
* @since 4.2
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getNames() {
|
||||
return new HashSet<String>(this.parameters.keySet());
|
||||
}
|
||||
}
|
||||
170
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/CoreConnectionPNames.java
vendored
Normal file
170
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/CoreConnectionPNames.java
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
/**
|
||||
* Defines parameter names for connections in HttpCore.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public interface CoreConnectionPNames {
|
||||
|
||||
/**
|
||||
* Defines the socket timeout (<code>SO_TIMEOUT</code>) in milliseconds,
|
||||
* which is the timeout for waiting for data or, put differently,
|
||||
* a maximum period inactivity between two consecutive data packets).
|
||||
* A timeout value of zero is interpreted as an infinite timeout.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
* @see java.net.SocketOptions#SO_TIMEOUT
|
||||
*/
|
||||
public static final String SO_TIMEOUT = "http.socket.timeout";
|
||||
|
||||
/**
|
||||
* Determines whether Nagle's algorithm is to be used. The Nagle's algorithm
|
||||
* tries to conserve bandwidth by minimizing the number of segments that are
|
||||
* sent. When applications wish to decrease network latency and increase
|
||||
* performance, they can disable Nagle's algorithm (that is enable
|
||||
* TCP_NODELAY). Data will be sent earlier, at the cost of an increase
|
||||
* in bandwidth consumption.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
* @see java.net.SocketOptions#TCP_NODELAY
|
||||
*/
|
||||
public static final String TCP_NODELAY = "http.tcp.nodelay";
|
||||
|
||||
/**
|
||||
* Determines the size of the internal socket buffer used to buffer data
|
||||
* while receiving / transmitting HTTP messages.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String SOCKET_BUFFER_SIZE = "http.socket.buffer-size";
|
||||
|
||||
/**
|
||||
* Sets SO_LINGER with the specified linger time in seconds. The maximum
|
||||
* timeout value is platform specific. Value <code>0</code> implies that
|
||||
* the option is disabled. Value <code>-1</code> implies that the JRE
|
||||
* default is used. The setting only affects the socket close operation.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
* @see java.net.SocketOptions#SO_LINGER
|
||||
*/
|
||||
public static final String SO_LINGER = "http.socket.linger";
|
||||
|
||||
/**
|
||||
* Defines whether the socket can be bound even though a previous connection is
|
||||
* still in a timeout state.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
* @see java.net.Socket#setReuseAddress(boolean)
|
||||
*
|
||||
* @since 4.1
|
||||
*/
|
||||
public static final String SO_REUSEADDR = "http.socket.reuseaddr";
|
||||
|
||||
/**
|
||||
* Determines the timeout in milliseconds until a connection is established.
|
||||
* A timeout value of zero is interpreted as an infinite timeout.
|
||||
* <p>
|
||||
* Please note this parameter can only be applied to connections that
|
||||
* are bound to a particular local address.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String CONNECTION_TIMEOUT = "http.connection.timeout";
|
||||
|
||||
/**
|
||||
* Determines whether stale connection check is to be used. The stale
|
||||
* connection check can cause up to 30 millisecond overhead per request and
|
||||
* should be used only when appropriate. For performance critical
|
||||
* operations this check should be disabled.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String STALE_CONNECTION_CHECK = "http.connection.stalecheck";
|
||||
|
||||
/**
|
||||
* Determines the maximum line length limit. If set to a positive value,
|
||||
* any HTTP line exceeding this limit will cause an IOException. A negative
|
||||
* or zero value will effectively disable the check.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_LINE_LENGTH = "http.connection.max-line-length";
|
||||
|
||||
/**
|
||||
* Determines the maximum HTTP header count allowed. If set to a positive
|
||||
* value, the number of HTTP headers received from the data stream exceeding
|
||||
* this limit will cause an IOException. A negative or zero value will
|
||||
* effectively disable the check.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String MAX_HEADER_COUNT = "http.connection.max-header-count";
|
||||
|
||||
/**
|
||||
* Defines the size limit below which data chunks should be buffered in a session I/O buffer
|
||||
* in order to minimize native method invocations on the underlying network socket.
|
||||
* The optimal value of this parameter can be platform specific and defines a trade-off
|
||||
* between performance of memory copy operations and that of native method invocation.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
* </p>
|
||||
*
|
||||
* @since 4.1
|
||||
*/
|
||||
public static final String MIN_CHUNK_LIMIT = "http.connection.min-chunk-limit";
|
||||
|
||||
|
||||
/**
|
||||
* Defines whether or not TCP is to send automatically a keepalive probe to the peer
|
||||
* after an interval of inactivity (no data exchanged in either direction) between this
|
||||
* host and the peer. The purpose of this option is to detect if the peer host crashes.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
* @see java.net.SocketOptions#SO_KEEPALIVE
|
||||
* @since 4.2
|
||||
*/
|
||||
public static final String SO_KEEPALIVE = "http.socket.keepalive";
|
||||
|
||||
}
|
||||
152
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/CoreProtocolPNames.java
vendored
Normal file
152
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/CoreProtocolPNames.java
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
/**
|
||||
* Defines parameter names for protocol execution in HttpCore.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public interface CoreProtocolPNames {
|
||||
|
||||
/**
|
||||
* Defines the {@link ch.boye.httpclientandroidlib.ProtocolVersion} used per default.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link ch.boye.httpclientandroidlib.ProtocolVersion}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String PROTOCOL_VERSION = "http.protocol.version";
|
||||
|
||||
/**
|
||||
* Defines the charset to be used for encoding HTTP protocol elements.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String HTTP_ELEMENT_CHARSET = "http.protocol.element-charset";
|
||||
|
||||
/**
|
||||
* Defines the charset to be used per default for encoding content body.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String HTTP_CONTENT_CHARSET = "http.protocol.content-charset";
|
||||
|
||||
/**
|
||||
* Defines the content of the <code>User-Agent</code> header.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String USER_AGENT = "http.useragent";
|
||||
|
||||
/**
|
||||
* Defines the content of the <code>Server</code> header.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link String}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String ORIGIN_SERVER = "http.origin-server";
|
||||
|
||||
/**
|
||||
* Defines whether responses with an invalid <code>Transfer-Encoding</code>
|
||||
* header should be rejected.
|
||||
* <p>
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
* </p>
|
||||
*/
|
||||
public static final String STRICT_TRANSFER_ENCODING = "http.protocol.strict-transfer-encoding";
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Activates 'Expect: 100-Continue' handshake for the
|
||||
* entity enclosing methods. The purpose of the 'Expect: 100-Continue'
|
||||
* handshake is to allow a client that is sending a request message with
|
||||
* a request body to determine if the origin server is willing to
|
||||
* accept the request (based on the request headers) before the client
|
||||
* sends the request body.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The use of the 'Expect: 100-continue' handshake can result in
|
||||
* a noticeable performance improvement for entity enclosing requests
|
||||
* (such as POST and PUT) that require the target server's
|
||||
* authentication.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* 'Expect: 100-continue' handshake should be used with
|
||||
* caution, as it may cause problems with HTTP servers and
|
||||
* proxies that do not support HTTP/1.1 protocol.
|
||||
* </p>
|
||||
*
|
||||
* This parameter expects a value of type {@link Boolean}.
|
||||
*/
|
||||
public static final String USE_EXPECT_CONTINUE = "http.protocol.expect-continue";
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Defines the maximum period of time in milliseconds the client should spend
|
||||
* waiting for a 100-continue response.
|
||||
* </p>
|
||||
*
|
||||
* This parameter expects a value of type {@link Integer}.
|
||||
*/
|
||||
public static final String WAIT_FOR_CONTINUE = "http.protocol.wait-for-continue";
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Defines the action to perform upon receiving a malformed input. If the input byte sequence
|
||||
* is not legal for this charset then the input is said to be malformed
|
||||
* </p>
|
||||
*
|
||||
* This parameter expects a value of type {@link java.nio.charset.CodingErrorAction}
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static final String HTTP_MALFORMED_INPUT_ACTION = "http.malformed.input.action";
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Defines the action to perform upon receiving an unmappable input. If the input byte sequence
|
||||
* is legal but cannot be mapped to a valid Unicode character then the input is said to be
|
||||
* unmappable
|
||||
* </p>
|
||||
*
|
||||
* This parameter expects a value of type {@link java.nio.charset.CodingErrorAction}
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static final String HTTP_UNMAPPABLE_INPUT_ACTION = "http.unmappable.input.action";
|
||||
|
||||
}
|
||||
163
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/DefaultedHttpParams.java
vendored
Normal file
163
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/DefaultedHttpParams.java
vendored
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import ch.boye.httpclientandroidlib.util.Args;
|
||||
|
||||
/**
|
||||
* {@link HttpParams} implementation that delegates resolution of a parameter
|
||||
* to the given default {@link HttpParams} instance if the parameter is not
|
||||
* present in the local one. The state of the local collection can be mutated,
|
||||
* whereas the default collection is treated as read-only.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public final class DefaultedHttpParams extends AbstractHttpParams {
|
||||
|
||||
private final HttpParams local;
|
||||
private final HttpParams defaults;
|
||||
|
||||
/**
|
||||
* Create the defaulted set of HttpParams.
|
||||
*
|
||||
* @param local the mutable set of HttpParams
|
||||
* @param defaults the default set of HttpParams, not mutated by this class
|
||||
*/
|
||||
public DefaultedHttpParams(final HttpParams local, final HttpParams defaults) {
|
||||
super();
|
||||
this.local = Args.notNull(local, "Local HTTP parameters");
|
||||
this.defaults = defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of the local collection with the same default
|
||||
*/
|
||||
public HttpParams copy() {
|
||||
final HttpParams clone = this.local.copy();
|
||||
return new DefaultedHttpParams(clone, this.defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the value of the parameter from the local collection and, if the
|
||||
* parameter is not set locally, delegates its resolution to the default
|
||||
* collection.
|
||||
*/
|
||||
public Object getParameter(final String name) {
|
||||
Object obj = this.local.getParameter(name);
|
||||
if (obj == null && this.defaults != null) {
|
||||
obj = this.defaults.getParameter(name);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to remove the parameter from the local collection. This method
|
||||
* <i>does not</i> modify the default collection.
|
||||
*/
|
||||
public boolean removeParameter(final String name) {
|
||||
return this.local.removeParameter(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parameter in the local collection. This method <i>does not</i>
|
||||
* modify the default collection.
|
||||
*/
|
||||
public HttpParams setParameter(final String name, final Object value) {
|
||||
return this.local.setParameter(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the default HttpParams collection
|
||||
*/
|
||||
public HttpParams getDefaults() {
|
||||
return this.defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current set of names
|
||||
* from both the local and default HttpParams instances.
|
||||
*
|
||||
* Changes to the underlying HttpParams intances are not reflected
|
||||
* in the set - it is a snapshot.
|
||||
*
|
||||
* @return the combined set of names, as a Set<String>
|
||||
* @since 4.2
|
||||
* @throws UnsupportedOperationException if either the local or default HttpParams instances do not implement HttpParamsNames
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getNames() {
|
||||
final Set<String> combined = new HashSet<String>(getNames(defaults));
|
||||
combined.addAll(getNames(this.local));
|
||||
return combined ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current set of defaults names.
|
||||
*
|
||||
* Changes to the underlying HttpParams are not reflected
|
||||
* in the set - it is a snapshot.
|
||||
*
|
||||
* @return the names, as a Set<String>
|
||||
* @since 4.2
|
||||
* @throws UnsupportedOperationException if the default HttpParams instance does not implement HttpParamsNames
|
||||
*/
|
||||
public Set<String> getDefaultNames() {
|
||||
return new HashSet<String>(getNames(this.defaults));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current set of local names.
|
||||
*
|
||||
* Changes to the underlying HttpParams are not reflected
|
||||
* in the set - it is a snapshot.
|
||||
*
|
||||
* @return the names, as a Set<String>
|
||||
* @since 4.2
|
||||
* @throws UnsupportedOperationException if the local HttpParams instance does not implement HttpParamsNames
|
||||
*/
|
||||
public Set<String> getLocalNames() {
|
||||
return new HashSet<String>(getNames(this.local));
|
||||
}
|
||||
|
||||
// Helper method
|
||||
private Set<String> getNames(final HttpParams params) {
|
||||
if (params instanceof HttpParamsNames) {
|
||||
return ((HttpParamsNames) params).getNames();
|
||||
}
|
||||
throw new UnsupportedOperationException("HttpParams instance does not implement HttpParamsNames");
|
||||
}
|
||||
|
||||
}
|
||||
48
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpAbstractParamBean.java
vendored
Normal file
48
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpAbstractParamBean.java
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import ch.boye.httpclientandroidlib.util.Args;
|
||||
|
||||
/**
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class HttpAbstractParamBean {
|
||||
|
||||
protected final HttpParams params;
|
||||
|
||||
public HttpAbstractParamBean (final HttpParams params) {
|
||||
super();
|
||||
this.params = Args.notNull(params, "HTTP parameters");
|
||||
}
|
||||
|
||||
}
|
||||
71
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpConnectionParamBean.java
vendored
Normal file
71
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpConnectionParamBean.java
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
/**
|
||||
* This is a Java Bean class that can be used to wrap an instance of
|
||||
* {@link HttpParams} and manipulate HTTP connection parameters using Java Beans
|
||||
* conventions.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public class HttpConnectionParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public HttpConnectionParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setSoTimeout (final int soTimeout) {
|
||||
HttpConnectionParams.setSoTimeout(params, soTimeout);
|
||||
}
|
||||
|
||||
public void setTcpNoDelay (final boolean tcpNoDelay) {
|
||||
HttpConnectionParams.setTcpNoDelay(params, tcpNoDelay);
|
||||
}
|
||||
|
||||
public void setSocketBufferSize (final int socketBufferSize) {
|
||||
HttpConnectionParams.setSocketBufferSize(params, socketBufferSize);
|
||||
}
|
||||
|
||||
public void setLinger (final int linger) {
|
||||
HttpConnectionParams.setLinger(params, linger);
|
||||
}
|
||||
|
||||
public void setConnectionTimeout (final int connectionTimeout) {
|
||||
HttpConnectionParams.setConnectionTimeout(params, connectionTimeout);
|
||||
}
|
||||
|
||||
public void setStaleCheckingEnabled (final boolean staleCheckingEnabled) {
|
||||
HttpConnectionParams.setStaleCheckingEnabled(params, staleCheckingEnabled);
|
||||
}
|
||||
|
||||
}
|
||||
243
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpConnectionParams.java
vendored
Normal file
243
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpConnectionParams.java
vendored
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import ch.boye.httpclientandroidlib.util.Args;
|
||||
|
||||
/**
|
||||
* Utility class for accessing connection parameters in {@link HttpParams}.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public final class HttpConnectionParams implements CoreConnectionPNames {
|
||||
|
||||
private HttpConnectionParams() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#SO_TIMEOUT} parameter.
|
||||
* If not set, defaults to <code>0</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return SO_TIMEOUT.
|
||||
*/
|
||||
public static int getSoTimeout(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#SO_TIMEOUT} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param timeout SO_TIMEOUT.
|
||||
*/
|
||||
public static void setSoTimeout(final HttpParams params, final int timeout) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, timeout);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#SO_REUSEADDR} parameter.
|
||||
* If not set, defaults to <code>false</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return SO_REUSEADDR.
|
||||
*
|
||||
* @since 4.1
|
||||
*/
|
||||
public static boolean getSoReuseaddr(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getBooleanParameter(CoreConnectionPNames.SO_REUSEADDR, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#SO_REUSEADDR} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param reuseaddr SO_REUSEADDR.
|
||||
*
|
||||
* @since 4.1
|
||||
*/
|
||||
public static void setSoReuseaddr(final HttpParams params, final boolean reuseaddr) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setBooleanParameter(CoreConnectionPNames.SO_REUSEADDR, reuseaddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#TCP_NODELAY} parameter.
|
||||
* If not set, defaults to <code>true</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return Nagle's algorithm flag
|
||||
*/
|
||||
public static boolean getTcpNoDelay(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#TCP_NODELAY} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param value Nagle's algorithm flag
|
||||
*/
|
||||
public static void setTcpNoDelay(final HttpParams params, final boolean value) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#SOCKET_BUFFER_SIZE}
|
||||
* parameter. If not set, defaults to <code>-1</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return socket buffer size
|
||||
*/
|
||||
public static int getSocketBufferSize(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#SOCKET_BUFFER_SIZE}
|
||||
* parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param size socket buffer size
|
||||
*/
|
||||
public static void setSocketBufferSize(final HttpParams params, final int size) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#SO_LINGER} parameter.
|
||||
* If not set, defaults to <code>-1</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return SO_LINGER.
|
||||
*/
|
||||
public static int getLinger(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getIntParameter(CoreConnectionPNames.SO_LINGER, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#SO_LINGER} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param value SO_LINGER.
|
||||
*/
|
||||
public static void setLinger(final HttpParams params, final int value) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setIntParameter(CoreConnectionPNames.SO_LINGER, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#CONNECTION_TIMEOUT}
|
||||
* parameter. If not set, defaults to <code>0</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return connect timeout.
|
||||
*/
|
||||
public static int getConnectionTimeout(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#CONNECTION_TIMEOUT}
|
||||
* parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param timeout connect timeout.
|
||||
*/
|
||||
public static void setConnectionTimeout(final HttpParams params, final int timeout) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#STALE_CONNECTION_CHECK}
|
||||
* parameter. If not set, defaults to <code>true</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return stale connection check flag.
|
||||
*/
|
||||
public static boolean isStaleCheckingEnabled(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#STALE_CONNECTION_CHECK}
|
||||
* parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param value stale connection check flag.
|
||||
*/
|
||||
public static void setStaleCheckingEnabled(final HttpParams params, final boolean value) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreConnectionPNames#SO_KEEPALIVE} parameter.
|
||||
* If not set, defaults to <code>false</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return SO_KEEPALIVE.
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static boolean getSoKeepalive(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getBooleanParameter(CoreConnectionPNames.SO_KEEPALIVE, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreConnectionPNames#SO_KEEPALIVE} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param enableKeepalive SO_KEEPALIVE.
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static void setSoKeepalive(final HttpParams params, final boolean enableKeepalive) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setBooleanParameter(CoreConnectionPNames.SO_KEEPALIVE, enableKeepalive);
|
||||
}
|
||||
|
||||
}
|
||||
78
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParamConfig.java
vendored
Normal file
78
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParamConfig.java
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
|
||||
import ch.boye.httpclientandroidlib.config.ConnectionConfig;
|
||||
import ch.boye.httpclientandroidlib.config.MessageConstraints;
|
||||
import ch.boye.httpclientandroidlib.config.SocketConfig;
|
||||
|
||||
/**
|
||||
* @deprecated (4.3) provided for compatibility with {@link HttpParams}. Do not use.
|
||||
*
|
||||
* @since 4.3
|
||||
*/
|
||||
@Deprecated
|
||||
public final class HttpParamConfig {
|
||||
|
||||
private HttpParamConfig() {
|
||||
}
|
||||
|
||||
public static SocketConfig getSocketConfig(final HttpParams params) {
|
||||
return SocketConfig.custom()
|
||||
.setSoTimeout(params.getIntParameter(CoreConnectionPNames.SO_TIMEOUT, 0))
|
||||
.setSoReuseAddress(params.getBooleanParameter(CoreConnectionPNames.SO_REUSEADDR, false))
|
||||
.setSoKeepAlive(params.getBooleanParameter(CoreConnectionPNames.SO_KEEPALIVE, false))
|
||||
.setSoLinger(params.getIntParameter(CoreConnectionPNames.SO_LINGER, -1))
|
||||
.setTcpNoDelay(params.getBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true))
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MessageConstraints getMessageConstraints(final HttpParams params) {
|
||||
return MessageConstraints.custom()
|
||||
.setMaxHeaderCount(params.getIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, -1))
|
||||
.setMaxLineLength(params.getIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, -1))
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ConnectionConfig getConnectionConfig(final HttpParams params) {
|
||||
final MessageConstraints messageConstraints = getMessageConstraints(params);
|
||||
final String csname = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
|
||||
return ConnectionConfig.custom()
|
||||
.setCharset(csname != null ? Charset.forName(csname) : null)
|
||||
.setMalformedInputAction((CodingErrorAction)
|
||||
params.getParameter(CoreProtocolPNames.HTTP_MALFORMED_INPUT_ACTION))
|
||||
.setMalformedInputAction((CodingErrorAction)
|
||||
params.getParameter(CoreProtocolPNames.HTTP_UNMAPPABLE_INPUT_ACTION))
|
||||
.setMessageConstraints(messageConstraints)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
195
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParams.java
vendored
Normal file
195
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParams.java
vendored
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
/**
|
||||
* HttpParams interface represents a collection of immutable values that define
|
||||
* a runtime behavior of a component. HTTP parameters should be simple objects:
|
||||
* integers, doubles, strings, collections and objects that remain immutable
|
||||
* at runtime. HttpParams is expected to be used in 'write once - read many' mode.
|
||||
* Once initialized, HTTP parameters are not expected to mutate in
|
||||
* the course of HTTP message processing.
|
||||
* <p>
|
||||
* The purpose of this interface is to define a behavior of other components.
|
||||
* Usually each complex component has its own HTTP parameter collection.
|
||||
* <p>
|
||||
* Instances of this interface can be linked together to form a hierarchy.
|
||||
* In the simplest form one set of parameters can use content of another one
|
||||
* to obtain default values of parameters not present in the local set.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public interface HttpParams {
|
||||
|
||||
/**
|
||||
* Obtains the value of the given parameter.
|
||||
*
|
||||
* @param name the parent name.
|
||||
*
|
||||
* @return an object that represents the value of the parameter,
|
||||
* <code>null</code> if the parameter is not set or if it
|
||||
* is explicitly set to <code>null</code>
|
||||
*
|
||||
* @see #setParameter(String, Object)
|
||||
*/
|
||||
Object getParameter(String name);
|
||||
|
||||
/**
|
||||
* Assigns the value to the parameter with the given name.
|
||||
*
|
||||
* @param name parameter name
|
||||
* @param value parameter value
|
||||
*/
|
||||
HttpParams setParameter(String name, Object value);
|
||||
|
||||
/**
|
||||
* Creates a copy of these parameters.
|
||||
*
|
||||
* @return a new set of parameters holding the same values as this one
|
||||
*/
|
||||
HttpParams copy();
|
||||
|
||||
/**
|
||||
* Removes the parameter with the specified name.
|
||||
*
|
||||
* @param name parameter name
|
||||
*
|
||||
* @return true if the parameter existed and has been removed, false else.
|
||||
*/
|
||||
boolean removeParameter(String name);
|
||||
|
||||
/**
|
||||
* Returns a {@link Long} parameter value with the given name.
|
||||
* If the parameter is not explicitly set, the default value is returned.
|
||||
*
|
||||
* @param name the parent name.
|
||||
* @param defaultValue the default value.
|
||||
*
|
||||
* @return a {@link Long} that represents the value of the parameter.
|
||||
*
|
||||
* @see #setLongParameter(String, long)
|
||||
*/
|
||||
long getLongParameter(String name, long defaultValue);
|
||||
|
||||
/**
|
||||
* Assigns a {@link Long} to the parameter with the given name
|
||||
*
|
||||
* @param name parameter name
|
||||
* @param value parameter value
|
||||
*/
|
||||
HttpParams setLongParameter(String name, long value);
|
||||
|
||||
/**
|
||||
* Returns an {@link Integer} parameter value with the given name.
|
||||
* If the parameter is not explicitly set, the default value is returned.
|
||||
*
|
||||
* @param name the parent name.
|
||||
* @param defaultValue the default value.
|
||||
*
|
||||
* @return a {@link Integer} that represents the value of the parameter.
|
||||
*
|
||||
* @see #setIntParameter(String, int)
|
||||
*/
|
||||
int getIntParameter(String name, int defaultValue);
|
||||
|
||||
/**
|
||||
* Assigns an {@link Integer} to the parameter with the given name
|
||||
*
|
||||
* @param name parameter name
|
||||
* @param value parameter value
|
||||
*/
|
||||
HttpParams setIntParameter(String name, int value);
|
||||
|
||||
/**
|
||||
* Returns a {@link Double} parameter value with the given name.
|
||||
* If the parameter is not explicitly set, the default value is returned.
|
||||
*
|
||||
* @param name the parent name.
|
||||
* @param defaultValue the default value.
|
||||
*
|
||||
* @return a {@link Double} that represents the value of the parameter.
|
||||
*
|
||||
* @see #setDoubleParameter(String, double)
|
||||
*/
|
||||
double getDoubleParameter(String name, double defaultValue);
|
||||
|
||||
/**
|
||||
* Assigns a {@link Double} to the parameter with the given name
|
||||
*
|
||||
* @param name parameter name
|
||||
* @param value parameter value
|
||||
*/
|
||||
HttpParams setDoubleParameter(String name, double value);
|
||||
|
||||
/**
|
||||
* Returns a {@link Boolean} parameter value with the given name.
|
||||
* If the parameter is not explicitly set, the default value is returned.
|
||||
*
|
||||
* @param name the parent name.
|
||||
* @param defaultValue the default value.
|
||||
*
|
||||
* @return a {@link Boolean} that represents the value of the parameter.
|
||||
*
|
||||
* @see #setBooleanParameter(String, boolean)
|
||||
*/
|
||||
boolean getBooleanParameter(String name, boolean defaultValue);
|
||||
|
||||
/**
|
||||
* Assigns a {@link Boolean} to the parameter with the given name
|
||||
*
|
||||
* @param name parameter name
|
||||
* @param value parameter value
|
||||
*/
|
||||
HttpParams setBooleanParameter(String name, boolean value);
|
||||
|
||||
/**
|
||||
* Checks if a boolean parameter is set to <code>true</code>.
|
||||
*
|
||||
* @param name parameter name
|
||||
*
|
||||
* @return <tt>true</tt> if the parameter is set to value <tt>true</tt>,
|
||||
* <tt>false</tt> if it is not set or set to <code>false</code>
|
||||
*/
|
||||
boolean isParameterTrue(String name);
|
||||
|
||||
/**
|
||||
* Checks if a boolean parameter is not set or <code>false</code>.
|
||||
*
|
||||
* @param name parameter name
|
||||
*
|
||||
* @return <tt>true</tt> if the parameter is either not set or
|
||||
* set to value <tt>false</tt>,
|
||||
* <tt>false</tt> if it is set to <code>true</code>
|
||||
*/
|
||||
boolean isParameterFalse(String name);
|
||||
|
||||
}
|
||||
57
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParamsNames.java
vendored
Normal file
57
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpParamsNames.java
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Gives access to the full set of parameter names.
|
||||
*
|
||||
* @see HttpParams
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public interface HttpParamsNames {
|
||||
|
||||
/**
|
||||
* Returns the current set of names;
|
||||
* in the case of stacked parameters, returns the names
|
||||
* from all the participating HttpParams instances.
|
||||
*
|
||||
* Changes to the underlying HttpParams are not reflected
|
||||
* in the set - it is a snapshot.
|
||||
*
|
||||
* @return the names, as a Set<String>
|
||||
*/
|
||||
Set<String> getNames();
|
||||
|
||||
}
|
||||
69
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpProtocolParamBean.java
vendored
Normal file
69
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpProtocolParamBean.java
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import ch.boye.httpclientandroidlib.HttpVersion;
|
||||
|
||||
/**
|
||||
* This is a Java Bean class that can be used to wrap an instance of
|
||||
* {@link HttpParams} and manipulate HTTP protocol parameters using Java Beans
|
||||
* conventions.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public class HttpProtocolParamBean extends HttpAbstractParamBean {
|
||||
|
||||
public HttpProtocolParamBean (final HttpParams params) {
|
||||
super(params);
|
||||
}
|
||||
|
||||
public void setHttpElementCharset (final String httpElementCharset) {
|
||||
HttpProtocolParams.setHttpElementCharset(params, httpElementCharset);
|
||||
}
|
||||
|
||||
public void setContentCharset (final String contentCharset) {
|
||||
HttpProtocolParams.setContentCharset(params, contentCharset);
|
||||
}
|
||||
|
||||
public void setVersion (final HttpVersion version) {
|
||||
HttpProtocolParams.setVersion(params, version);
|
||||
}
|
||||
|
||||
public void setUserAgent (final String userAgent) {
|
||||
HttpProtocolParams.setUserAgent(params, userAgent);
|
||||
}
|
||||
|
||||
public void setUseExpectContinue (final boolean useExpectContinue) {
|
||||
HttpProtocolParams.setUseExpectContinue(params, useExpectContinue);
|
||||
}
|
||||
|
||||
}
|
||||
240
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpProtocolParams.java
vendored
Normal file
240
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/HttpProtocolParams.java
vendored
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
|
||||
import ch.boye.httpclientandroidlib.HttpVersion;
|
||||
import ch.boye.httpclientandroidlib.ProtocolVersion;
|
||||
import ch.boye.httpclientandroidlib.protocol.HTTP;
|
||||
import ch.boye.httpclientandroidlib.util.Args;
|
||||
|
||||
/**
|
||||
* Utility class for accessing protocol parameters in {@link HttpParams}.
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@Deprecated
|
||||
public final class HttpProtocolParams implements CoreProtocolPNames {
|
||||
|
||||
private HttpProtocolParams() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreProtocolPNames#HTTP_ELEMENT_CHARSET} parameter.
|
||||
* If not set, defaults to <code>US-ASCII</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return HTTP element charset.
|
||||
*/
|
||||
public static String getHttpElementCharset(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
String charset = (String) params.getParameter
|
||||
(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
|
||||
if (charset == null) {
|
||||
charset = HTTP.DEF_PROTOCOL_CHARSET.name();
|
||||
}
|
||||
return charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreProtocolPNames#HTTP_ELEMENT_CHARSET} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param charset HTTP element charset.
|
||||
*/
|
||||
public static void setHttpElementCharset(final HttpParams params, final String charset) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreProtocolPNames#HTTP_CONTENT_CHARSET} parameter.
|
||||
* If not set, defaults to <code>ISO-8859-1</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return HTTP content charset.
|
||||
*/
|
||||
public static String getContentCharset(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
String charset = (String) params.getParameter
|
||||
(CoreProtocolPNames.HTTP_CONTENT_CHARSET);
|
||||
if (charset == null) {
|
||||
charset = HTTP.DEF_CONTENT_CHARSET.name();
|
||||
}
|
||||
return charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreProtocolPNames#HTTP_CONTENT_CHARSET} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param charset HTTP content charset.
|
||||
*/
|
||||
public static void setContentCharset(final HttpParams params, final String charset) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreProtocolPNames#PROTOCOL_VERSION} parameter.
|
||||
* If not set, defaults to {@link HttpVersion#HTTP_1_1}.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return HTTP protocol version.
|
||||
*/
|
||||
public static ProtocolVersion getVersion(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
final Object param = params.getParameter
|
||||
(CoreProtocolPNames.PROTOCOL_VERSION);
|
||||
if (param == null) {
|
||||
return HttpVersion.HTTP_1_1;
|
||||
}
|
||||
return (ProtocolVersion)param;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreProtocolPNames#PROTOCOL_VERSION} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param version HTTP protocol version.
|
||||
*/
|
||||
public static void setVersion(final HttpParams params, final ProtocolVersion version) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreProtocolPNames#USER_AGENT} parameter.
|
||||
* If not set, returns <code>null</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return User agent string.
|
||||
*/
|
||||
public static String getUserAgent(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return (String) params.getParameter(CoreProtocolPNames.USER_AGENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreProtocolPNames#USER_AGENT} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param useragent User agent string.
|
||||
*/
|
||||
public static void setUserAgent(final HttpParams params, final String useragent) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setParameter(CoreProtocolPNames.USER_AGENT, useragent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreProtocolPNames#USE_EXPECT_CONTINUE} parameter.
|
||||
* If not set, returns <code>false</code>.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @return User agent string.
|
||||
*/
|
||||
public static boolean useExpectContinue(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
return params.getBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreProtocolPNames#USE_EXPECT_CONTINUE} parameter.
|
||||
*
|
||||
* @param params HTTP parameters.
|
||||
* @param b expect-continue flag.
|
||||
*/
|
||||
public static void setUseExpectContinue(final HttpParams params, final boolean b) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains value of the {@link CoreProtocolPNames#HTTP_MALFORMED_INPUT_ACTION} parameter.
|
||||
* @param params HTTP parameters.
|
||||
* @return Action to perform upon receiving a malformed input
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static CodingErrorAction getMalformedInputAction(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
final Object param = params.getParameter(CoreProtocolPNames.HTTP_MALFORMED_INPUT_ACTION);
|
||||
if (param == null) {
|
||||
// the default CodingErrorAction
|
||||
return CodingErrorAction.REPORT;
|
||||
}
|
||||
return (CodingErrorAction) param;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets value of the {@link CoreProtocolPNames#HTTP_MALFORMED_INPUT_ACTION} parameter.
|
||||
* @param params HTTP parameters
|
||||
* @param action action to perform on malformed inputs
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static void setMalformedInputAction(final HttpParams params, final CodingErrorAction action) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setParameter(CoreProtocolPNames.HTTP_MALFORMED_INPUT_ACTION, action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the value of the {@link CoreProtocolPNames#HTTP_UNMAPPABLE_INPUT_ACTION} parameter.
|
||||
* @param params HTTP parameters
|
||||
* @return Action to perform upon receiving a unmapped input
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static CodingErrorAction getUnmappableInputAction(final HttpParams params) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
final Object param = params.getParameter(CoreProtocolPNames.HTTP_UNMAPPABLE_INPUT_ACTION);
|
||||
if (param == null) {
|
||||
// the default CodingErrorAction
|
||||
return CodingErrorAction.REPORT;
|
||||
}
|
||||
return (CodingErrorAction) param;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the {@link CoreProtocolPNames#HTTP_UNMAPPABLE_INPUT_ACTION} parameter.
|
||||
* @param params HTTP parameters
|
||||
* @param action action to perform on un mappable inputs
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static void setUnmappableInputAction(final HttpParams params, final CodingErrorAction action) {
|
||||
Args.notNull(params, "HTTP parameters");
|
||||
params.setParameter(CoreProtocolPNames.HTTP_UNMAPPABLE_INPUT_ACTION, action);
|
||||
}
|
||||
|
||||
}
|
||||
89
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/SyncBasicHttpParams.java
vendored
Normal file
89
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/SyncBasicHttpParams.java
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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 ch.boye.httpclientandroidlib.params;
|
||||
|
||||
import ch.boye.httpclientandroidlib.annotation.ThreadSafe;
|
||||
|
||||
/**
|
||||
* Thread-safe extension of the {@link BasicHttpParams}.
|
||||
*
|
||||
* @since 4.1
|
||||
*
|
||||
* @deprecated (4.3) use configuration classes provided 'ch.boye.httpclientandroidlib.config'
|
||||
* and 'ch.boye.httpclientandroidlib.client.config'
|
||||
*/
|
||||
@ThreadSafe
|
||||
@Deprecated
|
||||
public class SyncBasicHttpParams extends BasicHttpParams {
|
||||
|
||||
private static final long serialVersionUID = 5387834869062660642L;
|
||||
|
||||
public SyncBasicHttpParams() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean removeParameter(final String name) {
|
||||
return super.removeParameter(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized HttpParams setParameter(final String name, final Object value) {
|
||||
return super.setParameter(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Object getParameter(final String name) {
|
||||
return super.getParameter(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isParameterSet(final String name) {
|
||||
return super.isParameterSet(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isParameterSetLocally(final String name) {
|
||||
return super.isParameterSetLocally(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setParameters(final String[] names, final Object value) {
|
||||
super.setParameters(names, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void clear() {
|
||||
super.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
}
|
||||
32
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/package-info.java
vendored
Normal file
32
mobile/android/thirdparty/ch/boye/httpclientandroidlib/params/package-info.java
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* ====================================================================
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deprecated.
|
||||
* @deprecated (4.3).
|
||||
*/
|
||||
package ch.boye.httpclientandroidlib.params;
|
||||
Loading…
Add table
Add a link
Reference in a new issue