Ehm.... I just struggled for a couple of hours figuring out why my jodconverter service was complaining for an invalid output mime/type. After digging through their java code I realized that the Accept Header was set to */*. So I thought I set it with request_header_fields in ::xo:HttpRequest. Still no luck. Until I found that send_request sets this automatically to */*......
To get this to work nicely I made a change like this, which allows me to call the jodconverter with Accept: application/pdf to tell it that I want to have a PDF document returned to me. Byte the way, this makes the whole code for OpenOffice document PDF generation even easier than it was before. And I thought I could make a consulting business out of it.... Bad luck ......
Index: tcl/http-client-procs.tcl
===================================================================
--- tcl/http-client-procs.tcl (Revision 475)
+++ tcl/http-client-procs.tcl (Arbeitskopie)
@@ -144,6 +144,7 @@
Attribute port
Attribute path -default "/"
Attribute url
+ Attribute accept -default "*/*"
Attribute post_data -default ""
Attribute content_type -default "text/plain"
Attribute request_header_fields -default {}
@@ -302,11 +303,11 @@
}
HttpCore instproc send_request {} {
- my instvar S post_data host
+ my instvar S post_data host accept
if {[catch {
set method [expr {$post_data eq "" ? "GET" : "POST"}]
puts $S "$method [my path] HTTP/1.0"
- puts $S "Accept: */*"
+ puts $S "Accept: $accept"
puts $S "Host: $host"
puts $S "User-Agent: [my user_agent]"
foreach {tag value} [my request_header_fields] {