Re: [HttpClient] enum for methods?

2018-07-16 Thread Gary Gregory
Thank you Oleg. I think we can consider this thread closed.

Gary

On Sat, Jul 14, 2018 at 4:41 AM Oleg Kalnichevski  wrote:

> On Fri, 2018-07-13 at 13:40 -0600, Gary Gregory wrote:
> > On Fri, Jul 13, 2018 at 12:24 PM Oleg Kalnichevski 
> > wrote:
> >
> > > On Fri, 2018-07-13 at 10:27 -0600, Gary Gregory wrote:
> > > >
> > >
> > > ...
> > >
> > > >
> > > > This is now in git master but I think I need another tweak: I
> > > > made
> > > > the
> > > > return type for HttpRequests the class HttpUriRequestBase instead
> > > > of
> > > > an
> > > > interface. I left ClassicHttpRequests to return
> > > > ClassicHttpRequest
> > > > but now
> > > > I wonder if it would not be more flexible to make it return
> > > > HttpUriRequestBase
> > > > as well. Thoughts?
> > > >
> > >
> > > Hi Gary
> > >
> > > I am sorry it was not quite clear what exactly I had meant. I just
> > > wanted to have a similar enum applicable to the async methods that
> > > use
> > > generic HttpRequest / HttpResponse classes.
> > >
> > > I tweaked your code slightly. Please have a look.
> > >
> >
> > Hi Oleg,
> >
> > Looks good.
> >
> > The remaining question is what should be the return type for
> > ClassicHttpRequests.create(URI):  ClassicHttpRequest or
> > HttpUriRequestBase?
> >
>
> I suppose it should have been HttpUriRequestBase. Corrected.
>
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/0abadca8
>
> Oleg
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
> For additional commands, e-mail: dev-h...@hc.apache.org
>
>


Re: [HttpClient] enum for methods?

2018-07-14 Thread Oleg Kalnichevski
On Fri, 2018-07-13 at 13:40 -0600, Gary Gregory wrote:
> On Fri, Jul 13, 2018 at 12:24 PM Oleg Kalnichevski 
> wrote:
> 
> > On Fri, 2018-07-13 at 10:27 -0600, Gary Gregory wrote:
> > > 
> > 
> > ...
> > 
> > > 
> > > This is now in git master but I think I need another tweak: I
> > > made
> > > the
> > > return type for HttpRequests the class HttpUriRequestBase instead
> > > of
> > > an
> > > interface. I left ClassicHttpRequests to return
> > > ClassicHttpRequest
> > > but now
> > > I wonder if it would not be more flexible to make it return
> > > HttpUriRequestBase
> > > as well. Thoughts?
> > > 
> > 
> > Hi Gary
> > 
> > I am sorry it was not quite clear what exactly I had meant. I just
> > wanted to have a similar enum applicable to the async methods that
> > use
> > generic HttpRequest / HttpResponse classes.
> > 
> > I tweaked your code slightly. Please have a look.
> > 
> 
> Hi Oleg,
> 
> Looks good.
> 
> The remaining question is what should be the return type for
> ClassicHttpRequests.create(URI):  ClassicHttpRequest or
> HttpUriRequestBase?
> 

I suppose it should have been HttpUriRequestBase. Corrected.

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/0abadca8

Oleg

-
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



Re: [HttpClient] enum for methods?

2018-07-13 Thread Gary Gregory
On Fri, Jul 13, 2018 at 12:24 PM Oleg Kalnichevski  wrote:

> On Fri, 2018-07-13 at 10:27 -0600, Gary Gregory wrote:
> >
>
> ...
>
> >
> > This is now in git master but I think I need another tweak: I made
> > the
> > return type for HttpRequests the class HttpUriRequestBase instead of
> > an
> > interface. I left ClassicHttpRequests to return ClassicHttpRequest
> > but now
> > I wonder if it would not be more flexible to make it return
> > HttpUriRequestBase
> > as well. Thoughts?
> >
>
> Hi Gary
>
> I am sorry it was not quite clear what exactly I had meant. I just
> wanted to have a similar enum applicable to the async methods that use
> generic HttpRequest / HttpResponse classes.
>
> I tweaked your code slightly. Please have a look.
>

Hi Oleg,

Looks good.

The remaining question is what should be the return type for
ClassicHttpRequests.create(URI):  ClassicHttpRequest or HttpUriRequestBase?

Thank you,
Gary


> Oleg
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
> For additional commands, e-mail: dev-h...@hc.apache.org
>
>


Re: [HttpClient] enum for methods?

2018-07-13 Thread Oleg Kalnichevski
On Fri, 2018-07-13 at 10:27 -0600, Gary Gregory wrote:
> 

...

> 
> This is now in git master but I think I need another tweak: I made
> the
> return type for HttpRequests the class HttpUriRequestBase instead of
> an
> interface. I left ClassicHttpRequests to return ClassicHttpRequest
> but now
> I wonder if it would not be more flexible to make it return
> HttpUriRequestBase
> as well. Thoughts?
> 

Hi Gary

I am sorry it was not quite clear what exactly I had meant. I just
wanted to have a similar enum applicable to the async methods that use
generic HttpRequest / HttpResponse classes.

I tweaked your code slightly. Please have a look.

Oleg

-
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



Re: [HttpClient] enum for methods?

2018-07-13 Thread Gary Gregory
On Thu, Jul 12, 2018 at 6:15 PM Gary Gregory  wrote:

>
>
> On Thu, Jul 12, 2018 at 2:40 PM Oleg Kalnichevski 
> wrote:
>
>> On Thu, 2018-07-12 at 09:35 -0600, Gary Gregory wrote:
>> > On Wed, Jul 11, 2018 at 3:18 PM Oleg Kalnichevski 
>> > wrote:
>> >
>> > > On Wed, 2018-07-11 at 10:01 -0600, Gary Gregory wrote:
>> > > > On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski > > > > rg>
>> > > > wrote:
>> > > >
>> > > > > On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
>> > > > > > Hi All,
>> > > > > >
>> > > > > > In my apps, I usually have this enum, handy for
>> > > > > > parameterizing
>> > > > > > things
>> > > > > > like
>> > > > > > tests.
>> > > > > >
>> > > > >
>> > > > > There is already one called StandardMethods. Would that be
>> > > > > enough?
>> > > > >
>> > > >
>> > > > Yes :-) but I can add factory methods to create request objects
>> > > > as in
>> > > > my
>> > > > version (Using the version 5 interface instead of 4)? For
>> > > > example:
>> > > >
>> > >
>> > > This would make StandardMethods dependent on the classic I/O model,
>> > > which is not ideal in my option. What is wrong with just having a
>> > > factory class (which can be an enum if that suits you)?
>> > >
>> >
>> > So basically the enum I started this thread with but called
>> > ClassicHttpRequests
>> > (or  ClassicHttpRequestFactory) in HttpClient?
>> >
>>
>> ClassicHttpRequests works for me. Can you make HttpRequests for generic
>> requests as well?
>>
>
> Will do.
>

This is now in git master but I think I need another tweak: I made the
return type for HttpRequests the class HttpUriRequestBase instead of an
interface. I left ClassicHttpRequests to return ClassicHttpRequest but now
I wonder if it would not be more flexible to make it return HttpUriRequestBase
as well. Thoughts?

Gary


> Gary
>
>
>>
>> Oleg
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
>> For additional commands, e-mail: dev-h...@hc.apache.org
>>
>>


Re: [HttpClient] enum for methods?

2018-07-13 Thread Gary Gregory
I am also thinking that the enum StandardMethods should be renamed
to StandardMethod (singular); other enums we have are singular.

Gary

On Thu, Jul 12, 2018 at 6:15 PM Gary Gregory  wrote:

>
>
> On Thu, Jul 12, 2018 at 2:40 PM Oleg Kalnichevski 
> wrote:
>
>> On Thu, 2018-07-12 at 09:35 -0600, Gary Gregory wrote:
>> > On Wed, Jul 11, 2018 at 3:18 PM Oleg Kalnichevski 
>> > wrote:
>> >
>> > > On Wed, 2018-07-11 at 10:01 -0600, Gary Gregory wrote:
>> > > > On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski > > > > rg>
>> > > > wrote:
>> > > >
>> > > > > On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
>> > > > > > Hi All,
>> > > > > >
>> > > > > > In my apps, I usually have this enum, handy for
>> > > > > > parameterizing
>> > > > > > things
>> > > > > > like
>> > > > > > tests.
>> > > > > >
>> > > > >
>> > > > > There is already one called StandardMethods. Would that be
>> > > > > enough?
>> > > > >
>> > > >
>> > > > Yes :-) but I can add factory methods to create request objects
>> > > > as in
>> > > > my
>> > > > version (Using the version 5 interface instead of 4)? For
>> > > > example:
>> > > >
>> > >
>> > > This would make StandardMethods dependent on the classic I/O model,
>> > > which is not ideal in my option. What is wrong with just having a
>> > > factory class (which can be an enum if that suits you)?
>> > >
>> >
>> > So basically the enum I started this thread with but called
>> > ClassicHttpRequests
>> > (or  ClassicHttpRequestFactory) in HttpClient?
>> >
>>
>> ClassicHttpRequests works for me. Can you make HttpRequests for generic
>> requests as well?
>>
>
> Will do.
>
> Gary
>
>
>>
>> Oleg
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
>> For additional commands, e-mail: dev-h...@hc.apache.org
>>
>>


Re: [HttpClient] enum for methods?

2018-07-12 Thread Gary Gregory
On Thu, Jul 12, 2018 at 2:40 PM Oleg Kalnichevski  wrote:

> On Thu, 2018-07-12 at 09:35 -0600, Gary Gregory wrote:
> > On Wed, Jul 11, 2018 at 3:18 PM Oleg Kalnichevski 
> > wrote:
> >
> > > On Wed, 2018-07-11 at 10:01 -0600, Gary Gregory wrote:
> > > > On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski  > > > rg>
> > > > wrote:
> > > >
> > > > > On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
> > > > > > Hi All,
> > > > > >
> > > > > > In my apps, I usually have this enum, handy for
> > > > > > parameterizing
> > > > > > things
> > > > > > like
> > > > > > tests.
> > > > > >
> > > > >
> > > > > There is already one called StandardMethods. Would that be
> > > > > enough?
> > > > >
> > > >
> > > > Yes :-) but I can add factory methods to create request objects
> > > > as in
> > > > my
> > > > version (Using the version 5 interface instead of 4)? For
> > > > example:
> > > >
> > >
> > > This would make StandardMethods dependent on the classic I/O model,
> > > which is not ideal in my option. What is wrong with just having a
> > > factory class (which can be an enum if that suits you)?
> > >
> >
> > So basically the enum I started this thread with but called
> > ClassicHttpRequests
> > (or  ClassicHttpRequestFactory) in HttpClient?
> >
>
> ClassicHttpRequests works for me. Can you make HttpRequests for generic
> requests as well?
>

Will do.

Gary


>
> Oleg
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
> For additional commands, e-mail: dev-h...@hc.apache.org
>
>


Re: [HttpClient] enum for methods?

2018-07-12 Thread Oleg Kalnichevski
On Thu, 2018-07-12 at 09:35 -0600, Gary Gregory wrote:
> On Wed, Jul 11, 2018 at 3:18 PM Oleg Kalnichevski 
> wrote:
> 
> > On Wed, 2018-07-11 at 10:01 -0600, Gary Gregory wrote:
> > > On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski  > > rg>
> > > wrote:
> > > 
> > > > On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
> > > > > Hi All,
> > > > > 
> > > > > In my apps, I usually have this enum, handy for
> > > > > parameterizing
> > > > > things
> > > > > like
> > > > > tests.
> > > > > 
> > > > 
> > > > There is already one called StandardMethods. Would that be
> > > > enough?
> > > > 
> > > 
> > > Yes :-) but I can add factory methods to create request objects
> > > as in
> > > my
> > > version (Using the version 5 interface instead of 4)? For
> > > example:
> > > 
> > 
> > This would make StandardMethods dependent on the classic I/O model,
> > which is not ideal in my option. What is wrong with just having a
> > factory class (which can be an enum if that suits you)?
> > 
> 
> So basically the enum I started this thread with but called
> ClassicHttpRequests
> (or  ClassicHttpRequestFactory) in HttpClient?
> 

ClassicHttpRequests works for me. Can you make HttpRequests for generic
requests as well? 

Oleg

-
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



Re: [HttpClient] enum for methods?

2018-07-12 Thread Julian Reschke

On 2018-07-11 16:55, Oleg Kalnichevski wrote:

On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:

Hi All,

In my apps, I usually have this enum, handy for parameterizing things
like
tests.



There is already one called StandardMethods. Would that be enough?

Oleg


Methods are an extension point in the protocol, so an "enum" seems to be 
a bad idea here.


FWIW, what was the criterium for what methods are included in 
"StandardMethods"???


Best regards, Julian

-
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



Re: [HttpClient] enum for methods?

2018-07-12 Thread Gary Gregory
On Wed, Jul 11, 2018 at 3:18 PM Oleg Kalnichevski  wrote:

