-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reference:file: bundles can not be loaded if org.knopflerfish.osgi.registerserviceurlhandler=false #47
Comments
dpolivaev
added a commit
to dpolivaev/knopflerfish.org
that referenced
this issue
Oct 23, 2018
I see your need and it seems reasonable. I saw your pull request and will check it later this week or early next week.
Thanks,
Jan
… On 20 Oct 2018, at 18:15, Dimitry Polivaev ***@***.***> wrote:
freeplane uses knopflerfish as OSGi framework.
Recently it was added an API which allows to embed it into java applications.
One special use case is running in servlet to perform calculations defined in mind maps.
Because URL.setURLStreamHandlerFactory is already used by Tomcat ( embedded in spring boot)
I used configuration option org.knopflerfish.osgi.registerserviceurlhandler=false
Unfortunately as a consequence protocol 'reference' was no more resolved.
However it is needed at Bundles.install0 which tries to create the bundle URL calling URL url = new URL(location);
As a work around I added following static block to one of the components:
try {
Constructor<ServiceURLStreamHandlerFactory> constructor = ServiceURLStreamHandlerFactory.class.getDeclaredConstructor();
constructor.setAccessible(true);
ServiceURLStreamHandlerFactory systemUrlStreamHandlerFactory = constructor.newInstance();
TomcatURLStreamHandlerFactory.getInstance().addUserFactory(systemUrlStreamHandlerFactory);
} catch (Exception e) {
throw new RuntimeException(e);
}
It creates ServiceURLStreamHandlerFactory from knopflerfish and registers it as user factory by TomcatURLStreamHandlerFactory.
If the constructor was public or I could at least access FrameworkContext.systemUrlStreamHandlerFactory or some static method to create it I would not need the trick with the reflection.
It would be even better if the correct handler was used directly at the position where URL is created.
Could you consider any of that?
Let me know if I can help by submitting a pull request.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#47>, or mute the thread <https://github.com/notifications/unsubscribe-auth/APTdyjuoTlhFqfFrGL5vy4wl97rpEG6bks5um0wWgaJpZM4XyAPo>.
|
Seems ok, I've merged it (#48). Thanks for the improvement. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
freeplane uses knopflerfish as OSGi framework.
Recently it was added an API which allows to embed it into java applications.
One special use case is running in servlet to perform calculations defined in mind maps.
Because URL.setURLStreamHandlerFactory is already used by Tomcat ( embedded in spring boot)
I used configuration option
org.knopflerfish.osgi.registerserviceurlhandler=false
Unfortunately as a consequence protocol 'reference' was no more resolved.
However it is needed at
Bundles.install0
which tries to create the bundle URL callingURL url = new URL(location);
As a work around I added following static block to one of the components:
It creates ServiceURLStreamHandlerFactory from knopflerfish and registers it as user factory by TomcatURLStreamHandlerFactory.
If the constructor was public or I could at least access
FrameworkContext.systemUrlStreamHandlerFactory
or some static method to create it I would not need the trick with the reflection.It would be even better if the correct handler was used directly at the position where URL is created.
Could you consider any of that?
Let me know if I can help by submitting a pull request.
The text was updated successfully, but these errors were encountered: