jira-importer opened a new issue, #812:
URL: https://github.com/apache/httpcomponents-core/issues/812

   **[Rachel 
Greenham](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rachel)** 
opened 
**[HTTPCORE-132](https://issues.apache.org/jira/browse/HTTPCORE-132?redirect=false)**
 and commented
   
   It appears that for developing a server application using NIO, you can't 
easily define a replacement HttpRequestFactory. It's hardcoded to create a new 
DefaultHttpRequestFactory in DefaultServerIOEventDispatch, in a method that 
can't be overridden because the subclass method also references a **private** 
data member (the allocator) of DefaultServerIOEventDispatch. It could be done 
by also instantiating and supplying an external ByteBufferAllocator in the 
overridden method, which "wastes" the instance created in the constructor. (I 
notice the constructor that lets you supply an allocator in 4.0-alpha6 is gone 
from later versions - but I'm not even interested in replacing the allocator, I 
just want to replace the request factory.)
   
   The way I am doing it is by actually **copying** the current source of 
DefaultServerIOEventDispatch to my project (with a rename) to make my own 
modified version to implement IOEventDispatch - which seems excessive for the 
small change I actually want. The change I made was simply to have a 
constructor that allows me to supply an already-instantiated 
HttpRequestFactory, in a similar fashion to the constructor of 
BufferingHttpServiceHandler takes an instantiated HttpResponseFactory.
   
   This also stops this IOEventDispatch from creating a new instance of the 
**factory** for each hit, which it seems to be doing at the moment...
   
   
   ---
   
   **Affects:** 4.0-alpha6
   
   **Attachments:**
   - 
[ServerIOEventDispatch.java](https://issues.apache.org/jira/secure/attachment/12371703/ServerIOEventDispatch.java)
 (_4.43 kB_)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to