[oXygen-user] Custom headers on HTTP requests

Radu Pisoi
Tue Dec 22 04:07:40 CST 2015


Hi all,

A solution to control the HTTP headers is to implement a custom protocol plugin. This plugin allows you to create your own URLConnection for an URL with a custom protocol other than the protocols handled by oXygen: file, http, https, ftp or ftps. When you are asked for an URLConnection, you can create a HTTPURLConnection which has API for setting custom headers. 

If you want to use the HTTPConnection that oXygen uses, you have to instantiate the ro.sync.net.protocol.http.WebdavHttpURLConnection class. One of the advantages of using this class is that it is aware of the proxy options that are set in oXygen.

So, this solution implies that you will use a custom protocol when you want to access your files ( for instance cproto://host.com/dir1/dir2/file.xml). For this protocol, you will be asked for an implementation of URLConnection that allows you to set custom headers.

More about custom protocol plugin extension:
https://www.oxygenxml.com/doc/versions/17.1/ug-editor/index.html#concepts/custom-protocol-plugin.html

However, it is possible to impose a custom URL stream handler for the http protocol. This can be done through the 'Targeted URL Stream Handler' plugin. See more details here:
https://www.oxygenxml.com/doc/versions/17.1/ug-editor/index.html#concepts/targeted-url-handler-plugin.html

Regards,
Radu
--
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 12/18/2015 4:41 PM, 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.
> 
> Thanks!
> 
> 
> 
> 
> Cambridge University Press is the publishing business of the University 
> of Cambridge with VAT registered number GB 823 8476 09.  Our principal 
> office is at University Printing House, Shaftesbury Road, Cambridge, CB2 
> 8BS, United Kingdom.
> _______________________________________________
> oXygen-user mailing list
> 
> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
> 



More information about the oXygen-user mailing list