home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (examples.apt)

This example source code file (examples.apt) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java tags/keywords

apache, custom, examples, foundation, generally, http, httpclient, license, preemptive, see, software, ssl, the, this

The examples.apt example source code

~~ ====================================================================
~~ 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/>.

    ----------
    HttpComponents HttpClient Examples
    ----------
    ----------
    ----------

HttpClient Examples

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java}Response handling}}

    This example demonstrates how to process HTTP responses using a response handler. This is 
    the recommended way of executing HTTP requests and processing HTTP responses. This approach 
    enables the caller to concentrate on the process of digesting HTTP responses and to delegate 
    the task of system resource deallocation to HttpClient. The use of an HTTP response guarantees
    that the underlying HTTP connection will be released back to the connection manager automatically
    in all cases.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java}Manual connection release}}
    
    This example demonstrates how to ensure the release of the underlying HTTP connection back to 
    the connection manager in case of a manual processing of HTTP responses.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java}Abort method}}
    
    This example demonstrates how to abort an HTTP request before its normal completion.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java}Client authentication}}
    
    This example uses HttpClient to execute an HTTP request against a target site that requires user
    authentication.  

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java}Request via a proxy}}
    
    This example demonstrates how to send an HTTP request via a proxy.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java}Proxy authentication}}
    
    A simple example showing execution of an HTTP request over a secure connection tunneled through 
    an authenticating proxy.  

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java}Chunk encoded POST}}
    
    This example shows how to stream out a request entity using chunk encoding.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java}Custom execution context}}
    
    This example demonstrates the use of a local HTTP context populated custom attributes.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientFormLogin.java}Form based logon}}
    
    This example demonstrates how HttpClient can be used to perform form-based logon.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java}Threaded request execution}}
    
    An example that executes HTTP requests from multiple worker threads.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java}Custom SSL context}}
    
    This example demonstrates how to create secure connections with a custom SSL context.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientGZipContentCompression.java}Custom protocol interceptors}}

    This example shows the use of protocol interceptors to transparently modify properties of HTTP 
    messages sent / received by the HTTP client.
 
    In this particular case HTTP client is made capable of transparent content GZIP compression by 
    adding two protocol interceptors: a request interceptor that adds 'Accept-Encoding: gzip' header
    to all outgoing requests and a response interceptor that automatically expands compressed 
    response entities by wrapping them with a uncompressing decorator class. The use of protocol 
    interceptors makes content compression completely transparent to the consumer of the HttpClient
    interface.
    
    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java}Preemptive BASIC authentication}}
    
    This example shows how HttpClient can be customized to authenticate preemptively using BASIC 
    scheme. Generally, preemptive authentication can be considered less secure than a response to 
    an authentication challenge and therefore discouraged.

    * {{{http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java}Preemptive DIGEST authentication}}
    
    This example shows how HttpClient can be customized to authenticate preemptively using DIGEST 
    scheme. Generally, preemptive authentication can be considered less secure than a response to 
    an authentication challenge and therefore discouraged.

Other Java examples (source code examples)

Here is a short list of links related to this Java examples.apt source code file:



my book on functional programming

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.