• Post Reply Bookmark Topic Watch Topic
  • New Topic

urgent: New connection from servlet - POST values forgotten

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I develope a proxy servlet which is between the Client and the web server. The client requests come automatically to the servlet; the servlet analyses the URL (because of mapping) and makes a new connection (via URLConnection). This new page is then sent to the client via DataInputStream:
...
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
...
OutputStream out = response.getOutputStream();
try {
URL u = new URL(protokoll + server + dokument);
URLConnection uco = u.openConnection ();
uco.connect();
response.setContentType(uco.getContentType());
InputStream in = uco.getInputStream();
DataInputStream data = new DataInputStream (new BufferedInputStream(in));
int b;
while ((b = data.read()) != -1)
out.write(b);
out.close();
}
...
I have the following problem: the returned page has no information about the POST values from the previous HTML page. If the returned page is a PHP script, it has no variables, that were defined in the previous HTML page.

How can the responsed page get the POST values of previous page?
Can somebody help me? Thanks
Sam
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The POST values are in the inputStream of the request, which you seem to be ignoring. You also seem to be ignoring the content type of the request.
Bill
------------------
author of:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!