10
votes

How to pass the HTTP Headers like

"Accept-Language", "Accept", "Accept-Encoding" to WebEngine in JavaFX? i have tried the method as specified in Setting a cookie using JavaFX's WebEngine/WebView, but it doesn't work. is there any API that is being exposed in Java 8 for achieving this? Pls suggest.

1
Your question is possible duplicate, see answer here: stackoverflow.com/questions/13803480/… - janih
Thanks @janih - Still there're no docs or links to specify how to set http headers other than User-Agent. Has that been made possible with JavaFX 8? I browsed through the link , but couldn't find any relevant methods. - Arun
you are right, it doesn't seem to be possible to set other headers than user agent. However, it might be possible to set the http headers by implementing a custom protocol handler - janih
Actually the only way i found, was it: twitter.com/CodingFabian/status/524942996748652544 - William

1 Answers

2
votes

Since JDK 8u60 the default locale of the application is automatically added to the "Accept-Language" header as the first option. This may help in some cases although it would of course be better to be able to set all these headers explicitly.