use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class HttpHeadersTest method configure.
@Override
protected Application configure() {
ResourceConfig config = new ResourceConfig(HttpMethodResource.class);
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
return config;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class MethodTest method configure.
@Override
protected Application configure() {
ResourceConfig config = new ResourceConfig(HttpMethodResource.class);
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
return config;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class HttpHeadersTest method configure.
@Override
protected Application configure() {
enable(TestProperties.LOG_TRAFFIC);
enable(TestProperties.DUMP_ENTITY);
ResourceConfig config = new ResourceConfig(HttpMethodResource.class, HeaderWriter.class);
config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
return config;
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class App method create.
/**
* Create example application resource configuration.
*
* @return initialized resource configuration of the example application.
*/
public static ResourceConfig create() {
final ResourceConfig resourceConfig = new ResourceConfig(TracingResource.class);
final Resource.Builder resourceBuilder = Resource.builder(ROOT_PATH_PROGRAMMATIC);
resourceBuilder.addMethod(TRACE.NAME).handledBy(new Inflector<ContainerRequestContext, Response>() {
@Override
public Response apply(ContainerRequestContext request) {
if (request == null) {
return Response.noContent().build();
} else {
return Response.ok(Stringifier.stringify((ContainerRequest) request), MediaType.TEXT_PLAIN).build();
}
}
});
return resourceConfig.registerResources(resourceBuilder.build());
}
use of org.glassfish.jersey.server.ResourceConfig in project jersey by jersey.
the class Server method start.
/**
* Start SSL-secured HTTP test server.
*
* @throws IOException in case there is an error while reading server key store or trust store.
* @return an instance of the started SSL-secured HTTP test server.
*/
public static Server start() throws IOException {
// Grizzly ssl configuration
SSLContextConfigurator sslContext = new SSLContextConfigurator();
// set up security context
// contains server keypair
sslContext.setKeyStoreFile(KEYSTORE_SERVER_FILE);
sslContext.setKeyStorePass(KEYSTORE_SERVER_PWD);
// contains client certificate
sslContext.setTrustStoreFile(TRUSTORE_SERVER_FILE);
sslContext.setTrustStorePass(TRUSTORE_SERVER_PWD);
ResourceConfig rc = new ResourceConfig();
rc.registerClasses(RootResource.class, SecurityFilter.class, AuthenticationExceptionMapper.class);
final HttpServer grizzlyServer = GrizzlyHttpServerFactory.createHttpServer(getBaseURI(), rc, true, new SSLEngineConfigurator(sslContext).setClientMode(false).setNeedClientAuth(true));
// start Grizzly embedded server //
LOGGER.info("Jersey app started. Try out " + BASE_URI + "\nHit CTRL + C to stop it...");
grizzlyServer.start();
return new Server(grizzlyServer);
}
Aggregations