8 Replies Latest reply on Dec 17, 2002 5:24 PM by Vinay Salehithal

    HTTP POST

    s goswami Newbie

      Is HTTP POST supported in JBOSS 3.0.4/4.1.12 ? If so , what needs to done ? The following is the error message I get on the client side.

      "java.io.IOException: Connection failure with 405"
      HTTP Method POST is not supported by this URL.

        • 1. Re: HTTP POST
          Vinay Salehithal Newbie

          how are u accessing yr servlet? one of teh reasons cd be like teh doPost() method is missing.

          cheers
          Vinay Salehithal

          • 2. Re: HTTP POST
            s goswami Newbie

            doPost() is there. what else needs to be set ? there seems to be a whole bunch of *.xml configuration files.

            • 3. Re: HTTP POST
              Vinay Salehithal Newbie

              it wd help if u cd post yr servlet here, and also the htm/whatever from which its invoked.

              cheers
              Vinay Salehithal

              • 4. Re: HTTP POST
                s goswami Newbie

                Here are the code snippets. The client is a simple Applet and the Server is a simple Servlet.

                The Applet
                ==========
                smsurlcon = (HttpURLConnection) nurl.openConnection();
                smsurlcon.setDoOutput(true);
                smsurlcon.setDoInput(true);
                smsurlcon.setUseCaches(false);
                smsurlcon.setRequestProperty("Content type","text/bsv");
                OutputStream os = smsurlcon.getOutputStream();
                String sout = "param="+cmd1+","+cmd2+","+cmd3;
                os.write(sout.getBytes());
                os.flush();
                is = smsurlcon.getInputStream();

                //is = nurl.openStream();
                int i = 0;
                while (!(is.available()>0)&& i < 10)
                {
                i++;
                Thread.currentThread().sleep(100);
                System.out.println(" waiting " + i);
                }

                The Servlet
                ============
                public void doPost(HttpServletRequest request, HttpServletResponse response)
                throws IOException, ServletException
                {
                System.out.println(" Entering doPost()");
                System.out.println("Content type: "+request.getContentType());
                doX(request, response);
                }

                • 5. Re: HTTP POST
                  Vinay Salehithal Newbie

                  try using smsurlcon.setRequestMethod("POST");

                  • 6. Re: HTTP POST
                    s goswami Newbie

                    tried using setting the method to "POST", which by the way does not have anything to do with the server/Tomcat .

                    The client(Applet) uses "POST" as soon as the OutputSream is opened.

                    • 7. Re: HTTP POST - solved (caused by broken JBoss hot deploy)
                      s goswami Newbie

                      I think , the problem is solved. There were two copies of the same Servlet classes in the JBoss jar file and the Tomcat war file. I do not always update the JBoss jar file as that requires a restart (hot deploy is broken in JBoss EJB). The Tomcat war file can be hot deployed. Unfortunately, Tomcat picks up the Servlet class from the EJB jar file rather than the Tomcat war file - I guess that is the price paid for using the same JVM. Although I think it can be corrected.

                      • 8. Re: HTTP POST - solved (caused by broken JBoss hot deploy)
                        Vinay Salehithal Newbie

                        hmmm...interesting.
                        Yes, I have read abt issues caused by Unified Class laoder in JBoss 3 and above. Seems the solutions lies in scoping using ear files and jboss-app.xml. Haven't tried it though.

                        cheers