Hello,
i wrote simple http server, to serve submit data from Acroforms. Method
handle save xml data (xfdf) to file sytem. But something wrong with
response. Acrobat reader throw dialog with:
"An error occured during submit process. Cannot process content of type
xml." I also tried write other response, but without success. What
exactly acrobat expects in response ?
here is my code:
public void handle(
final HttpRequest request,
final HttpResponse response,
final HttpContext context) throws HttpException,
IOException {
String method =
request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
if (!method.equals("GET") && !method.equals("HEAD") &&
!method.equals("POST")) {
throw new MethodNotSupportedException(method + " method
not supported");
}
String target = request.getRequestLine().getUri();
if (request instanceof HttpEntityEnclosingRequest) {
HttpEntity entity = ((HttpEntityEnclosingRequest)
request).getEntity();
byte[] entityContent = EntityUtils.toByteArray(entity);
FileOutputStream fos = new FileOutputStream(new
File(this.docRoot, "xfdf.xml"));
fos.write(entityContent);
fos.close();
response.setStatusCode(HttpStatus.SC_OK);
final File file = new File(this.docRoot, "xfdf.xml");
FileEntity body = new FileEntity(file, "xml");
response.setEntity(body);
}
}
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/