本文整理汇总了Java中org.glassfish.jersey.logging.LoggingFeature类的典型用法代码示例。如果您正苦于以下问题:Java LoggingFeature类的具体用法?Java LoggingFeature怎么用?Java LoggingFeature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LoggingFeature类属于org.glassfish.jersey.logging包,在下文中一共展示了LoggingFeature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
@Override
public void run(Config config, Environment environment) throws UnsupportedEncodingException {
injector = Guice.createInjector(new StroomStatsServiceModule(config, hibernateBundle.getSessionFactory()));
injector.getInstance(ServiceDiscoveryManager.class);
if(config.isLogRequestsAndResponses()) {
environment.jersey().register(new LoggingFeature(java.util.logging.Logger.getLogger(
getClass().getName()),
Level.OFF,
LoggingFeature.Verbosity.PAYLOAD_TEXT,
8192));
}
configureAuthentication(environment, injector.getInstance(JwtVerificationFilter.class));
registerResources(environment);
registerTasks(environment);
HealthChecks.register(environment, injector);
registerManagedObjects(environment);
}
示例2: RESTConfig
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public RESTConfig() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion(STORR_API_VERSION);
beanConfig.setSchemes(new String[]{"http"});
beanConfig.setBasePath("/");
beanConfig.setResourcePackage(REST_PACKAGE);
beanConfig.setTitle("storr API");
beanConfig.setDescription("This REST API exposes the basic functions of storr. " +
"storr is a NoSQL store intended to provide easy storage of arbitrary tuples");
beanConfig.setScan(true);
beanConfig.setPrettyPrint(true);
packages(REST_PACKAGE);
register(LoggingFeature.class);
register(ApiListingResource.class);
register(SwaggerSerializers.class);
}
示例3: SampleApplication
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public SampleApplication() {
setApplicationName("Jersey RESTful Webapp");
LOGGER.info("Initializing '{}'...", this.getApplicationName());
migrate();
String[] packages = {this.getClass().getPackage().getName(), "io.swagger.jaxrs.listing"};
packages(packages);
LOGGER.debug("Registering JAX-RS Components...");
register(SampleObjectMapperProvider.class);
register(jacksonXMLProvider());
register(uriConnegFilter());
register(LoggingFeature.class);
property(ServerProperties.MONITORING_ENABLED, Boolean.TRUE);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, Boolean.TRUE);
property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, "INFO");
property(LoggingFeature.LOGGING_FEATURE_VERBOSITY_SERVER,
LoggingFeature.Verbosity.HEADERS_ONLY);
setUpSwagger();
}
示例4: createClientConfig
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
protected ClientConfig createClientConfig() {
ClientConfig config = new ClientConfig();
if ( proxy != null && proxy.getUri() != null ) {
config.property(ClientProperties.PROXY_URI, proxy.getUriString());
config.property(ClientProperties.PROXY_USERNAME, proxy.getUserName());
config.property(ClientProperties.PROXY_PASSWORD, proxy.getPassword());
}
config.property(ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.BUFFERED);
config.property(ApacheClientProperties.CREDENTIALS_PROVIDER, getCredentialsProvider());
config.property(ApacheClientProperties.SERVICE_UNAVAILABLE_RETRY_STRATEGY, getServiceUnavailableRetryStrategy());
config.property(ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION, doPreemptiveBasicAuthentication());
config.connectorProvider(new ApacheConnectorProvider());
config.register(JacksonFeature.class);
config.register(new LoggingFeature(Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), Level.FINE, LoggingFeature.Verbosity.PAYLOAD_ANY, 10000));
return config;
}
示例5: JerseyConfig
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public JerseyConfig() {
scan("com.devicehive.resource.converters",
"com.devicehive.resource.exceptions",
"com.devicehive.resource.filter");
registerClasses(AuthApiInfoResourceImpl.class,
JwtTokenResourceImpl.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
register(RequestContextFilter.class);
register(LoggingFeature.class);
register(ContentTypeFilter.class);
register(io.swagger.jaxrs.listing.ApiListingResource.class);
register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
示例6: JerseyConfig
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public JerseyConfig() {
scan("com.devicehive.resource.converters",
"com.devicehive.resource.exceptions",
"com.devicehive.resource.filter");
registerClasses(ApiInfoResourceImpl.class,
ConfigurationResourceImpl.class,
DeviceCommandResourceImpl.class,
DeviceNotificationResourceImpl.class,
DeviceResourceImpl.class,
NetworkResourceImpl.class,
DeviceTypeResourceImpl.class,
WelcomeResourceImpl.class,
UserResourceImpl.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
register(RequestContextFilter.class);
register(LoggingFeature.class);
register(ContentTypeFilter.class);
register(io.swagger.jaxrs.listing.ApiListingResource.class);
register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
示例7: JerseyConfig
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public JerseyConfig() {
scan("com.devicehive.resource.converters",
"com.devicehive.resource.exceptions",
"com.devicehive.resource.filter");
registerClasses(PluginApiInfoResourceImpl.class,
PluginResourceImpl.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
register(RequestContextFilter.class);
register(LoggingFeature.class);
register(ContentTypeFilter.class);
register(io.swagger.jaxrs.listing.ApiListingResource.class);
register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
示例8: ResourcesClient
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public ResourcesClient(Environment environment, int port) {
this.client = new JerseyClientBuilder(checkNotNull(environment))
.build(ResourcesClient.class.getName())
.property(CONNECT_TIMEOUT, 2000)
.property(READ_TIMEOUT, 3000)
.register(new LoggingFeature(getLogger(DEFAULT_LOGGER_NAME), INFO, PAYLOAD_ANY, 1024));
this.resourcesUrls = new ResourcesUrls(port);
}
示例9: initRestBaseClient
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
/**
* Initialize Rest base client. If username and password is null, then we dont add basic auth filter.
*
*
* @param host the host ip/name
* @param port
* if port is greater than 0 then uses the port else does not specify port and uses default http and
* https ports based
* on the input
* @param userName username to use. null if we dont want to use basic auth
* @param password password to use. null if we dont want to use basic auth
* @param isHttps whether http or https
*/
protected void initRestBaseClient(String host, int port, String userName, String password, boolean isHttps) {
this.host = host;
String urlPrefix = (isHttps ? "https" : "http") + "://" + host + (port > 0 ? ":" + port : "");
String restBaseUrl = urlPrefix + this.urlBase;
if (isHttps) {
this.client = configureHttpsClient();
} else {
this.client = configureDefaultClient();
}
this.client.property(ClientProperties.CONNECT_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
this.client.property(ClientProperties.READ_TIMEOUT, DEFAULT_READ_TIMEOUT);
this.client.register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
this.webTarget = this.client.target(restBaseUrl);
if (enableDebugLogging) {
this.client.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY_CLIENT, LoggingFeature.Verbosity.PAYLOAD_ANY);
}
if (userName != null && password != null) {
this.client.register(HttpAuthenticationFeature.basic(userName, password));
}
}
示例10: configure
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
@Override
protected ResourceConfig configure() {
enable(TestProperties.LOG_TRAFFIC);
enable(TestProperties.DUMP_ENTITY);
final ResourceConfig rc = new ResourceConfig(ItemsResource.class);
rc.register(LoggingFeature.class);
rc.register(DeclarativeLinkingFeature.class);
return rc;
}
示例11: createClient
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
private Client createClient() {
ClientConfig config = new ClientConfig();
config.property(ClientProperties.CONNECT_TIMEOUT, configuration.getClientConnectTimeout());
config.property(ClientProperties.READ_TIMEOUT, configuration.getClientReadTimeout());
config.register(new LoggingFeature());
return ClientBuilder.newClient(config);
}
示例12: ClientFactory
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public ClientFactory() {
ClientConfig clientConfig = new ClientConfig();
// clientConfig.property(ClientProperties.CONNECT_TIMEOUT, 60000);
// clientConfig.property(ClientProperties.READ_TIMEOUT, 10000);
clientConfig.register(new LoggingFeature());
client = ClientBuilder.newClient(clientConfig);
}
示例13: DemoApplication
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
/**
* Starting point of the application
*
* This class will be loaded and started by Servlet 3
*/
public DemoApplication() {
register(new LoggingFeature());
register(new ApplicationBinder());
packages(DemoApplication.class.getPackage().getName());
LOGGER.debug("Application started!");
}
示例14: provide
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
@Override
public Client provide() {
ClientConfig config = new ClientConfig();
config.property(ClientProperties.CONNECT_TIMEOUT, 1500);
config.property(ClientProperties.READ_TIMEOUT, 1500);
config.register(new LoggingFeature());
Client client = ClientBuilder.newClient(config);
LOGGER.debug(" *** Created client: {}", client);
return client;
}
示例15: ResourcesClient
import org.glassfish.jersey.logging.LoggingFeature; //导入依赖的package包/类
public ResourcesClient(Environment environment, int port) {
this.client = new JerseyClientBuilder(environment)
.build(ResourcesClient.class.getName())
.property(CONNECT_TIMEOUT, 2000)
.property(READ_TIMEOUT, 3000)
.register(new LoggingFeature(getLogger(DEFAULT_LOGGER_NAME), INFO, PAYLOAD_ANY, 2048));
this.resourcesUrls = new ResourcesUrls(port);
}