[oXygen-user] Custom headers on HTTP requests

Ben McGinnes
Fri Dec 18 15:32:41 CST 2015

On 19/12/2015 1:41 am, Tom Cleghorn wrote:
> Hi,
> Is there any means of controlling the HTTP headers Oxygen sends when
> using 'Open URL' from the File menu? I'm working with an API that
> uses Accept headers to return different subsets of a large document,
> and it'd be very useful to be able to control that within Oxygen
> too.

Off the top of my head, I'm not sure, but oXygen uses Apache's
HttpClient so if there's a way to do it directly with that (probably)
then you can probably tweak the built-in version(s) the same way.
Expect to be fiddling with its innards directly, though, rather than
using the GUI to set the headers.

That, however is just if using the file menu method is a requirement
for your writers.  If it's not and it's just about opening connections
by whatever method you like (e.g. a plugin pr external application
call) then there's plenty of alternative methods, particularly if
you're using an operating system with libcurl installed, for example.

My weapon of choice if it had to be platform independent would be:
external application call, plus Jython 2.7 (full 100MB install), plus
the requests python module, plus oXygen API call to open the file when
it finished downloading.  Why?  Because requests makes HTTP calls
pleasant (and you can load your preconfigured headers, proxies and
other parameters as a python dict ... or JSON.  Oh, I've already
checked, requests installs with Jython just fine.

If it were just for me, though, I'd skip the Jython part and use the
system install of either libcurl or Python 3.5 with requests.
Probably the Python method because I've got plenty of similar stuff
already using requests to share code with.  Including bits to access
the Tor network with it (most of my Twython delivered tweets end up
going through that method, just to annoy the national surveillance
systems weenies these days, but originally for the more traditional
reason: to see if it would work).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 630 bytes
Desc: OpenPGP digital signature
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20151219/0759ed5e/attachment.sig>

More information about the oXygen-user mailing list