You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2011/02/01 14:45:53 UTC
svn commit: r1066044 - in /httpcomponents/httpcore/trunk/src/docbkx:
advanced.xml nio-ext.xml
Author: olegk
Date: Tue Feb 1 13:45:52 2011
New Revision: 1066044
URL: http://svn.apache.org/viewvc?rev=1066044&view=rev
Log:
HTTPCORE-251, HTTPCORE-252: Fixed several typos in the HttpCore tutorial, updated code samples
Contributed by Neeme Praks <neeme at apache.org>
Modified:
httpcomponents/httpcore/trunk/src/docbkx/advanced.xml
httpcomponents/httpcore/trunk/src/docbkx/nio-ext.xml
Modified: httpcomponents/httpcore/trunk/src/docbkx/advanced.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/src/docbkx/advanced.xml?rev=1066044&r1=1066043&r2=1066044&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/src/docbkx/advanced.xml (original)
+++ httpcomponents/httpcore/trunk/src/docbkx/advanced.xml Tue Feb 1 13:45:52 2011
@@ -81,7 +81,7 @@ System.out.println(cursor);
<para>
<interfacename>LineParser</interfacename> is the interface for parsing lines in the
head section of an HTTP message. There are individual methods for parsing a request
- line, a status line, or a header line. The lines to parse are passed in memory, the
+ line, a status line, or a header line. The lines to parse are passed in-memory, the
parser does not depend on any specific I/O mechanism.
</para>
<programlisting><![CDATA[
@@ -246,7 +246,7 @@ if (outbuffer.hasData()) {
<section>
<title>HTTP message parsers and formatter</title>
<para>
- HttpCore also provides a coarse-grained facade type of interfaces for parsing and
+ HttpCore also provides coarse-grained facade type interfaces for parsing and
formatting of HTTP messages. Default implementations of those interfaces build upon the
functionality provided by <interfacename>SessionInputBuffer</interfacename> /
<interfacename>SessionOutputBuffer</interfacename> and <interfacename>HttpLineParser
@@ -309,7 +309,7 @@ SessionOutputBuffer outbuffer;
HttpParams params = new BasicHttpParams();
-NHttpMessageParser requestParser = new HttpRequestParser(
+NHttpMessageParser requestParser = new DefaultHttpRequestParser(
inbuffer,
new BasicLineParser(),
new DefaultHttpRequestFactory(),
@@ -317,7 +317,7 @@ NHttpMessageParser requestParser = new H
HttpRequest request = (HttpRequest) requestParser.parse();
-NHttpMessageWriter requestWriter = new HttpRequestWriter(
+NHttpMessageWriter requestWriter = new DefaultHttpRequestWriter(
outbuffer,
new BasicLineFormatter(),
params);
@@ -333,7 +333,7 @@ SessionOutputBuffer outbuffer;
HttpParams params = new BasicHttpParams();
-NHttpMessageParser responseParser = new HttpResponseParser(
+NHttpMessageParser responseParser = new DefaultHttpResponseParser(
inbuffer,
new BasicLineParser(),
new DefaultHttpResponseFactory(),
@@ -341,7 +341,7 @@ NHttpMessageParser responseParser = new
HttpResponse response = (HttpResponse) responseParser.parse();
-NHttpMessageWriter responseWriter = new HttpResponseWriter(
+NHttpMessageWriter responseWriter = new DefaultHttpResponseWriter(
outbuffer,
new BasicLineFormatter(),
params);
@@ -380,42 +380,6 @@ if (h1 instanceof FormattedHeader) {
input/output buffers.
</para>
<programlisting><![CDATA[
-class MyDefaultNHttpClientConnection
- extends DefaultNHttpClientConnection {
-
- public MyDefaultNHttpClientConnection(
- IOSession session,
- HttpResponseFactory responseFactory,
- ByteBufferAllocator allocator,
- HttpParams params) {
- super(session, responseFactory, allocator, params);
- }
-
- @Override
- protected NHttpMessageWriter createRequestWriter(
- SessionOutputBuffer buffer,
- HttpParams params) {
- return new HttpRequestWriter(
- buffer, new BasicLineFormatter(), params);
- }
-
- @Override
- protected NHttpMessageParser createResponseParser(
- SessionInputBuffer buffer,
- HttpResponseFactory responseFactory,
- HttpParams params) {
- return new HttpResponseParser(
- buffer, new BasicLineParser(), responseFactory, params);
- }
-
-};
-]]></programlisting>
- <para>
- For non-blocking HTTP connection implementation one can replace the default HTTP message
- parser and formatter implementations. The session input/output buffer implementations can
- be overridden at the I/O reactor level.
- </para>
- <programlisting><![CDATA[
class MyDefaultHttpClientConnection
extends DefaultHttpClientConnection {
@@ -454,5 +418,41 @@ class MyDefaultHttpClientConnection
};
]]></programlisting>
+ <para>
+ For non-blocking HTTP connection implementation one can replace the default HTTP message
+ parser and formatter implementations. The session input/output buffer implementations can
+ be overridden at the I/O reactor level.
+ </para>
+ <programlisting><![CDATA[
+class MyDefaultNHttpClientConnection
+ extends DefaultNHttpClientConnection {
+
+ public MyDefaultNHttpClientConnection(
+ IOSession session,
+ HttpResponseFactory responseFactory,
+ ByteBufferAllocator allocator,
+ HttpParams params) {
+ super(session, responseFactory, allocator, params);
+ }
+
+ @Override
+ protected NHttpMessageWriter createRequestWriter(
+ SessionOutputBuffer buffer,
+ HttpParams params) {
+ return new HttpRequestWriter(
+ buffer, new BasicLineFormatter(), params);
+ }
+
+ @Override
+ protected NHttpMessageParser createResponseParser(
+ SessionInputBuffer buffer,
+ HttpResponseFactory responseFactory,
+ HttpParams params) {
+ return new HttpResponseParser(
+ buffer, new BasicLineParser(), responseFactory, params);
+ }
+
+};
+]]></programlisting>
</section>
</chapter>
Modified: httpcomponents/httpcore/trunk/src/docbkx/nio-ext.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/src/docbkx/nio-ext.xml?rev=1066044&r1=1066043&r2=1066044&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/src/docbkx/nio-ext.xml (original)
+++ httpcomponents/httpcore/trunk/src/docbkx/nio-ext.xml Tue Feb 1 13:45:52 2011
@@ -1328,7 +1328,7 @@ NHttpRequestHandler myRequestHandler = n
public ConsumingNHttpEntity entityRequest(
HttpEntityEnclosingRequest request,
HttpContext context) throws HttpException, IOException {
- // Buffer imcoming content in memory for simplicity
+ // Buffer incoming content in memory for simplicity
return new BufferingNHttpEntity(request.getEntity(),
new HeapByteBufferAllocator());
}
@@ -1371,7 +1371,7 @@ NHttpRequestHandler myRequestHandler = n
public ConsumingNHttpEntity entityRequest(
HttpEntityEnclosingRequest request,
HttpContext context) throws HttpException, IOException {
- // Buffer imcoming content in memory for simplicity
+ // Buffer incoming content in memory for simplicity
return new BufferingNHttpEntity(request.getEntity(),
new HeapByteBufferAllocator());
}
@@ -1603,7 +1603,7 @@ NHttpRequestExecutionHandler execHandler
public ConsumingNHttpEntity responseEntity(
HttpResponse response,
HttpContext context) throws IOException {
- // Buffer imcoming content in memory for simplicity
+ // Buffer incoming content in memory for simplicity
return new BufferingNHttpEntity(response.getEntity(),
new HeapByteBufferAllocator());
}