You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Manish Moorjani <Ma...@infosys.com> on 2004/08/30 15:38:35 UTC

Refesh Button Issue !1!

Hi,

I have written an application that uses Httpclient to automatic login into other Applications
and display the home page on the browser.

Some of the other applications use GET and some use POST for login .

For an application that uses POST for login I face a strange issue.

When I press the refresh button on the home page after login(accessing thru my application)
It shows me the login screen !!!!

I investigated further and found out this 

When I tried accessing the application directly by going to login screen and then entering username
and password and then going to the home page
Then when I press the  Refresh Button, I get a POP up which says that u are trying to resubmit the
information do u want to continue(Something like this)
When I say yes, I again reach the home page as the login details are submitted again
This happens because the browser knows that it was a POST request !!!!

When I access the application thru my code it is a get request so the browser does not try to resend the data and hence
I am shown the login screen .
Is there is a workaround possible ? Please help me

Regards,
Manish Moorjani
Infosys Technologies Ltd.
Phone: 91-44-24509530/40/50 Extn. 80395
"If you are still amazed by something you accomplished yesterday then today has been a waste"


-----Original Message-----
From: Eric Bloch [mailto:bloch@laszlosystems.com]
Sent: Monday, August 30, 2004 12:53 PM
To: Commons HttpClient Project
Subject: ant file for converting src from commons-logging to log4j for
2.0.1


Attached is an ant build file that can be plopped into your basedir for 
httpclient.  (I tested it with the 2.0.1 src distro rather than a cvs 
dir.)

% ant -buildfile commons-logging-to-log4j.xml -projecthelp
Buildfile: commons-logging-to-log4j.xml
Main targets:

  convert                     convert source from commons-logging to 

                              log4j apis
  install-log4j-properties    copy log4j properties to classes dir
  make-src-backup             make src.orig directory
  revert                      Put original java source code back
  uninstall-log4j-properties  remove log4j properties from classes dir


With some massaging, these targets could probably be renamed and merged 
into build.xml and maintained there (and probably belong there).  Also, 
in my envirionment, I used a build.properties that has 
${commons-logging.jar} pointing to a copy of log4j.jar.  If I were going 
to maintain this inside the commons-httpclient/build.*, I'd rename the 
commons-logging.jar property to ${logging-jar}, too, so things would 
make a little more sense.

I ran the tests and it seems to basically work.  I can now, happily say 
'bubbye' to commons-logging.

Enjoy
-Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: Refesh Button Issue !1!

Posted by Ortwin Glück <or...@nose.ch>.
Manish,

Are you writing some kind of 'proxy' like in the image below?

Browser <----> your proxy <----> the webapp requiring authentication

A webapp needs to keep track of a user in the user session (internal 
state). HTTP provides the cookie mechanism to enable webapps to match a 
session with a request. If you proxy the communication to a webapp you 
must be able to provide the right session cookie to the application.

That means that your proxy needs to establish both, a session with the 
webapp and a session with the client and do the translation between the 
two. Please note, that cookies are subject to security restrictions. A 
cookie can only be set and read by the same host(domain). This means 
that you have to proxy *all* communication between the client and the 
webapp. You can not only perform the login by the proxy and then access 
the webapp directly from the client bypassing the proxy. This also means 
that you need to do URL rewriting in all the HTML code so that your 
proxy is used.

Ortwin Glück

Manish Moorjani wrote:

> Hi,
> 
> I have written an application that uses Httpclient to automatic login into other Applications
> and display the home page on the browser.
> 
> Some of the other applications use GET and some use POST for login .
> 
> For an application that uses POST for login I face a strange issue.
> 
> When I press the refresh button on the home page after login(accessing thru my application)
> It shows me the login screen !!!!
> 
> I investigated further and found out this 
> 
> When I tried accessing the application directly by going to login screen and then entering username
> and password and then going to the home page
> Then when I press the  Refresh Button, I get a POP up which says that u are trying to resubmit the
> information do u want to continue(Something like this)
> When I say yes, I again reach the home page as the login details are submitted again
> This happens because the browser knows that it was a POST request !!!!
> 
> When I access the application thru my code it is a get request so the browser does not try to resend the data and hence
> I am shown the login screen .
> Is there is a workaround possible ? Please help me
> 
> Regards,
> Manish Moorjani
> Infosys Technologies Ltd.
> Phone: 91-44-24509530/40/50 Extn. 80395
> "If you are still amazed by something you accomplished yesterday then today has been a waste"
> 
> 
> [removed quoted message that had nothing to do with this issue]

-- 
  _________________________________________________________________
  NOSE applied intelligence ag

  ortwin glück                      [www]      http://www.nose.ch
  software engineer
  hardturmstrasse 171               [pgp id]           0x81CF3416
  8005 zürich                       [office]      +41-1-277 57 35
  switzerland                       [fax]         +41-1-277 57 12

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org