> On Wed, 2018-07-11 at 10:01 -0600, Gary Gregory wrote:
> > On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski 
> > wrote:
> >
> > > On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
> > > > Hi All,
> > > >
> > > > In my apps, I usually have this enum, handy for parameterizing
> > > > things
> > > > like
> > > > tests.
> > > >
> > >
> > > There is already one called StandardMethods. Would that be enough?
> > >
> >
> > Yes :-) but I can add factory methods to create request objects as in
> > my
> > version (Using the version 5 interface instead of 4)? For example:
> >
>
> This would make StandardMethods dependent on the classic I/O model,
> which is not ideal in my option. What is wrong with just having a
> factory class (which can be an enum if that suits you)?
>

So basically the enum I started this thread with but called
ClassicHttpRequests
(or  ClassicHttpRequestFactory) in HttpClient?

Gary

>
> Oleg
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
> For additional commands, e-mail: dev-h...@hc.apache.org
>
>


Re: [HttpClient] enum for methods?

2018-07-11 Thread Oleg Kalnichevski
On Wed, 2018-07-11 at 10:01 -0600, Gary Gregory wrote:
> On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski 
> wrote:
> 
> > On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
> > > Hi All,
> > > 
> > > In my apps, I usually have this enum, handy for parameterizing
> > > things
> > > like
> > > tests.
> > > 
> > 
> > There is already one called StandardMethods. Would that be enough?
> > 
> 
> Yes :-) but I can add factory methods to create request objects as in
> my
> version (Using the version 5 interface instead of 4)? For example:
> 

This would make StandardMethods dependent on the classic I/O model,
which is not ideal in my option. What is wrong with just having a
factory class (which can be an enum if that suits you)?

Oleg


-
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org



Re: [HttpClient] enum for methods?

2018-07-11 Thread Gary Gregory
On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski  wrote:

> On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
> > Hi All,
> >
> > In my apps, I usually have this enum, handy for parameterizing things
> > like
> > tests.
> >
>
> There is already one called StandardMethods. Would that be enough?
>

Yes :-) but I can add factory methods to create request objects as in my
version (Using the version 5 interface instead of 4)? For example:

GET {
@Override
public ClassicHttpRequest createClassicHttpRequest(final URI uri) {
return new HttpGet(uri);
}
}

?

Gary


>
> Oleg
>
>
> > /**
>  * HTTP methods defined in RFC2616.
> >  *
> >  * TODO Rename class to RFC2616Method ?
> >  *
> >  * @author mailto:ggreg...@rocketsoftware.com;>Gary
> > Gregory
> >  */
> > public enum HttpMethod {
> > OPTIONS {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpOptions(uri);
> > }
> > },
> > GET {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpGet(uri);
> > }
> > },
> > HEAD {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpHead(uri);
> > }
> > },
> > PATCH {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpPatch(uri);
> > }
> > },
> > POST {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpPost(uri);
> > }
> > },
> > PUT {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpPut(uri);
> > }
> > },
> > DELETE {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpDelete(uri);
> > }
> > },
> > TRACE {
> > @Override
> > public HttpUriRequest createHttpUriRequest(final URI uri) {
> > return new HttpTrace(uri);
> > }
> > };
> >
> > public abstract HttpUriRequest createHttpUriRequest(URI uri);
> > }
> >
> > Any thoughts on adding this to HttpClient? nain or test jar?
> >
> > Gary
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
> For additional commands, e-mail: dev-h...@hc.apache.org
>
>


Re: [HttpClient] enum for methods?

2018-07-11 Thread Oleg Kalnichevski
On Wed, 2018-07-11 at 08:40 -0600, Gary Gregory wrote:
> Hi All,
> 
> In my apps, I usually have this enum, handy for parameterizing things
> like
> tests.
> 

There is already one called StandardMethods. Would that be enough?

Oleg


> /**
 * HTTP methods defined in RFC2616.
>  *
>  * TODO Rename class to RFC2616Method ?
>  *
>  * @author mailto:ggreg...@rocketsoftware.com;>Gary
> Gregory
>  */
> public enum HttpMethod {
> OPTIONS {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpOptions(uri);
> }
> },
> GET {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpGet(uri);
> }
> },
> HEAD {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpHead(uri);
> }
> },
> PATCH {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpPatch(uri);
> }
> },
> POST {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpPost(uri);
> }
> },
> PUT {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpPut(uri);
> }
> },
> DELETE {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpDelete(uri);
> }
> },
> TRACE {
> @Override
> public HttpUriRequest createHttpUriRequest(final URI uri) {
> return new HttpTrace(uri);
> }
> };
> 
> public abstract HttpUriRequest createHttpUriRequest(URI uri);
> }
> 
> Any thoughts on adding this to HttpClient? nain or test jar?
> 
> Gary

-
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org