Note that there are some explanatory texts on larger screens.

plurals
  1. POCross-site tomcat form post not working
    primarykey
    data
    text
    <p>For a customer, I need to write a Servlet which can print values in a form post. The form is hosted on another server and looks somewhat like this:</p> <pre><code>&lt;form action="http://myserver/myServlet" method="POST"&gt; &lt;input type="text" id="someName" value="someInterestingValue"/&gt; &lt;input type="submit" value="submit" /&gt; &lt;/form&gt; </code></pre> <p>I have a Tomcat 5.0.28 server available, running on a Java 1.4 jdk, so I made a simple servlet:</p> <pre><code>public class ProxyServlet extends HttpServlet { public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); Enumeration a =req.getAttributeNames(); while (a.hasMoreElements()){ String attrname = (String) a.nextElement(); out.println(attrname+"="+req.getAttribute(attrname)+"&lt;br/&gt;"); } out.close(); } } </code></pre> <p>When I go to the servlet by URL everything looks as expected. When I send a GET request with some parameters, I can see those as attributes in the debugger in the doGet() method (method was left out for brevety).</p> <p>However, in the doPost(), my form fields seem to be missing. I've looked into the Tomcat logfiles, and nothing special is logged. I tried to add a crossdomain.xml to some directories but did not find a way to change this behaviour. </p> <p>So to be clear: The Form as listed above is on server A. My servlet runs on an existing legacy Tomcat/Java application hosted on server B. When the form is of type "POST" none of the fields arrive at the Servlet on server B. Apache is NOT "in front" of Tomcat.</p> <p>Is there some configuration setting I am missing in Tomcat? Any tips or suggestions where to look next? Help is greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload