On Wed, Jul 11, 2018 at 8:55 AM Oleg Kalnichevski <ol...@apache.org> 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 <a href="mailto:ggreg...@rocketsoftware.com";>Gary
> > Gregory</a>
> >  */
> > 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
>
>

Reply via email to