You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by TearsOfAllah <pa...@yahoo.com> on 2010/06/08 19:00:40 UTC

Problem with post request parameters in servlets

I'm trying to get the response from  servlets by sending post request with
parameters to the servlets. But despite of servlets response, I'm getting
blank output. Firebug showing blank response. But If I send the post request
without request parameter, or at the time refreshing a page, I get the
response.  

I've implement CometProcessor interface in servlets, and I'm using Tomcat 6
as a webserver. May I know the reason of the problem?

This is how I'm trying to respond to the client request, I've already
enabled NIO connector in server.xml file.

public void event(CometEvent event) 
	throws IOException, ServletException {
    
	HttpServletRequest request = event.getHttpServletRequest();
	HttpServletResponse response = event.getHttpServletResponse();
	String username = request.getParameter("username");
	String password = request.getParameter("password");
	if (event.getEventType() == CometEvent.EventType.BEGIN) {
	    PrintWriter out = response.getWriter();
            out.println("HELLO");
            out.flush();
       }
}
-- 
View this message in context: http://old.nabble.com/Problem-with-post-request-parameters-in-servlets-tp28820496p28820496.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem with post request parameters in servlets

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To whom it may concern,

On 6/8/2010 3:11 PM, TearsOfAllah wrote:
> 
> 
> If I don't use request.getParameter() method despite of making same request
> with parameters in my servlets code, I'm not getting any blank response in
> my browser. 
> 
> This is how I set connector tag in server.xml file:
>  
> <Connector connectionTimeout="20000" port="8081"
> protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>

I'm not sure it's legal to use request.getParameter() in a Comet BEGIN
request.

Given that Comet is supposed to be built around asynchronous I/O, I
suspect that you'll have to read your own parameters if you want to do
things in the BEGIN event.

See this message in the archives for some more coherent thoughts:
http://mail-archives.apache.org/mod_mbox/tomcat-users/200705.mbox/%3C0FCD6632-1521-454D-B9C2-E7571F22D9D4@objektpark.de%3E

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwO408ACgkQ9CaO5/Lv0PCpegCfQ4ShR89/1LakElbHPB3sXUfi
4XwAoIKcnAJCMJUc5xT04uhkdVidm2aX
=pKSC
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem with post request parameters in servlets

Posted by TearsOfAllah <pa...@yahoo.com>.

If I don't use request.getParameter() method despite of making same request
with parameters in my servlets code, I'm not getting any blank response in
my browser. 

This is how I set connector tag in server.xml file:
 
<Connector connectionTimeout="20000" port="8081"
protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
-- 
View this message in context: http://old.nabble.com/Problem-with-post-request-parameters-in-servlets-tp28820496p28821904.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem with post request parameters in servlets

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To whom it may concern,

On 6/8/2010 1:00 PM, TearsOfAllah wrote:
> I'm trying to get the response from  servlets by sending post request with
> parameters to the servlets. But despite of servlets response, I'm getting
> blank output. Firebug showing blank response. But If I send the post request
> without request parameter, or at the time refreshing a page, I get the
> response.  

When you say "without request parameter[s]", do you mean that you are
sending a POST with no /GET/ parameters? Perhaps you could give us a
more complete example.

> I've implement CometProcessor interface in servlets, and I'm using Tomcat 6
> as a webserver. May I know the reason of the problem?
> 
> This is how I'm trying to respond to the client request, I've already
> enabled NIO connector in server.xml file.

Please post your <Connector> configuration.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwOfHIACgkQ9CaO5/Lv0PAnEACcCB5t3/eNOnqOsiiDXjaRcey4
croAoLpHxjKzZf4znyN1XwV40IH10l9T
=fUQw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org