當前位置: 首頁>>代碼示例>>Java>>正文


Java LoggingFilter類代碼示例

本文整理匯總了Java中org.glassfish.jersey.filter.LoggingFilter的典型用法代碼示例。如果您正苦於以下問題:Java LoggingFilter類的具體用法?Java LoggingFilter怎麽用?Java LoggingFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LoggingFilter類屬於org.glassfish.jersey.filter包,在下文中一共展示了LoggingFilter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
void start() {
    try {
        Config config = core.getConfig();
        String urlStr = config.getString("networking.rest-url");
        ResourceConfig rc = new ResourceConfig();
        rc.register(LoggingFilter.class);
        rc.register(JacksonFeature.class);
        rc.register(CatchAllExceptionMapper.class);
        rc.register(SerializationExceptionMapper.class);
        rc.register(AdminResourceImpl.class);
        rc.register(new KBResourceImpl(core));
        rc.register(new QueryResourceImpl(core));
        httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create(urlStr), rc, true);
        logger.info(marker, "Stargraph listening on {}", urlStr);
    } catch (Exception e) {
        throw new StarGraphException(e);
    }
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:19,代碼來源:Server.java

示例2: run

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
@Override
public void run(S3SrvConfiguration configuration, Environment environment) {
    final Credentials credentials = configuration.buildCredentials();
    credentials.print();
    final StorageBackend storageBackend = configuration.getStorageBackend().build(credentials);

    environment.healthChecks().register("StorageBackend", new StorageBackendHealthCheck(storageBackend));

    environment.jersey().register(new S3OperationsFacade(storageBackend));

    if (configuration.isJerseyLoggingFilterEnabled()) {
        // print request / response headers
        // printEntity=false because printing consumes the input stream and breaks object creation (PUT Bucket)
        environment.jersey().register(new LoggingFilter(Logger.getLogger("InboundRequestResponse"), false));
    }

    environment.jersey().disable(ServerProperties.WADL_FEATURE_DISABLE);
}
 
開發者ID:jenshadlich,項目名稱:s3srv,代碼行數:19,代碼來源:S3SrvApplication.java

示例3: startJobs

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
/**
 * Start Hopsworks jobs with given IDs.
 *
 * @param jobIds
 * @return
 * @throws CredentialsNotFoundException
 */
public static String startJobs(Integer... jobIds) throws CredentialsNotFoundException {
  String uri = HopsUtil.getRestEndpoint() + "/" + Constants.HOPSWORKS_REST_RESOURCE + "/"
      + Constants.HOPSWORKS_REST_APPSERVICE
      + "/jobs/executions";

  ClientConfig config = new ClientConfig().register(LoggingFilter.class);
  Client client = ClientBuilder.newClient(config);
  WebTarget webTarget = client.target(uri);
  JSONObject json = new JSONObject();
  json.put(Constants.JSON_JOBIDS, jobIds);
  json.put(Constants.JSON_KEYSTOREPWD, keystorePwd);
  try {
    json.put(Constants.JSON_KEYSTORE, keystoreEncode());
  } catch (IOException ex) {
    LOG.log(Level.SEVERE, null, ex);
    throw new CredentialsNotFoundException("Could not initialize HopsUtil properties.");
  }
  Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
  Response blogResponse = invocationBuilder.post(Entity.entity(json.toString(), MediaType.APPLICATION_JSON));
  final String response = blogResponse.readEntity(String.class);
  return response;
}
 
開發者ID:hopshadoop,項目名稱:hops-util,代碼行數:30,代碼來源:HopsUtil.java

示例4: startServer

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
/**
 * Start simple http server.
 * 
 * @param debug - if set to true prints out all request and respone headers. That can produce a lot debug informations.
 */
public void startServer(boolean debug) {
    if (debug) {
        server = JdkHttpServerFactory.createHttpServer(jobProxyServerUri,
            new ResourceConfig(Ping.class, Submit.class, State.class, Delete.class)
            .property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true)
            .property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true)
            .register(new LoggingFilter(java.util.logging.Logger.getAnonymousLogger(), true))
            .packages(MODEL_PACKAGE));
    } else {
        server = JdkHttpServerFactory.createHttpServer(jobProxyServerUri,
            new ResourceConfig(Ping.class, Submit.class, State.class, Delete.class)
            .property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true)
            .property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true)
            .packages(MODEL_PACKAGE));
    }
   
}
 
開發者ID:BiBiServ,項目名稱:jobproxy,代碼行數:23,代碼來源:JobProxyServer.java

示例5: TestApplication

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
public TestApplication() {
  // Bean Validation error messages in the response entity.
  property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);

  // X-Jersey-Tracing-nnn diagnostic response headers
  property(ServerProperties.TRACING, "ALL");

  // Server-side request logging, including entities
  register(new LoggingFilter(getAnonymousLogger(), true));

  // Validation configuration
  register(ValidationConfigurationContextResolver.class);

  // JSON configuration
  register(JsonConfiguration.class);
}
 
開發者ID:HuygensING,項目名稱:antioch,代碼行數:17,代碼來源:TestApplication.java

示例6: SwiftProxy

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
public SwiftProxy(Properties properties, BlobStoreLocator locator, URI endpoint) {
    this.endpoint = requireNonNull(endpoint);

    rc = new BounceResourceConfig(properties, locator);
    if (logger.isDebugEnabled()) {
        rc.register(new LoggingFilter(java.util.logging.Logger.getGlobal(), false));
    }
    server = GrizzlyHttpServerFactory.createHttpServer(endpoint, rc, false);
    server.getListeners().forEach(listener -> {
        listener.registerAddOn(new ContentLengthAddOn());
    });

    // allow HTTP DELETE to have payload for multi-object delete
    server.getServerConfiguration().setAllowPayloadForUndefinedHttpMethods(true);

    RuntimeDelegate.setInstance(new RuntimeDelegateImpl(RuntimeDelegate.getInstance()));
}
 
開發者ID:bouncestorage,項目名稱:swiftproxy,代碼行數:18,代碼來源:SwiftProxy.java

示例7: build

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
public Client build(final Configuration config) {
    // setup client
    ClientConfig clientConfig = new ClientConfig();

    if (config.isVerbose()) {
        clientConfig.register(new LoggingFilter(logger("jersey"), false));
    }

    clientConfig.property(ClientProperties.CONNECT_TIMEOUT, config.getTimeout() * 1000);
    clientConfig.property(ClientProperties.READ_TIMEOUT, config.getTimeout() * 1000);

    javax.ws.rs.client.Client client;

    if (config.isVerifySSL()) {
        client = ClientBuilder.newBuilder().withConfig(clientConfig).hostnameVerifier(new HostnameVerifier() {
            @Override
            public boolean verify(String s, SSLSession sslSession) {
                return config.isVerifySSL();
            }
        }).build();
    } else {
        client = ClientBuilder.newClient(clientConfig);
    }

    return client;
}
 
開發者ID:basecrm,項目名稱:basecrm-java,代碼行數:27,代碼來源:HttpClient.java

示例8: create

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
public static WebTarget create(final String baseAddress, final Cache cache) {

		Client client = ClientBuilder.newBuilder().register(JacksonFeature.class)
				.register(LoggingFilter.class)
				.register(JWSJerseyFilter.class)
				.build();

		/*
		IMPORTANT:: This should be active in REAL client module
		
		if (cache != null)
			client = client.register(new RestRequestCachingFilter(cache));

		 */

		WebTarget target = client.target(baseAddress);
		return target;
	}
 
開發者ID:Appverse,項目名稱:appverse-server,代碼行數:19,代碼來源:JWSWebTargetFactory.java

示例9: create

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
/**
 * Create a JWS authentication client
 * @param baseAddress
 * @param cache
 * @param clientKey
 * @return webtarget
 */
public static WebTarget create(final String baseAddress, final Cache cache, final Key clientKey) {

    JWSJerseyFeature authFeature =  JWSJerseyFeature
                    .basicBuilder()
                    .credentials(clientKey)
                    .build();
    Client client = ClientBuilder.newBuilder()
            .register(JacksonFeature.class)
            .register(LoggingFilter.class)
            .register(authFeature)
            .build();

    if (cache != null)
        client = client.register(new RestRequestCachingFilter(cache));

    WebTarget target = client.target(baseAddress);
    return target;
}
 
開發者ID:Appverse,項目名稱:appverse-server,代碼行數:26,代碼來源:WebTargetFactory.java

示例10: serviceInit

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
@Override
protected void serviceInit(Configuration conf) throws Exception {
  GsonFeature gsonFeature = new GsonFeature(PlanGsonHelper.registerAdapters());
  
  ClientApplication clientApplication = new ClientApplication(masterContext);
  ResourceConfig resourceConfig = ResourceConfig.forApplication(clientApplication)
      .register(gsonFeature)
      .register(LoggingFilter.class)
      .property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true)
      .property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
  TajoConf tajoConf = (TajoConf) conf;

  InetSocketAddress address = tajoConf.getSocketAddrVar(TajoConf.ConfVars.REST_SERVICE_ADDRESS);
  URI restServiceURI = new URI("http", null, address.getHostName(), address.getPort(), "/rest", null, null);
  int workerCount = TajoConf.getIntVar(tajoConf, TajoConf.ConfVars.REST_SERVICE_RPC_SERVER_WORKER_THREAD_NUM);
  restServer = NettyRestServerFactory.createNettyRestServer(restServiceURI, resourceConfig, workerCount, false);

  super.serviceInit(conf);
  
  LOG.info("Tajo Rest Service initialized.");
}
 
開發者ID:apache,項目名稱:tajo,代碼行數:22,代碼來源:TajoRestService.java

