• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Request input stream

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

I'm having a small issue trying to grab a parameter value from a request. I thought it would just as easy as doing request.getParameter("parameter"); but it isn't in this case.
The parameter I'm looking for is stored in the input stream, I've actually iterated through the request inputstream and found the value there, but it's not in the request parameters. To confirm that it's not in there, I've iterated through the request.getParameters() Enumerable.

The input control is a dropdown list on a jsp page. Every time the user changes the selection in that dropdown list the page executes a post back to retrieve the new data to display.

We use Spring security and other Spring features in what I'll call our "Front" web application. The web app is actually more of a multi-tier app when that specific page is reached, because every time the value gets changed in the dropdown list, we really intercept the request in our Front web app and transfer the request to another web farm to get the response object back, well formatted with the appropriate data. In some ways the "Front" web app is behaving like a proxy.

I tried to read the input stream to extract that value, but it messes up the request being proxied to the other web farm. It looks like the input stream cannot be opened anymore after that.

Anyone would have any idea on how to proceed on that one?

Thanks,
Yann
 
Sheriff
Posts: 67590
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

yann luppo wrote:I'm having a small issue trying to grab a parameter value from a request. I thought it would just as easy as doing request.getParameter("parameter"); but it isn't in this case.


Actually, it is that easy unless you've mucked around with the form's enctype (usually done to allow file uploading as a multi-part request).

You shouldn't have to screw around with the input stream yourself. Is there some aspect of this that you are leaving out?
 
yann luppo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

Well I haven't worked on the jsp page myself so I can't say for sure what the encoding type is, but I will check now and let you know.

Yann.
 
yann luppo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

yann luppo wrote:I'm having a small issue trying to grab a parameter value from a request. I thought it would just as easy as doing request.getParameter("parameter"); but it isn't in this case.


Actually, it is that easy unless you've mucked around with the form's enctype (usually done to allow file uploading as a multi-part request).

You shouldn't have to screw around with the input stream yourself. Is there some aspect of this that you are leaving out?



The request content type is:

"request.getContentType()"= "text/plain; charset=UTF-8"

Is that the correct value or should it be: "application/x-www-form-urlencoded" ?

Oh and if that helps any the request I'm looking at is actually a DWR call.

Thanks for your help.
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes the content type is correct.. By the way the the list is single select (dropdown) and not multiselect .. correct?

Ashwin
 
Bear Bibeault
Sheriff
Posts: 67590
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
The enctype of the form, if specified, is of interest.
 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Yann and all,
Just a silly suggestion. I did read that you read the InputStream, but, you have verified the parameter name is given for the name attribute of the control?
 
yann luppo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ashwin Pai wrote:Yes the content type is correct.. By the way the the list is single select (dropdown) and not multiselect .. correct?

Ashwin



That's correct it's single select.
 
yann luppo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The enctype of the form, if specified, is of interest.



Silly question... but how do I figure out the enctype?
 
yann luppo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gamini Sirisena wrote:Hi Yann and all,
Just a silly suggestion. I did read that you read the InputStream, but, you have verified the parameter name is given for the name attribute of the control?



Well here is the control definition once rendered:



And using firebug I am able to see the post data, line 8 is my parameter defined like this:



 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the inputstream of the request or with some http request debugging tool in the webbrowser.
 
yann luppo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:In the inputstream of the request or with some http request debugging tool in the webbrowser.



Here is the content of the http header according to Firebug:

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With the inputstream of the request I mean the request body, not the request headers.
 
yann luppo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:With the inputstream of the request I mean the request body, not the request headers.



Is it possible that DWR actually modifies the encoding of the inpustream? I believe it serializes the parameters which seems to me like it's modifying to some extent the inputstream format. Any idea if that's true or not and if it is how to go about that?

Thanks,
Yann
 
The knights of nee want a shrubbery. And a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic