• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

urgent: New connection from servlet - POST values forgotten

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic