Search in sources :

Example 41 with LoggingFeature

use of org.glassfish.jersey.logging.LoggingFeature in project jersey by jersey.

the class AsyncTest method configureClient.

@Override
protected void configureClient(final ClientConfig config) {
    config.register(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
    config.connectorProvider(new HttpUrlConnectorProvider());
}
Also used : HttpUrlConnectorProvider(org.glassfish.jersey.client.HttpUrlConnectorProvider) LoggingFeature(org.glassfish.jersey.logging.LoggingFeature)

Example 42 with LoggingFeature

use of org.glassfish.jersey.logging.LoggingFeature in project jersey by jersey.

the class ContentTypeTest method configure.

@Override
protected Application configure() {
    enable(TestProperties.DUMP_ENTITY);
    enable(TestProperties.LOG_TRAFFIC);
    return new ResourceConfig().registerClasses(ContentTypeResource.class, ContentTypeFixFeature.class, FooBarStringWriter.class).registerInstances(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY));
}
Also used : LoggingFeature(org.glassfish.jersey.logging.LoggingFeature) ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 43 with LoggingFeature

use of org.glassfish.jersey.logging.LoggingFeature in project jersey by jersey.

the class OAuthClientServerTest method configure.

@Override
protected Application configure() {
    final DefaultOAuth1Provider oAuthProvider = new DefaultOAuth1Provider();
    oAuthProvider.registerConsumer(CONSUMER_NAME, CONSUMER_KEY, SECRET_CONSUMER_KEY, new MultivaluedHashMap<String, String>());
    final Principal prometheusPrincipal = new Principal() {

        @Override
        public String getName() {
            return "prometheus";
        }
    };
    oAuthProvider.addAccessToken(PROMETHEUS_TOKEN, PROMETHEUS_SECRET, CONSUMER_KEY, "http://callback.url", prometheusPrincipal, Arrays.asList("admin", "user").stream().collect(Collectors.toSet()), new MultivaluedHashMap<String, String>());
    final OAuth1ServerFeature oAuth1ServerFeature = new OAuth1ServerFeature(oAuthProvider, "requestTokenSpecialUri", "accessTokenSpecialUri");
    final ResourceConfig resourceConfig = new ResourceConfig();
    resourceConfig.register(oAuth1ServerFeature);
    resourceConfig.register(MyProtectedResource.class);
    resourceConfig.register(new LoggingFeature(Logger.getLogger(OAuthClientServerTest.class.getName()), LoggingFeature.Verbosity.PAYLOAD_ANY));
    resourceConfig.register(OAuthAuthorizationResource.class);
    resourceConfig.property(OAuth1ServerProperties.TIMESTAMP_UNIT, "SECONDS");
    resourceConfig.property(OAuth1ServerProperties.MAX_NONCE_CACHE_SIZE, 20);
    return resourceConfig;
}
Also used : LoggingFeature(org.glassfish.jersey.logging.LoggingFeature) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) DefaultOAuth1Provider(org.glassfish.jersey.server.oauth1.DefaultOAuth1Provider) OAuth1ServerFeature(org.glassfish.jersey.server.oauth1.OAuth1ServerFeature) UserPrincipal(com.sun.security.auth.UserPrincipal) Principal(java.security.Principal)

Example 44 with LoggingFeature

use of org.glassfish.jersey.logging.LoggingFeature in project jersey by jersey.

the class MultiPartJerseyTest method configure.

@Override
protected Application configure() {
    enable(TestProperties.LOG_TRAFFIC);
    enable(TestProperties.DUMP_ENTITY);
    return new ResourceConfig().registerClasses(getResourceClasses()).registerClasses(MultiPartBeanProvider.class).registerInstances(new LoggingFeature(LOGGER, LoggingFeature.Verbosity.PAYLOAD_ANY)).register(new MultiPartFeature());
}
Also used : MultiPartFeature(org.glassfish.jersey.media.multipart.MultiPartFeature) LoggingFeature(org.glassfish.jersey.logging.LoggingFeature) ResourceConfig(org.glassfish.jersey.server.ResourceConfig)

Example 45 with LoggingFeature

use of org.glassfish.jersey.logging.LoggingFeature in project simba-os by cegeka.

the class JerseyExampleClient method main.

public static void main(String[] args) {
    Client client = ClientBuilder.newClient();
    client.register(HttpAuthenticationFeature.basic("admin", "Simba3D"));
    client.register(new LoggingFeature(LOGGER));
    WebTarget target = client.target("http://localhost:8080/simba/jersey/service/").path("hello");
    try {
        String result = target.request(MediaType.TEXT_PLAIN_TYPE).get(String.class);
        System.out.println(result);
    } finally {
        client.close();
    }
}
Also used : LoggingFeature(org.glassfish.jersey.logging.LoggingFeature) WebTarget(javax.ws.rs.client.WebTarget) Client(javax.ws.rs.client.Client)

Aggregations

LoggingFeature (org.glassfish.jersey.logging.LoggingFeature)45 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)33 Response (javax.ws.rs.core.Response)6 Client (javax.ws.rs.client.Client)4 WebTarget (javax.ws.rs.client.WebTarget)4 ContainerRequestContext (javax.ws.rs.container.ContainerRequestContext)4 ContainerRequest (org.glassfish.jersey.server.ContainerRequest)4 Resource (org.glassfish.jersey.server.model.Resource)4 ClientConfig (org.glassfish.jersey.client.ClientConfig)2 MultiPartFeature (org.glassfish.jersey.media.multipart.MultiPartFeature)2 Test (org.junit.Test)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 UserPrincipal (com.sun.security.auth.UserPrincipal)1 InputStream (java.io.InputStream)1 URI (java.net.URI)1 Principal (java.security.Principal)1 HashSet (java.util.HashSet)1 ExecutorService (java.util.concurrent.ExecutorService)1 Logger (java.util.logging.Logger)1 ClientBuilder (javax.ws.rs.client.ClientBuilder)1