當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpProtocolParams類代碼示例

本文整理匯總了Java中ch.boye.httpclientandroidlib.params.HttpProtocolParams的典型用法代碼示例。如果您正苦於以下問題:Java HttpProtocolParams類的具體用法?Java HttpProtocolParams怎麽用?Java HttpProtocolParams使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HttpProtocolParams類屬於ch.boye.httpclientandroidlib.params包,在下文中一共展示了HttpProtocolParams類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createSessionInputBuffer

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
@Override
protected SessionInputBuffer createSessionInputBuffer(
        final Socket socket,
        final int buffersize,
        final HttpParams params) throws IOException {
    SessionInputBuffer inbuffer = super.createSessionInputBuffer(
            socket,
            buffersize > 0 ? buffersize : 8192,
            params);
    if (wireLog.isDebugEnabled()) {
        inbuffer = new LoggingSessionInputBuffer(
                inbuffer,
                new Wire(wireLog),
                HttpProtocolParams.getHttpElementCharset(params));
    }
    return inbuffer;
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:18,代碼來源:DefaultClientConnection.java

示例2: createSessionOutputBuffer

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
@Override
protected SessionOutputBuffer createSessionOutputBuffer(
        final Socket socket,
        final int buffersize,
        final HttpParams params) throws IOException {
    SessionOutputBuffer outbuffer = super.createSessionOutputBuffer(
            socket,
            buffersize > 0 ? buffersize : 8192,
            params);
    if (wireLog.isDebugEnabled()) {
        outbuffer = new LoggingSessionOutputBuffer(
                outbuffer,
                new Wire(wireLog),
                HttpProtocolParams.getHttpElementCharset(params));
    }
    return outbuffer;
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:18,代碼來源:DefaultClientConnection.java

示例3: createDefaultHttpParams

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
/**
 * Creates default params setting the user agent.
 * 
 * @return Basic HTTP parameters with a custom user agent
 */
protected HttpParams createDefaultHttpParams() {
	HttpParams params = new BasicHttpParams();
	HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
	String version = Version.getSpecification();
	if (version == null) {
		version = VersionInfo.UNAVAILABLE;
	}
	HttpProtocolParams.setUserAgent(params, "Sardine/" + version);
	// Only selectively enable this for PUT but not all entity enclosing
	// methods
	HttpProtocolParams.setUseExpectContinue(params, false);
	HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
	HttpProtocolParams.setContentCharset(params,
			HTTP.DEFAULT_CONTENT_CHARSET);

	HttpConnectionParams.setTcpNoDelay(params, true);
	HttpConnectionParams.setSocketBufferSize(params, 8192);
	return params;
}
 
開發者ID:starn,項目名稱:encdroidMC,代碼行數:25,代碼來源:SardineImpl.java

示例4: createConnectRequest

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
/**
 * Creates the CONNECT request for tunnelling.
 * Called by {@link #createTunnelToTarget createTunnelToTarget}.
 *
 * @param route     the route to establish
 * @param context   the context for request execution
 *
 * @return  the CONNECT request for tunnelling
 */
protected HttpRequest createConnectRequest(final HttpRoute route,
                                           final HttpContext context) {
    // see RFC 2817, section 5.2 and
    // INTERNET-DRAFT: Tunneling TCP based protocols through
    // Web proxy servers

    final HttpHost target = route.getTargetHost();

    final String host = target.getHostName();
    int port = target.getPort();
    if (port < 0) {
        final Scheme scheme = connManager.getSchemeRegistry().
            getScheme(target.getSchemeName());
        port = scheme.getDefaultPort();
    }

    final StringBuilder buffer = new StringBuilder(host.length() + 6);
    buffer.append(host);
    buffer.append(':');
    buffer.append(Integer.toString(port));

    final String authority = buffer.toString();
    final ProtocolVersion ver = HttpProtocolParams.getVersion(params);
    final HttpRequest req = new BasicHttpRequest
        ("CONNECT", authority, ver);

    return req;
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:38,代碼來源:DefaultRequestDirector.java

示例5: prepareClient

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
/**
 * Invoke this after delegate and request have been set.
 * @throws NoSuchAlgorithmException
 * @throws KeyManagementException
 */
protected void prepareClient() throws KeyManagementException, NoSuchAlgorithmException, GeneralSecurityException {
  context = new BasicHttpContext();

  // We could reuse these client instances, except that we mess around
  // with their parameters… so we'd need a pool of some kind.
  client = new DefaultHttpClient(getConnectionManager());

  // TODO: Eventually we should use Apache HttpAsyncClient. It's not out of alpha yet.
  // Until then, we synchronously make the request, then invoke our delegate's callback.
  AuthHeaderProvider authHeaderProvider = delegate.getAuthHeaderProvider();
  if (authHeaderProvider != null) {
    Header authHeader = authHeaderProvider.getAuthHeader(request, context, client);
    if (authHeader != null) {
      request.addHeader(authHeader);
      Logger.debug(LOG_TAG, "Added auth header.");
    }
  }

  addAuthCacheToContext(request, context);

  HttpParams params = client.getParams();
  HttpConnectionParams.setConnectionTimeout(params, delegate.connectionTimeout());
  HttpConnectionParams.setSoTimeout(params, delegate.socketTimeout());
  HttpConnectionParams.setStaleCheckingEnabled(params, false);
  HttpProtocolParams.setContentCharset(params, charset);
  HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
  final String userAgent = delegate.getUserAgent();
  if (userAgent != null) {
    HttpProtocolParams.setUserAgent(params, userAgent);
  }
  delegate.addHeaders(request, client);
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:38,代碼來源:BaseResource.java

示例6: getProtocolVersion

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
public ProtocolVersion getProtocolVersion() {
    return version != null ? version : HttpProtocolParams.getVersion(getParams());
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:4,代碼來源:HttpRequestBase.java

示例7: getProtocolVersion

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
public ProtocolVersion getProtocolVersion() {
    if (this.version == null) {
        this.version = HttpProtocolParams.getVersion(getParams());
    }
    return this.version;
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:7,代碼來源:RequestWrapper.java

示例8: setDefaultHttpParams

import ch.boye.httpclientandroidlib.params.HttpProtocolParams; //導入依賴的package包/類
/**
 * Saves the default set of HttpParams in the provided parameter.
 * These are:
 * <ul>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreProtocolPNames#PROTOCOL_VERSION}:
 *   1.1</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreProtocolPNames#HTTP_CONTENT_CHARSET}:
 *   ISO-8859-1</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreConnectionPNames#TCP_NODELAY}:
 *   true</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreConnectionPNames#SOCKET_BUFFER_SIZE}:
 *   8192</li>
 * <li>{@link ch.boye.httpclientandroidlib.params.CoreProtocolPNames#USER_AGENT}:
 *   Apache-HttpClient/<release> (java 1.5)</li>
 * </ul>
 */
public static void setDefaultHttpParams(final HttpParams params) {
    HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
    HttpProtocolParams.setContentCharset(params, HTTP.DEF_CONTENT_CHARSET.name());
    HttpConnectionParams.setTcpNoDelay(params, true);
    HttpConnectionParams.setSocketBufferSize(params, 8192);
    HttpProtocolParams.setUserAgent(params, HttpClientBuilder.DEFAULT_USER_AGENT);
}
 
開發者ID:mozilla-mobile,項目名稱:FirefoxData-android,代碼行數:24,代碼來源:DefaultHttpClient.java


注:本文中的ch.boye.httpclientandroidlib.params.HttpProtocolParams類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。