use of org.glassfish.grizzly.http.server.HttpServer in project jersey by jersey.
the class App method main.
public static void main(String[] args) {
try {
System.out.println("\"Hello World\" Jersey Example App");
Map<String, String> initParams = new HashMap<>();
initParams.put(ServerProperties.PROVIDER_PACKAGES, HelloWorldResource.class.getPackage().getName());
final HttpServer server = GrizzlyWebContainerFactory.create(BASE_URI, ServletContainer.class, initParams);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
}
}));
System.out.println(String.format("Application started.%nTry out %s%s%nStop the application using CTRL+C", BASE_URI, ROOT_PATH));
Thread.currentThread().join();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of org.glassfish.grizzly.http.server.HttpServer in project jersey by jersey.
the class App method main.
public static void main(final String[] args) {
try {
System.out.println("Jersey Entity Data Filtering Example.");
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, new SelectableEntityFilteringApplication(), false);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
}
}));
server.start();
System.out.println("Application started.\nTry out one of these URIs:");
for (final String path : new String[] { "people/1234", "people/1234?select=familyName,givenName", "people/1234?select=region,addresses.region", "people/1234?select=familyName,givenName,addresses.phoneNumber.number" }) {
System.out.println(BASE_URI + path);
}
System.out.println("Stop the application using CTRL+C");
Thread.currentThread().join();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of org.glassfish.grizzly.http.server.HttpServer in project jersey by jersey.
the class App method main.
public static void main(String[] args) {
try {
System.out.println("\"Declarative Linking\" Jersey Example App");
final ResourceConfig resourceConfig = new ResourceConfig(ItemsResource.class);
resourceConfig.register(DeclarativeLinkingFeature.class);
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, resourceConfig, false);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
}
}));
server.start();
System.out.println(String.format("Application started.\nTry out curl -L %s%s\nStop the application using CTRL+C", BASE_URI, ROOT_PATH));
Thread.currentThread().join();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of org.glassfish.grizzly.http.server.HttpServer in project jersey by jersey.
the class App method main.
public static void main(String[] args) {
try {
System.out.println("Jersey Entity Data Filtering Example.");
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, new SecurityEntityFilteringApplication(), false);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
}
}));
server.start();
System.out.println("Application started.\nTry out one of these URIs:");
for (final String path : new String[] { "unrestricted-resource", "restricted-resource/denyAll", "restricted-resource/permitAll", "restricted-resource/rolesAllowed", "restricted-resource/runtimeRolesAllowed?roles=manager,user" }) {
System.out.println(BASE_URI + path);
}
System.out.println("Stop the application using CTRL+C");
Thread.currentThread().join();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, "I/O error occurred during reading from an system input stream.", ex);
}
}
use of org.glassfish.grizzly.http.server.HttpServer in project jersey by jersey.
the class App method main.
public static void main(String[] args) {
try {
System.out.println("Jersey CDI Example App");
final Weld weld = new Weld();
weld.initialize();
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, createJaxRsApp(), false);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
weld.shutdown();
}
}));
server.start();
System.out.println(String.format("Application started.\nTry out %s%s\nStop the application using CTRL+C", BASE_URI, "application.wadl"));
Thread.currentThread().join();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
}
Aggregations