On 29 June 2012 14:59, <[email protected]> wrote: > Author: olegk > Date: Fri Jun 29 13:59:57 2012 > New Revision: 1355393 > > URL: http://svn.apache.org/viewvc?rev=1355393&view=rev > Log: > Added Quick Start sources; fixed release notes header > > Added: > > httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java > (with props) > > httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java > (with props) > Modified: > httpcomponents/httpclient/trunk/RELEASE_NOTES.txt > httpcomponents/httpclient/trunk/src/site/apt/quickstart.apt > > Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt > URL: > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=1355393&r1=1355392&r2=1355393&view=diff > ============================================================================== > --- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original) > +++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Fri Jun 29 13:59:57 2012 > @@ -1,7 +1,8 @@ > -Changes since 4.2 > +Release 4.2.1 > ------------------- > > -HttpClient 4.2.1 (GA) is a bug fix release that addresses a number issues > reported since release 4.2. > +HttpClient 4.2.1 (GA) is a bug fix release that addresses a number issues > reported since > +release 4.2.
s/a number issues/a number of issues/ or s/a number issues/several issues/ > Users of HttpClient 4.2 are advised to upgrade. > > > Added: > httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java > URL: > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java?rev=1355393&view=auto > ============================================================================== > --- > httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java > (added) > +++ > httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java > Fri Jun 29 13:59:57 2012 > @@ -0,0 +1,42 @@ > +/* > + * ==================================================================== > + * > + * Licensed to the Apache Software Foundation (ASF) under one or more > + * contributor license agreements. See the NOTICE file distributed with > + * this work for additional information regarding copyright ownership. > + * The ASF licenses this file to You under the Apache License, Version 2.0 > + * (the "License"); you may not use this file except in compliance with > + * the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + * ==================================================================== > + * > + * This software consists of voluntary contributions made by many > + * individuals on behalf of the Apache Software Foundation. For more > + * information on the Apache Software Foundation, please see > + * <http://www.apache.org/>. > + * > + */ > + > +package org.apache.http.client.fluent; > + > +public class FluentQuickStart { > + > + public static void main(String[] args) throws Exception { > + // The fluent API relieves the user from having to deal with manual > + // deallocation of system resources at the cost of having to buffer > + // response content in memory in some cases. > + > + Request.Get("http://targethost/homepage") > + .execute().returnContent(); > + Request.Post("http://targethost/login") > + .bodyForm(Form.form().add("username", "vip").add("password", > "secret").build()) > + .execute().returnContent(); > + } > +} > > Propchange: > httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java > ------------------------------------------------------------------------------ > svn:eol-style = native > > Propchange: > httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java > ------------------------------------------------------------------------------ > svn:keywords = Date Revision > > Propchange: > httpcomponents/httpclient/trunk/fluent-hc/src/examples/org/apache/http/client/fluent/FluentQuickStart.java > ------------------------------------------------------------------------------ > svn:mime-type = text/plain > > Added: > httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java > URL: > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java?rev=1355393&view=auto > ============================================================================== > --- > httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java > (added) > +++ > httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java > Fri Jun 29 13:59:57 2012 > @@ -0,0 +1,84 @@ > +/* > + * ==================================================================== > + * > + * Licensed to the Apache Software Foundation (ASF) under one or more > + * contributor license agreements. See the NOTICE file distributed with > + * this work for additional information regarding copyright ownership. > + * The ASF licenses this file to You under the Apache License, Version 2.0 > + * (the "License"); you may not use this file except in compliance with > + * the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + * ==================================================================== > + * > + * This software consists of voluntary contributions made by many > + * individuals on behalf of the Apache Software Foundation. For more > + * information on the Apache Software Foundation, please see > + * <http://www.apache.org/>. > + * > + */ > + > +package org.apache.http.examples.client; > + > +import java.util.ArrayList; > +import java.util.List; > + > +import org.apache.http.HttpEntity; > +import org.apache.http.HttpResponse; > +import org.apache.http.NameValuePair; > +import org.apache.http.client.entity.UrlEncodedFormEntity; > +import org.apache.http.client.methods.HttpGet; > +import org.apache.http.client.methods.HttpPost; > +import org.apache.http.impl.client.DefaultHttpClient; > +import org.apache.http.message.BasicNameValuePair; > +import org.apache.http.util.EntityUtils; > + > +public class QuickStart { > + > + public static void main(String[] args) throws Exception { > + DefaultHttpClient httpclient = new DefaultHttpClient(); > + HttpGet httpGet = new HttpGet("http://targethost/homepage"); > + > + HttpResponse response1 = httpclient.execute(httpGet); > + > + // The underlying HTTP connection is still held by the response > object > + // to allow the response content to be streamed directly from the > network socket. > + // In order to ensure correct deallocation of system resources > + // the user MUST either fully consume the response content or abort > request > + // execution by calling HttpGet#releaseConnection(). > + > + try { > + System.out.println(response1.getStatusLine()); > + HttpEntity entity1 = response1.getEntity(); > + // do something useful with the response body > + // and ensure it is fully consumed > + EntityUtils.consume(entity1); > + } finally { > + httpGet.releaseConnection(); > + } > + > + HttpPost httpPost = new HttpPost("http://targethost/login"); > + List <NameValuePair> nvps = new ArrayList <NameValuePair>(); > + nvps.add(new BasicNameValuePair("username", "vip")); > + nvps.add(new BasicNameValuePair("password", "secret")); > + httpPost.setEntity(new UrlEncodedFormEntity(nvps)); > + HttpResponse response2 = httpclient.execute(httpPost); > + > + try { > + System.out.println(response2.getStatusLine()); > + HttpEntity entity2 = response2.getEntity(); > + // do something useful with the response body > + // and ensure it is fully consumed > + EntityUtils.consume(entity2); > + } finally { > + httpPost.releaseConnection(); > + } > + } > + > +} > > Propchange: > httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java > ------------------------------------------------------------------------------ > svn:eol-style = native > > Propchange: > httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java > ------------------------------------------------------------------------------ > svn:keywords = Date Revision > > Propchange: > httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java > ------------------------------------------------------------------------------ > svn:mime-type = text/plain > > Modified: httpcomponents/httpclient/trunk/src/site/apt/quickstart.apt > URL: > http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/src/site/apt/quickstart.apt?rev=1355393&r1=1355392&r2=1355393&view=diff > ============================================================================== > --- httpcomponents/httpclient/trunk/src/site/apt/quickstart.apt (original) > +++ httpcomponents/httpclient/trunk/src/site/apt/quickstart.apt Fri Jun 29 > 13:59:57 2012 > @@ -96,6 +96,9 @@ try { > > ------------- > > + Source can be downloaded > + > {{{./httpclient/examples/org/apache/http/examples/client/QuickStart.java}here}} > + > [[3]] The same requests can be executed using a simpler, albeit less > flexible, fluent API. > > ------------- > @@ -111,14 +114,15 @@ Request.Post("http://targethost/login") > > ------------- > > - Please note fluent facade API requires an optional module 'fluent-hc'. > + Source can be downloaded > + > {{{./httpclient/examples/org/apache/http/examples/client/fuent/FluentQuickStart.java}here}} > > [[4]] {{{./examples.html}HttpClient Examples}} - a set of examples > demonstrating some of > the more complex behavior. > > [[5]] {{{./tutorial/html/index.html}HttpClient Tutorial}} - gives a > detailed examination of the > HttpClient API, which was written in close accordance with the (sometimes > not very intuitive) > - HTTP specification/standard. A copy is also shipped with the release. > + HTTP specification/standard. A copy is also shipped with the release. > {{{./tutorial/pdf/httpclient-tutorial.pdf}A PDF version}} is also > available > > [[6]] {{{./primer.html}HttpClient Primer}} - explains the scope of > HttpClient. > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
