----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Jakarta Cactus Developers" <[EMAIL PROTECTED]> Sent: Monday, October 15, 2001 4:32 PM Subject: Re: Sending data to a servlet
> Hi, > > Here are a set of patches for review. They should NOT be committed > to the repository yet (so there is no [PATCH] in the subject). > I have modified a bit your code (by adding a addParameter() method accepting an HTTP method instead of having a CactusParameter). Also, I have not changed anything on the server side as it is not needed. > Goal: update Cactus to send Cactus specific information to the servlet > redirector using the query string for both GET and POST requests. > > Tested with JDK 1.3.0 on SunOS 5.8 with servlets 2.2 and Tomcat 3.2.3 > I have tested the changes on all supported containers and it works fine except for the getStatusCode (see below) > Consequences: > > 1) > The POST method seems to require data actually being sent through > the output stream otherwise the server interprets the request as a GET > request. > > Originally for a POST request the Cactus parameters were sent > through the output stream so this was always interepreted as a POST > request. > > Now, test cases must explicitly send parameters for the default POST > request to actually be recieved by the server as a POST request. > > See test case 'testPostMethod' in TestSampleServer.java. > yes, GET is now the default method used by Cactus (it was POST before). > > > > 2) > The 'testStatusCode' in TestServletTestCase2.java fails with: > > > [java] [junit] Testcase: testStatusCode took 0.105 sec > [java] [junit] Caused an ERROR > [java] [junit] http://localhost:8080/test/ServletRedirector/?ServletTestRedirector_TestClas s=org.apache.cactus.sample.unit.TestServletTestCase2&ServletTestRedirector_S ervice=CALL_TEST&ServletTestRedirector_AutomaticSession=true&ServletTestRedi rector_TestMethod=testStatusCode > [java] [junit] java.io.FileNotFoundException: http://localhost:8080/test/ServletRedirector/?ServletTestRedirector_TestClas s=org.apache.cactus.sample.unit.TestServletTestCase2&ServletTestRedirector_S ervice=CALL_TEST&ServletTestRedirector_AutomaticSession=true&ServletTestRedi rector_TestMethod=testStatusCode > [java] [junit] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection .java:545) > [java] [junit] at org.apache.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoReadHt tpURLConnection.java:127) > [java] [junit] at org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:1 36) > [java] [junit] at org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:422) > [java] [junit] at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130) > [java] [junit] at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371) > [java] [junit] at junit.framework.TestResult$1.protect(TestResult.java:106) > [java] [junit] at junit.framework.TestResult.runProtected(TestResult.java:124) > [java] [junit] at junit.framework.TestResult.run(TestResult.java:109) > [java] [junit] at junit.framework.TestCase.run(TestCase.java:131) > [java] [junit] at junit.framework.TestSuite.runTest(TestSuite.java:173) > [java] [junit] at junit.framework.TestSuite.run(TestSuite.java:168) > [java] [junit] at junit.framework.TestSuite.runTest(TestSuite.java:173) > [java] [junit] at junit.framework.TestSuite.run(TestSuite.java:168) > [java] [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu nner.java:231) > [java] [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR unner.java:409) > [java] [junit] > > > Any ideas why? > yes, this is because of a bug in the JDK HttpURLConnection class and I was using a shaky workaround (ending URL with a "/") which does not work anymore (as there are now always GET parameters). So, in essence, it was not really working before. The solution is to use HttpClient for doing the http connection. > Do the patches work with other jdk/servlet container/OS > combinations? > yes > Are there any other consequences or limitations caused by this > patch? > I don't see any. > What is the preferred way of sending multi-file patch messages? > > Should [PATCH] appear in the subject it the patch is not complete? > dunno. not very important though :) > > Thanks for the help. > > > Alvin. > Thanks to you Alvin :) -Vincent --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
