Package com.sun.jersey.api.client.filter

Examples of com.sun.jersey.api.client.filter.LoggingFilter


        if (!hostMap.containsKey(host)) {
            ClientConfig clientConfig = new DefaultClientConfig();
            clientConfig.getClasses().add(MultiPartWriter.class);
            Client client = Client.create(clientConfig);
            if (isDebug) {
                client.addFilter(new LoggingFilter());
            }
            hostMap.put(host, client);
        }
        return hostMap.get(host);
    }
View Full Code Here


  // to make sure we get back a valid token. Validate token using RM function
  // calls. It should only succeed with the kerberos filter
  @Test
  public void testCreateDelegationToken() throws Exception {
    rm.start();
    this.client().addFilter(new LoggingFilter(System.out));
    final String renewer = "test-renewer";
    String jsonBody = "{ \"renewer\" : \"" + renewer + "\" }";
    String xmlBody =
        "<delegation-token><renewer>" + renewer
            + "</renewer></delegation-token>";
View Full Code Here

  // Test to verify renew functionality - create a token and then try to renew
  // it. The renewer should succeed; owner and third user should fail
  @Test
  public void testRenewDelegationToken() throws Exception {
    client().addFilter(new LoggingFilter(System.out));
    rm.start();
    final String renewer = "client2";
    this.client().addFilter(new LoggingFilter(System.out));
    final DelegationToken dummyToken = new DelegationToken();
    dummyToken.setRenewer(renewer);
    String[] mediaTypes =
        { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML };
    for (final String mediaType : mediaTypes) {
View Full Code Here

  // Test to verify cancel functionality - create a token and then try to cancel
  // it. The owner and renewer should succeed; third user should fail
  @Test
  public void testCancelDelegationToken() throws Exception {
    rm.start();
    this.client().addFilter(new LoggingFilter(System.out));
    if (isKerberosAuth == false) {
      verifySimpleAuthCancel();
      return;
    }
View Full Code Here

    }
  }
 
  protected void lookup(int duration, String fingerprint) {
    Client client = Client.create();
    client.addFilter(new LoggingFilter(System.out));
    client.addFilter(new GZIPContentEncodingFilter(true));
    WebResource webResource = client.resource(this.ACOUSTID_SERVICE_URL);
   
// DONE: convert this (parameter in url) to form encoded post
//    JSONObject object = webResource.queryParam("client", SERVICE_KEY)
View Full Code Here

    private void importRelease(Map<String, List<String>> result, Map<String, String> artistCache, Map<String, String> personCache, Map<String, String> labelCache, Map<String, String> genreCache, Map<String, String> styleCache, String discogsReleaseId) throws ParserConfigurationException, IOException, SAXException {
//        String data = Client.create().resource("http://www.discogs.com/release/" + discogsReleaseId + "?f=xml&api_key=" + API_KEY).accept(MediaType.APPLICATION_XML).header("Accept-Encoding", "gzip").header("User-Agent",USER_AGENT).get(String.class);
// Logging version
      Client client = Client.create();
    client.addFilter(new LoggingFilter(System.out));
    WebResource webResource = client.resource("http://www.discogs.com/release/" + discogsReleaseId + "?f=xml&api_key=" + API_KEY);
    String data = webResource.accept(MediaType.APPLICATION_XML).header("Accept-Encoding", "gzip").header("User-Agent",USER_AGENT).get(String.class);
   
        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(data.getBytes()));
        NodeList releases = doc.getElementsByTagName("release");
View Full Code Here

    }
    invoker.setLoggingEnable(enableLogging);
        //initialize the logger if needed
        if(loggingEnabled) {
          if(logger == null) {
            apiClient.addFilter(new LoggingFilter());
          }else{
            apiClient.addFilter(new LoggingFilter(logger));
          }
        }
        apiInvoker = invoker;
        return invoker;
  }
View Full Code Here

    }
   
    public void testProducesFormDataCharsetResource() throws Exception {
        startServer(ProducesFormDataCharsetResource.class);

        client.addFilter(new LoggingFilter());
        String c = "\u00A9 CONTENT \u00FF \u2200 \u22FF";
        for (String charset : Arrays.asList(
                "US-ASCII",
                "ISO-8859-1",
                "UTF-8",
View Full Code Here

     *
     * @param location URL to the base of resources, e.g. http://localhost:8080/template-server/rest
     */
    public TalkClient(String location) {
        Client client = Client.create();
        client.addFilter(new LoggingFilter(System.out));
        webResource = client.resource(location + "/talk");
    }
View Full Code Here

  private Client getClient(String host) {
    if (!hostMap.containsKey(host)) {
      Client client = Client.create();
      if (isDebug)
        client.addFilter(new LoggingFilter());
      hostMap.put(host, client);
    }
    return hostMap.get(host);
  }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.filter.LoggingFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.