On Tue, May 16, 2017 at 12:34 AM, Oleg Kalnichevski <[email protected]>
wrote:

> On Mon, 2017-05-15 at 18:29 -0700, Gary Gregory wrote:
> > In order to my HttpAsyncService to be coded cleanly, I would like to
> > add
> > getter methods to HttpAsyncService for subclasses to access instance
> > variables:
> >
> > https://issues.apache.org/jira/browse/HTTPCORE-467
> >
> > Any objections?
> >
> > Gary
> >
>
> Is this really needed? One can easily create a private instance
> variable in the constructor, can't one? This would eliminate the need
> to expose the internals of the class to its subclasses and to increase
> the API footprint.
>

Hi Oleg,

True enough. This would not be pretty but would work. I will delete this
branch and ticket.

The bottom line for my use case is that I just finished an ugly solution
where I need to customize the HTTP status code in responses.

The way I did it is by
overriding 
org.apache.http.nio.protocol.HttpAsyncService.handleException(Exception,
HttpContext) and copying and modifying it into my subclass. The extra ugly
part is that I had to make a complete copy
of org.apache.http.nio.protocol.ErrorResponseProducer since it is package
private. If there is a better way, do let me know please.

My proposed remedy is https://issues.apache.org/jira/browse/HTTPCORE-468
which refactors HttpAsyncService.handleException such that a subclass can
simply override the new method protected int toStatusCode(final Exception
ex, final HttpContext context)

Thoughts on that one?

Gary


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


-- 
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to