Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > servlet + login + cookies+ https

Reply
Thread Tools

servlet + login + cookies+ https

 
 
gian
Guest
Posts: n/a
 
      07-31-2010
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
 
Reply With Quote
 
 
 
 
Arne Vajh°j
Guest
Posts: n/a
 
      07-31-2010
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
 
Reply With Quote
 
 
 
 
Stanimir Stamenkov
Guest
Posts: n/a
 
      07-31-2010
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-...0.1/index.html

--
Stanimir
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      07-31-2010
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
 
Reply With Quote
 
gian
Guest
Posts: n/a
 
      08-01-2010
On 31 Lug, 23:42, Stanimir Stamenkov <(E-Mail Removed)> 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-...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
 
Reply With Quote
 
gian
Guest
Posts: n/a
 
      08-01-2010
On 1 Ago, 00:15, Tom Anderson <(E-Mail Removed)> wrote:
> 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.
>
>
> tom
>
> --
> Sound fine..(but i dont understand the 200 response..)

you say (if i understand well)your idea is servlet generate the html
and the javascript..
I will try ..

 
Reply With Quote
 
Stanimir Stamenkov
Guest
Posts: n/a
 
      08-01-2010
Sat, 31 Jul 2010 22:37:53 -0700 (PDT), /gian/:

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


What about previous versions:

http://hc.apache.org/httpclient-3.x/index.html
http://hc.apache.org/downloads.cgi#C...ent_3.1_legacy

--
Stanimir
 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      08-01-2010
On 01-08-2010 01:37, gian wrote:
> On 31 Lug, 23:42, Stanimir Stamenkov<(E-Mail Removed)> 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-...0.1/index.html

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


3.x should run on 1.4 and it has more or less the same functionality.

The API may not be quite as OO'ish, but ...

Arne

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      08-01-2010
gian wrote:
>> yes i know but i cant use http client for version problem.httpclient
>> want java [sic] 5 and i have to use java [sic] 1.4


Just out of curiosity, why are you stuck on an obsolete version? What is the
client's reasoning?

--
Lew
 
Reply With Quote
 
gian
Guest
Posts: n/a
 
      08-01-2010
On 1 Ago, 15:17, Lew <(E-Mail Removed)> wrote:
> gian wrote:
> >> yes i know but i cant use http client for version problem.httpclient
> >> want java [sic] 5 and i have to use java [sic] 1.4

>
> Just out of curiosity, why are you stuck on an obsolete version? *What is the
> client's reasoning?
>
> --
> Lew


websphere AS
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
server side redirect https => https NOT working Axel ASP General 8 04-27-2009 02:02 AM
https authentication & storing https page in string Naveen Dhanuka Ruby 1 09-19-2007 02:05 PM
open-uri and HTTPS, or net/https with a redirect jotto Ruby 4 10-02-2006 07:26 AM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Applet Servlet communication via HTTPS Ng Wee Peng Java 1 04-01-2004 06:21 PM



Advertisments