Как я могу развернуть веб-страницы вместе с моим Restful Project во Embedded Jetty?
Я уже настроил мой Jetty Project для развертывания RESTFUL с использованием встроенного Jetty.
public class App {
private static Server server;
public static void main(String...s) {
initJetty();
}
private static void initJetty(){
try {
URI baseUri = UriBuilder.fromPath(System.getProperty("jetty.uri", "http://127.0.0.1:32081")).build();
server = JettyHttpContainerFactory.createServer(baseUri, new AppResourceConfig());
server.start();
} catch(Exception ex){
stopJetty();
}
}
private static void stopJetty() {
if(server != null){
try {
server.stop();
} catch (Exception e) {
}
}
}
}
public class AppResourceConfig extends ResourceConfig {
private static final String REST_BASE_PACKAGE = "com.dinesh.client.endpoints";
public AppResourceConfig(){
//Base package suffices as it scans all the subpackages recursively.
packages(REST_BASE_PACKAGE)
.register(MultiPartFeature.class)
.register(MoxyJsonFeature.class);
}
}
Как я могуразвернуть веб-страницы на том же порту, используя встроенный причал?Я хочу иметь возможность развернуть его с помощью команды java -jar на моем терминале.