Skip to content
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

Use jetty specific websocket API jar #3197

Closed
gregw opened this issue Dec 13, 2018 · 1 comment
Closed

Use jetty specific websocket API jar #3197

gregw opened this issue Dec 13, 2018 · 1 comment

Comments

@gregw
Copy link
Contributor

gregw commented Dec 13, 2018

Similarly to #3162, we may need to create our own rebundled websocket -api jar with OSGi headers.

Currently we run in OSGi tests with this hack:

    private static void fixJavaxWebSocketApi(BundleContext bundleContext)
    {
        try
        {
            // this is necessary because the javax.websocket-api jar does not have manifest headers
            // that allow it to use ServiceLoader in osgi, this corrects that defect
            TinyBundle bundle = TinyBundles.bundle();
            bundle.set(Constants.FRAGMENT_HOST, "javax.websocket-api");
            bundle.set(Constants.REQUIRE_CAPABILITY,
                "osgi.serviceloader;filter:=\"(osgi.serviceloader=javax.websocket.ContainerProvider)\";resolution:=optional;cardinality:=multiple, osgi.extender; filter:=\"(osgi.extender=osgi.serviceloader.processor)\"");
            bundle.set(Constants.BUNDLE_SYMBOLICNAME, "javax.websocket.api.fragment");
            InputStream is = bundle.build(TinyBundles.withBnd());
            bundleContext.installBundle("dummyLocation", is);

            Bundle websocketApiBundle = TestOSGiUtil
                .getBundle(bundleContext, "javax.websocket-api");
            assertNotNull(websocketApiBundle);
            websocketApiBundle.update();
            websocketApiBundle.start();
        }
        catch(Exception e)
        {
            throw new RuntimeException(e);
        }
    }

This adds the required OSGi manifest entries, so some tests pass... however we are getting some chicken-vs-egg problems with some tests. More over, it is unreasonable to expect a user application to do the same.

So either we make our own api jar... or wait for the jakarta one (if it will have the right headers? @joakime ???)

@sbordet
Copy link
Contributor

sbordet commented Dec 13, 2018

@gregw JakartaEE jars are probably far away in the future, so I would go for our own repackaged jar.

sbordet added a commit to jetty/jetty-toolchain that referenced this issue May 10, 2019
manifest entries and JPMS Automatic-Module-Name.

See jetty/jetty.project#3197

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
sbordet added a commit that referenced this issue May 10, 2019
Introduced jetty-javax-websocket-api artifact with proper
OSGi manifest entries and JPMS Automatic-Module-Name.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
joakime added a commit that referenced this issue May 14, 2019
…et-jar

Fixes #3197 - Use jetty specific websocket API jar.
@gregw gregw closed this as completed Sep 11, 2019
jmcc0nn3ll pushed a commit to jetty/jetty-websocket-api that referenced this issue Nov 3, 2023
manifest entries and JPMS Automatic-Module-Name.

See jetty/jetty.project#3197

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants