(web.xml ではなく) Guice モジュールとして次の構成があります。
public class RestModule extends JerseyServletModule {
@Override
protected void configureServlets() {
install(new JpaPersistModule("myDB"));
filter("/*").through(PersistFilter.class);
bind(CustomerList.class);
bind(OrdersList.class);
bind(MessageBodyReader.class).to(JacksonJsonProvider.class);
bind(MessageBodyWriter.class).to(JacksonJsonProvider.class);
ImmutableMap<String, String> settings = ImmutableMap.of(
JSONConfiguration.FEATURE_POJO_MAPPING, "true"
);
serve("/*").with(GuiceContainer.class, settings);
}
}
REST エンドポイントへのサービス提供は、すでに非常にうまく機能しています。
ユーザーがhttp://example.com/をリクエストしたときに、/webapp/index.html から静的な html ファイルを提供したいと思います。
その他のサービスはhttp://example.com/customersまたはhttp://example.com/ordersにあります
私は web.xml を使用しません。ウェブサーバーは桟橋です