From: gian on
Hi,
I m not expert for the things I'm going to tell you and maybe I'll be
inaccurate.My english is very poor ..so try to be patients.. :-)

I am developing an application that includes a
servlet.This servlet
make a redirect to another application (a site that
I know credentials.. username and password.)
What I have to do?

I think my servlet have to do a http post with the correct parameters
(the same post that is made
by a real user ) using a HttpUrlConnection .. (right?) and
then a response.sendRedirect (url).
or a forward?()the 2 applications are residents in the same websphere
application server)

The application where I want to log-on uses cookies in the process of
log-on (but I do not know how to handle them) and also the https ..
In your opinion is correct as a way of proceeding? "

Am I forgetting something?
Thanks a lot in advance.

Cheers
Gian
From: Arne Vajhøj on
On 31-07-2010 17:21, gian wrote:
> I m not expert for the things I'm going to tell you and maybe I'll be
> inaccurate.My english is very poor ..so try to be patients.. :-)
>
> I am developing an application that includes a
> servlet.This servlet
> make a redirect to another application (a site that
> I know credentials.. username and password.)
> What I have to do?
>
> I think my servlet have to do a http post with the correct parameters
> (the same post that is made
> by a real user ) using a HttpUrlConnection .. (right?) and
> then a response.sendRedirect (url).
> or a forward?()the 2 applications are residents in the same websphere
> application server)
>
> The application where I want to log-on uses cookies in the process of
> log-on (but I do not know how to handle them) and also the https ..
> In your opinion is correct as a way of proceeding? "
>
> Am I forgetting something?

If you want to redirect, then you just do a redirect. I believe you
can configure WebSphere to log you into all apps at once.

If you want to include content then you need to send the
HTTP request. If that is the case, then my suggestion is that
you go with Apache HttpClient instead of plain HttpURLConnection.

Arne
From: Stanimir Stamenkov on
Sat, 31 Jul 2010 14:21:19 -0700 (PDT), /gian/:

> The application where I want to log-on uses cookies in the process of
> log-on (but I do not know how to handle them) and also the https ..

You may use the Apache's HttpClient which will handle the cookies
for you:

http://hc.apache.org/httpcomponents-client-4.0.1/index.html

--
Stanimir
From: Tom Anderson on
On Sat, 31 Jul 2010, gian wrote:

> I am developing an application that includes a servlet.This servlet make
> a redirect to another application (a site that I know credentials..
> username and password.) What I have to do?

It might be easiest to send a normal 200 response, containing some simple
HTML with a form to log into the second application, and a javascript
onload handler that submits the form. Essentially, simulate a normal login
from the browser.

Logging into the second application and then passing a cookie to the
client, as i think you want to do, might be possible, but it will fail if
the other application associates a client IP address with the cookie or
anything like that. Plus, i don't think you can handle an HTTPS login this
way.

tom

--
It's the 21st century, man - we rue _minutes_. -- Benjamin Rosenbaum
From: gian on
On 31 Lug, 23:42, Stanimir Stamenkov <s7a...(a)netscape.net> wrote:
> Sat, 31 Jul 2010 14:21:19 -0700 (PDT), /gian/:
>
> > The application where I want to log-on uses cookies in the process of
> > log-on (but I  do not know how to handle them) and also the https ..
>
> You may use the Apache's HttpClient which will handle the cookies
> for you:
>
> http://hc.apache.org/httpcomponents-client-4.0.1/index.html
>
> --
> Stanimir

yes i know but i cant use http client for version problem.httpclient
want java 5 and i have to use java 1.4