jersey icon indicating copy to clipboard operation
jersey copied to clipboard

Running Jersey in Jetty using JettyHttpContainerFactory does not support anything but root (/*) application path

Open roytmana opened this issue 2 months ago • 1 comments

Using Jetty 12.1, Weld 6 (weld-se), Jersey 3.11 and jersey-cdi2-se for jersey/weld integration so weld-se is started by Jersey and the app (otherwise Jersey beans are not available for injection)

both places where app-path is used in attempt to have jersey handle http://localhost:8080/my-app-path/

as result all calls to jersey are /* not /my-app-path/* and I am forced to annotate all jersey resources as /my-app-path/

final Server server = JettyHttpContainerFactory.createServer(URI.create(http://localhost:8080/my-app-path), new WebApplication(), false);

@jakarta.ws.rs.ApplicationPath("/my-app-path")
@Vetoed
public class WebApplication extends ResourceConfig {

it is not surprising that @jakarta.ws.rs.ApplicationPath("/my-app-path") is ignored since I am forced to explicitly create WebApplication() in JettyHttpContainerFactory.createServer() call above so jersey does not scan and instantiate WebApplication. I had to @Vetoed the app so CDI won't try to instantiate it second time

According to javadocs fist path element of URI in JettyHttpContainerFactory.createServer() call is supposed to be used but it is not

roytmana avatar Oct 23 '25 17:10 roytmana

Jersey 3.0 does not support it. It was added to 3.1 by #4861. But not with Jetty, I can see.

jansupol avatar Nov 03 '25 16:11 jansupol