Have you tried to use URLEncode when you define your URL? I'm not shure if that's the problem but if you wanna try here it goes my example:
URL url = new URL("http://localhost:8000/main?"+URLEncoder.encode("opcao")+
      "="+URLEncoder.encode("visualizar"));
 
 
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Sourabh Kulkarni
Sent: quarta-feira, 5 de Setembro de 2001 10:28
To: [EMAIL PROTECTED]
Subject: getQueryString() and getParameter()

Hi Gurus,
    I am trying to send an object to servlet. The servlet is running on Tomcat 3.2.1 .In my client code, I create a URL object
 
 
    I then open the connection and write the object to the stream. On server side, i had 2 experiences
1] If i use request.getQueryString() and then go ahead with reading the object from the stream, then it works fine.
 
2] If i use request.getParameter("param") and then go ahead with reading the object, I get the following excetpion on server.
 
2001-09-05 02:16:07 - Ctx( /context ): Exception in: R( /context + /servletname + null) - java.lang.IllegalArgumentException
        at javax.servlet.http.HttpUtils.parseQueryString(HttpUtils.java:151)
        at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:254)
        at org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101)
        at org.apache.tomcat.core.RequestImpl.handleParameters(RequestImpl.java:691)
        at org.apache.tomcat.core.RequestImpl.getParameterValues(RequestImpl.java:259)
        at org.apache.tomcat.core.RequestImpl.getParameter(RequestImpl.java:250)
        at org.apache.tomcat.facade.HttpServletRequestFacade.getParameter(HttpServletRequestFacade.java:222)
        at ControllerServlet.service(ControllerServlet.java:61)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
        at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484) 
 
  Can someone tell me why this happens when i use getParameter and not when i use getQueryString?
Thanks in advance,
-Sourabh
 
 

Reply via email to