Forums Register Login

getParameter

+Pie Number of slices to send: Send
In Mikalai notes under getParameter(String name) method it says:
If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via getInputStream() or getReader() can interfere with the execution of this method.

What does this mean?
+Pie Number of slices to send: Send
The following line is from the servlet API documentation

According to the API getReader()

Retrieves the body of the request as character data using a BufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method or getInputStream() may be called to read the body, not both.

and for getInputStream()

Retrieves the body of the request as binary data using a ServletInputStream. Either this method or getReader() may be called to read the body, not both.

In case the parameters are sent using a POST request i.e as part of the request body when you use getParameter() along with getReader()/getInputStream() then you might not get the expected result this is what it means i am not quite sure about the exact reason, the API also states that getReader() and getInputStream() cannot not used simultaneously to read the request body
+Pie Number of slices to send: Send
i have a baseline doubt in these ques..
except for getInputStream
are the other methods in 1.4 exam?
they didnt turn up in hfsj...
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 855 times.
Similar Threads
Difference between getAttribute and getParameter
request.getReader()???
Parsing content body from a GET request
request.getParam...
Clarrification about HttpServletRequest
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:01:38.