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 Alec Swan <al...@gmail.com> on 2011/03/24 21:59:59 UTC

Programmatically download file from servlet using form authentication on Tomcat

Hello,

We have a servlet which generates a report and allows user to download
it as a CSV file. The servlet is deployed on Tomcat and secured using
form authentication.

We would like to to invoke the servlet and download the file
programmatically using Apache Commons HttpClient API. Could anybody
provide advice or code sample showing how to get HttpClient request
through form authentication?

Any help would be greatly appreciated.

Thanks

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


Re: Programmatically download file from servlet using form authentication on Tomcat

Posted by sebb <se...@gmail.com>.
On 24 March 2011 20:59, Alec Swan <al...@gmail.com> wrote:
> Hello,
>
> We have a servlet which generates a report and allows user to download
> it as a CSV file. The servlet is deployed on Tomcat and secured using
> form authentication.
>
> We would like to to invoke the servlet and download the file
> programmatically using Apache Commons HttpClient API. Could anybody

Commons HttpClient is legacy code - please consider using
HttpComponents HttpClient.

> provide advice or code sample showing how to get HttpClient request
> through form authentication?
>
> Any help would be greatly appreciated.

Have you had a look at the HttpComponents web-site?  http://hc.apache.org/
There's plenty of documentation there.

If you must use Commons HttpClient:

http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/src/examples/

Otherwise, HC HttpClient:

http://hc.apache.org/httpcomponents-client-ga/examples.html

Both URLs have examples of form login.


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

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