Jaxrs-api: @ApplicationPath in Java SE deployments

Created on 28 Jul 2019  路  10Comments  路  Source: eclipse-ee4j/jaxrs-api

Apparently (at least) Jersey does not respect the @ApplicationPath's value in Java SE deployments, see Jersey issue #4205.

The JAX-RS specification clearly tells how to use this annotation with Servlet deployments. Maybe we should add a clarifying statement for Java SE deployments, too?

clarification spec tck

Most helpful comment

Well, it looks like August is gone. Sorry.

There isn't necessarily a single answer since RESTEasy has a variety of embedded servers:

  • SunHttpJaxrsServer
  • UndertowJaxrsServer
  • NettyJaxrsServer
  • VertsJaxrsServer

As it happens, my colleague Rebecca Searls recently reorganized them so that they all implement a single interface, EmbeddedJaxrsServer. In any case, given the following:

  @ApplicationPath("application")
  public static class MyApp extends Application {
     ...
  }

  EmbeddedJaxrsServer server = new <...>JaxrsServer();
  ResteasyDeployment deployment = server.getDeployment();
  deployment.setApplicationClass(MyApp.class.getName());
  server.start();

the value of @ApplicationPath on MyApp will be honored for any of them.

All 10 comments

@eclipse-ee4j/eclipse-jaxrs Committers, please discuss! :-)

IMO @ApplicationPath should also be supported in SE environments. Not sure if we need to be more explicit about the fact that it also works in SE environments. At least I would have expected that.

@chkal Apparently you are not alone with your expectations, but indeed Jersey behaves differently. Hence it would be great to hear some kind of "justification" of team Jersey.

@eclipse-ee4j/eclipse-jaxrs More opinions, particularly from the vendors?

+1 - I agree that @ApplicationPath should be supported in SE environments.

@andymc12 Do you know whether IBM and Apache products actually do support this already?

@andymc12 Do you know whether IBM and Apache products actually do support this already?

They do not currently support the Jakarta Java SE APIs.

@jansupol @asoldano Would be great if you could post you opinion. Thanks. :-)

Well, it looks like August is gone. Sorry.

There isn't necessarily a single answer since RESTEasy has a variety of embedded servers:

  • SunHttpJaxrsServer
  • UndertowJaxrsServer
  • NettyJaxrsServer
  • VertsJaxrsServer

As it happens, my colleague Rebecca Searls recently reorganized them so that they all implement a single interface, EmbeddedJaxrsServer. In any case, given the following:

  @ApplicationPath("application")
  public static class MyApp extends Application {
     ...
  }

  EmbeddedJaxrsServer server = new <...>JaxrsServer();
  ResteasyDeployment deployment = server.getDeployment();
  deployment.setApplicationClass(MyApp.class.getName());
  server.start();

the value of @ApplicationPath on MyApp will be honored for any of them.

Apparently there are had been only +1 votes within the last months and no -1 votes. According to our voting rules this means that all compliant implementations MUST respect @ApplicationPath in Java SE deployments.

We now have to add a TCK test for this. Anybody like to volunteer?

Was this page helpful?
0 / 5 - 0 ratings