forked from phaxio/phaxio-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
36 lines (28 loc) · 1.24 KB
/
Copy pathMain.java
File metadata and controls
36 lines (28 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.phaxio.example;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.glassfish.jersey.servlet.ServletContainer;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
public static int main (String[] args) {
Server server = new Server(8080);
ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
handler.setContextPath("/");
server.setHandler(handler);
ServletHolder holder = handler.addServlet(ServletContainer.class, "/*");
holder.setInitOrder(1);
holder.setInitParameter("jersey.config.server.provider.packages", "com.phaxio.example.resources");
holder.setInitParameter("jersey.config.server.provider.classnames", "com.phaxio.example.providers.UnrecognizedPropertyExceptionProvider,org.glassfish.jersey.media.multipart.MultiPartFeature");
try {
server.start();
server.join();
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} finally {
server.destroy();
}
return 0;
}
}