How to access com.sun.webkit.network.CookieManager at JDK 10?

Nir Lisker nlisker at gmail.com
Fri Aug 24 13:02:29 UTC 2018


Hi Miro,

Can I use the 2nd option with declaration in the source code, or the only
> possible option is to pass as parameter when starting the application?
>

If your app is not a module then you don't have a module-info.java in your
source code to declare the dependency. What you can do is export a package
during runtime with the addExports method [1].

[1]
https://docs.oracle.com/javase/10/docs/api/java/lang/Module.html#addExports(java.lang.String,java.lang.Module)

On Fri, Aug 24, 2018 at 12:38 PM Miroslav Nachev <
mnachev.nscenter.eu at gmail.com> wrote:

> Hi Arun,
>
> Thank you. I'm already using the first option, but then I need to access
> other methods and classes that are not available.
> Can I use the 2nd option with declaration in the source code, or the only
> possible option is to pass as parameter when starting the application?
>
>
> Miro.
>
> On Fri, Aug 24, 2018 at 12:04 PM Arunprasad Rajkumar <
> arunprasad.rajkumar at oracle.com> wrote:
>
> > Hello Miro,
> >
> > CookieManager is a module private class, which is not exposed to outside.
> >
> > I could think of two options,
> >
> > 1. com.sun.webkit.network.CookieManager is a type of
> > java.net.CookieHandler, that means after instantiating WebEngine, you can
> > call CookieHandler.getDefault() to get the instance of CookieManager.
> >         new WebEngine();
> >         CookieHandler cookieHandler = CookieHandler.getDefault(); // This
> > will be an instance of com.sun.webkit.network.CookieManager
> >
> > 2. Export the module private implementation using
> > "--add-exports=javafx.web/com.sun.webkit.network=ALL-UNNAMED”
> >
> > Thanks,
> > Arun
> >
> > > On 24-Aug-2018, at 12:27 PM, Miroslav Nachev <
> > mnachev.nscenter.eu at gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > I have apps that work well on JDK8, but on JDK10 I do not have access
> to
> > > some classes, for example, com.sun.webkit.network.CookieManager. This
> > class
> > > is the only one, that is up to date (RFC 6265) and is part of Java. The
> > > java.net.CookieManager class is obsolete: RFC 2965. The Cookie solution
> > in
> > > Apache HttpComponents is very complicated, difficult to use, and is
> > mostly
> > > not compatible with JDK and JavaFX.
> > > In fact, I use JavaFX CookieManager in the following 3 scenarios:
> > >
> > >   - When using WebEngine (JavaFX 8).
> > >   - JavaFX Desktop App to store frequently used words in text and other
> > >   fields (TextField, etc.).
> > >   - To store session parameters in JavaFX Desktop Clients that uses
> REST
> > >   WS or Web Sockets to connect to the Web Server (App Server).
> > >
> > > Is there any way to enable access to
> com.sun.webkit.network.CookieManager
> > > at JDK 10?
> > >
> > >
> > > Regards,
> > > Miro.
> >
> >
>


More information about the openjfx-dev mailing list