lundi 31 août 2015

Change response url with Java HttpResponse

I'm developing a simple WebServer with Java (Using org.apache.http.HttpRequest and org.apache.http.HttpResponse).

I have an HTML page like this:

<form action="/upload" enctype="multipart/form-data" method="post">
  <label for="datafile1">First File:</label>
   <input type="file" id="datafile1" name="datafile1" size="40"><br>
  <input type="submit">
</form>

On the Java Server i get the POST request, read the Multipart content and fill up an HttpEntity as Response but the page loaded is (obviously) "/upload"

How can I tell the browser that the response url is something else?

I have tried:

response.setHeader("Location","/");

But with HTTP Status code 200 nothing happened And with HTTP Status code 302 the browser make a new request, deleting the one I have returned.

Any ideas?




Aucun commentaire:

Enregistrer un commentaire