You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by William Speirs <ws...@apache.org> on 2011/12/02 22:12:40 UTC

Modifying the URI of an HttpRequest

What is the easiest way to modify the URI of an HttpRequest?

I'm about to write code like this:
HttpRequest newReq = new BasicHttpRequest(// fill in with method, new uri,
and protocol version);
// copy all headers
// copy entity body

This seems like a lot of work when I all I really want is a .setUri()
method.

Ideas?

Bill-

Re: Modifying the URI of an HttpRequest

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2011-12-02 at 16:30 -0500, William Speirs wrote:
> Basically, my question is why isn't there a setRequestLine method for the
> HttpRquest interface? The HttpMessage interface has all kinds of set
> methods for headers and such, why not a set method for RequestLine in
> HttpRequest?
> 
> Thanks...
> 
> Bill-
> 

Basically there is no good reason.

Oleg


> On Fri, Dec 2, 2011 at 4:12 PM, William Speirs <ws...@apache.org> wrote:
> 
> > What is the easiest way to modify the URI of an HttpRequest?
> >
> > I'm about to write code like this:
> > HttpRequest newReq = new BasicHttpRequest(// fill in with method, new uri,
> > and protocol version);
> > // copy all headers
> > // copy entity body
> >
> > This seems like a lot of work when I all I really want is a .setUri()
> > method.
> >
> > Ideas?
> >
> > Bill-
> >



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Modifying the URI of an HttpRequest

Posted by William Speirs <ws...@apache.org>.
Basically, my question is why isn't there a setRequestLine method for the
HttpRquest interface? The HttpMessage interface has all kinds of set
methods for headers and such, why not a set method for RequestLine in
HttpRequest?

Thanks...

Bill-

On Fri, Dec 2, 2011 at 4:12 PM, William Speirs <ws...@apache.org> wrote:

> What is the easiest way to modify the URI of an HttpRequest?
>
> I'm about to write code like this:
> HttpRequest newReq = new BasicHttpRequest(// fill in with method, new uri,
> and protocol version);
> // copy all headers
> // copy entity body
>
> This seems like a lot of work when I all I really want is a .setUri()
> method.
>
> Ideas?
>
> Bill-
>