• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to use GET request to post form data

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This sounds a simple problem but bugging me like anything. I have a simple form on a JSP, something like,


We are using tomcat as the J2EE container and the submitted data flows through Apache Http server(I have rewrite rules here) to tomcat.
I am using following rewrite rule


Now, when the data is posted as a GET request, the part, sessionid="sessionkey", in the action URL on the form just disappears and all the data in the form gets appended after "?". If it is a POST request then there is no problem and it works fine. Any idea what can be wrong?

Thank you very much and I really appreciate everybody's time and help.
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

crk crkcrk wrote:We are using tomcat as the J2EE container and the submitted data flows through Apache Http server(I have rewrite rules here) to tomcat.


Tomcat is not a fully compliant JEE server rather it's a web container.

Now, when the data is posted as a GET request, the part, sessionid="sessionkey", in the action URL on the form just disappears and all the data in the form gets appended after "?". If it is a POST request then there is no problem and it works fine. Any idea what can be wrong?


I'm not sure I get the first part of that statement but with GET, all the request parameters gets appended to the request URL, that's how it works. (I'm not sure about the rewrite rule though)
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And you might need to look at the NamingPolicy of JR. And Welcome to JavaRanch
 
Chris Kairns
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for pointing me to the Naming Policy.

Regarding the answer, I know what tomcat is and how a GET request is posted, I haven't asked whether tomcat is a J2EE container or web container or how a GET request is posted.

Does anybody know what is the issue in the scenario I have posted above?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why the complexity of the Apache front end? That's not a configuration that is used much these days.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Kairns wrote:Now, when the data is posted as a GET request, the part, sessionid="sessionkey", in the action URL on the form just disappears and all the data in the form gets appended after "?". If it is a POST request then there is no problem and it works fine. Any idea what can be wrong?


Hmm.. I didn't get that part in the first place, That is, with GET the query string is generated and appended to the URL after "?" so what ever was there previously will not be available (that is the case with you having the "sessionid" value in the action). With POST the action URL kept unchanged as there is no query string in the URL. Is this what you are looking for?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Why the complexity of the Apache front end? That's not a configuration that is used much these days.


That doesn't match my experience. I actually see that configuration a lot, wth Apache used as SSL terminator, as load-balancer, and for its modules. Sometimes ModRewrite alone -which Chris mentioned- makes it worth using.
 
Chris Kairns
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Appreciate both of you for the replies !

Bear : This is the configuration that is used in the environment I work in. It may be totally wrong or invalid or not used now a days, but I cannot change it now and I have to follow it.

Vijitha : I don't rememebr exactly now, but I think I have used something the way I am doing now and it had worked for me. But , indirectly you are saying POST my form after generating the URL I want so it willl work fine?

For example,
Instead of relying on GET method use POST and generate the post url using Javascript like,



Or there is other way using the GET request.

Thanks a lot, both of you again, for your time and help !





 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The syntax is more correctly ";sessionkey=..." (or was it ";jsessionkey=..."?). And I'm not actually sure how that fits in with the actual URL RFC, truthfully, despite its popularity. A number of things are routinely done that aren't actually RFC-compilant.

But that's beside the point. It looks like probably an issue with Apache's mod_rewrite. I'd have to RTF(Apache)M to be able to say what the proper solution (rule encoding) was.
reply
    Bookmark Topic Watch Topic
  • New Topic