I'm implementing a little webserver in my Android application. Therefor I have a WebServer class and I'm handling requests of the client by an HttpRequestHandler. Everything works fine, I can access html files via the browser and so on. The only thing which won't work is to upload a multipart file to the server. For this purpose I have a litte html form with an input field for files. Then I sent the form to the server and want to save the file on the server. My HttpRequestHandlers look like the following:
public class UploadHandler implements HttpRequestHandler {
private Context context = null;
public IndexCommandHandler(Context context) {
this.context = context;
}
@Override
public void handle(HttpRequest request, HttpResponse response,
HttpContext httpContext) throws HttpException, IOException {
//HERE i want to save the multipart file
}
public Context getContext() {
return context;
}
}
So my problem is to parse the HttpRequest incoming from the client to a file. How can I do this with java?