示例11: should_return_client_with_configuration

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
@Test
public void should_return_client_with_configuration() throws Exception {

    //  Given
    suppress(method(SessionStorage.class, "init"));
    doReturn("http").when(configurationMock).getJasperReportsServerUrl();
    SessionStorage sessionStorage = Mockito.spy(new SessionStorage(configurationMock, credentialsMock, null, null));
    Whitebox.setInternalState(sessionStorage, "client", clientMock);
    Whitebox.setInternalState(sessionStorage, "sessionId", "sessionId");
    doReturn(targetMock).when(clientMock).target(anyString());
    doReturn(targetMock).when(targetMock).register(JacksonFeature.class);
    doReturn(targetMock).when(targetMock).register(MultiPartWriter.class);
    doReturn(targetMock).when(targetMock).register(any(JacksonJsonProvider.class));
    doReturn(targetMock).when(targetMock).register(any(SessionOutputFilter.class));
    doReturn(true).when(configurationMock).getLogHttp();
    doReturn(targetMock).when(targetMock).register(any(LoggingFilter.class));
    when(sessionStorage.getConfiguredClient()).thenReturn(targetMock);

    // When

    // When
    WebTarget configuredClient = sessionStorage.getConfiguredClient();

    // Then
    assertEquals(configuredClient, targetMock);
}
 
開發者ID:Jaspersoft,項目名稱:jrs-rest-java-client,代碼行數:27,代碼來源:SessionStorageTest.java

示例12: initIcingaClient

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
@PostConstruct
public void initIcingaClient() {
    icingaClient = ClientBuilder.newBuilder()
            //disable hostname verification
            .hostnameVerifier((s, sslSession) -> true)
            //ignore SSLHandshakes
            .sslContext(getTrustEverythingSSLContext())
            .build()
            .register(HttpAuthenticationFeature.basic(properties.getApiUsername(), properties.getApiPassword()))
            .register(new ErrorResponseFilter())
            .register(JacksonFeature.class);

    if (LOGGER.isDebugEnabled()) {
        icingaClient.register(LoggingFilter.class);
    }
}
 
開發者ID:ConSol,項目名稱:sakuli,代碼行數:17,代碼來源:Icinga2RestCient.java

示例13: httpsCertAuth

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
/**
 * Produces a HTTPS client with client certificate-based authentication.
 *
 * @param keyStorePath
 *            Key store where client certificate is stored.
 * @param keyStorePassword
 *            Key store password.
 * @param keystoreType
 *            The type of key store.
 * @return
 * @throws RuntimeException
 */
public static Client httpsCertAuth(String keyStorePath, String keyStorePassword, SslKeyStoreType keystoreType)
        throws RuntimeException {

    SSLContext sslContext;
    try (InputStream keystoreFile = new FileInputStream(keyStorePath)) {
        KeyStore keystore = KeyStore.getInstance(keystoreType.name());
        keystore.load(keystoreFile, keyStorePassword.toCharArray());
        sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy())
                .loadKeyMaterial(keystore, keyStorePassword.toCharArray()).build();
    } catch (Exception e) {
        throw new RuntimeException("failed to set up an SSL context: " + e.getMessage(), e);
    }

    Client client = ClientBuilder.newBuilder().sslContext(sslContext).hostnameVerifier(allowAnyVerifier()).build();

    client.register(new LoggingFilter());
    return client;
}
 
開發者ID:elastisys,項目名稱:scale.commons,代碼行數:31,代碼來源:RestClientUtils.java

示例14: getClasses

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
@Override
public Set<Class<?>> getClasses() {
  final Set<Class<?>> classes = new HashSet<>();
  // register root resource
  classes.add(getResource());
  classes.add(MultiPartFeature.class);
  classes.add(LensJAXBContextResolver.class);
  classes.add(LensJAXBValidationExceptionMapper.class);
  classes.add(LensRequestLoggingFilter.class);
  classes.add(LoggingFilter.class);
  classes.add(LensApplicationListener.class);
  classes.add(MoxyJsonConfigurationContextResolver.class);
  classes.add(MoxyJsonFeature.class);
  classes.add(GenericExceptionMapper.class);
  return classes;
}
 
開發者ID:apache,項目名稱:lens,代碼行數:17,代碼來源:BaseApp.java

示例15: getResourceConfig

import org.glassfish.jersey.filter.LoggingFilter; //導入依賴的package包/類
private ResourceConfig getResourceConfig() {
    ResourceConfig rs = new ResourceConfig();

    if (packages.isPresent()) {
        log.debug("RestServer: adding packages " + packages.get());
        rs.packages(packages.get());
    }

    for (Class<?> intf : this.getInterfaces()) {
        log.debug("RestServer: adding interface " + intf.getCanonicalName());
        rs.register(intf);
    }

    return rs.registerClasses(SecurityFilter.class)
            .register(new MoxyXmlFeature())
            .register(new LoggingFilter(java.util.logging.Logger.getLogger(RestServer.class.getName()), true));
}
 
開發者ID:BandwidthOnDemand,項目名稱:nsi-dds,代碼行數:18,代碼來源:RestServer.java


注:本文中的org.glassfish.jersey.filter.LoggingFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。