lens-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject [50/50] [abbrv] incubator-lens git commit: LENS-702: Ability to inspect GET and POST request that are to be submitted to Lens Server
Date Tue, 11 Aug 2015 12:21:13 GMT
LENS-702: Ability to inspect GET and POST request that are to be submitted to Lens Server


Project: http://git-wip-us.apache.org/repos/asf/incubator-lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-lens/commit/1ba567f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-lens/tree/1ba567f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-lens/diff/1ba567f5

Branch: refs/heads/current-release-line
Commit: 1ba567f5c20fab5a3a509e8fb2a1a19e952f93b0
Parents: 55f03d3
Author: Pranav Kumar Agarwal <praagarw@gmail.com>
Authored: Tue Aug 11 17:35:02 2015 +0530
Committer: Rajat Khandelwal <prongs@apache.org>
Committed: Tue Aug 11 17:35:02 2015 +0530

----------------------------------------------------------------------
 .../apache/lens/client/LensClientConfig.java    |  8 +++++
 .../org/apache/lens/client/LensConnection.java  | 18 +++++++---
 .../lens/client/LensConnectionParams.java       | 25 +++++++++++++
 .../apache/lens/client/LensMetadataClient.java  |  3 +-
 .../org/apache/lens/client/LensStatement.java   | 32 ++++++++---------
 .../org/apache/lens/client/RequestFilter.java   | 36 +++++++++++++++++++
 .../src/main/resources/lens-client-default.xml  | 10 ++++++
 .../apache/lens/client/RequestTestFilter.java   | 37 ++++++++++++++++++++
 .../org/apache/lens/client/TestLensClient.java  |  1 +
 .../src/test/resources/lens-client-site.xml     | 33 +++++++++++++++++
 .../apache/lens/client/LensMLJerseyClient.java  |  4 +--
 src/site/apt/user/client-config.apt             |  8 +++--
 12 files changed, 186 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/main/java/org/apache/lens/client/LensClientConfig.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensClientConfig.java b/lens-client/src/main/java/org/apache/lens/client/LensClientConfig.java
index f71c58f..6a35a5e 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensClientConfig.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensClientConfig.java
@@ -78,6 +78,10 @@ public class LensClientConfig extends Configuration {
   /** The Constant SESSION_CLUSTER_USER. */
   public static final String SESSION_CLUSTER_USER = "lens.session.cluster.user";
 
+  public static final String SESSION_FILTER_NAMES = CLIENT_PFX + "ws.request.filternames";
+
+  public static final String WS_FILTER_IMPL_SFX = ".ws.filter.impl";
+
   /**
    * Get the username from config
    *
@@ -151,4 +155,8 @@ public class LensClientConfig extends Configuration {
   public String getLogResourcePath() {
     return DEFAULT_LOG_RESOURCE_PATH;
   }
+
+  public static String getWSFilterImplConfKey(String filterName) {
+    return CLIENT_PFX + filterName + WS_FILTER_IMPL_SFX;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/main/java/org/apache/lens/client/LensConnection.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensConnection.java b/lens-client/src/main/java/org/apache/lens/client/LensConnection.java
index 5de8c08..30a7e2c 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensConnection.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensConnection.java
@@ -19,6 +19,7 @@
 package org.apache.lens.client;
 
 import java.net.ConnectException;
+import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -108,18 +109,25 @@ public class LensConnection {
     return client.target(params.getBaseConnectionUrl()).path(params.getMetastoreResourcePath());
   }
 
+  public Client buildClient() {
+    ClientBuilder cb = ClientBuilder.newBuilder().register(MultiPartFeature.class);
+    Iterator<Class<?>> itr = params.getRequestFilters().iterator();
+    while (itr.hasNext()) {
+      cb.register(itr.next());
+    }
+    return cb.build();
+  }
+
   private WebTarget getSessionWebTarget() {
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
-    return getSessionWebTarget(client);
+    return getSessionWebTarget(buildClient());
   }
 
   private WebTarget getMetastoreWebTarget() {
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
-    return getMetastoreWebTarget(client);
+    return getMetastoreWebTarget(buildClient());
   }
 
   public WebTarget getLogWebTarget() {
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
+    Client client = buildClient();
     return getLogWebTarget(client);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/main/java/org/apache/lens/client/LensConnectionParams.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensConnectionParams.java b/lens-client/src/main/java/org/apache/lens/client/LensConnectionParams.java
index ccd4a98..3a5dcdb 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensConnectionParams.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensConnectionParams.java
@@ -19,14 +19,21 @@
 package org.apache.lens.client;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.lens.api.LensConf;
 
+
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+
 /**
  * Top level class which encapsulates connections parameters required for lens connection.
  */
+@Slf4j
 public class LensConnectionParams {
 
   /** The lens confs. */
@@ -39,13 +46,30 @@ public class LensConnectionParams {
   private Map<String, String> sessionVars = new HashMap<String, String>();
 
   /** The conf. */
+  @Getter
   private final LensClientConfig conf;
 
+  @Getter
+  private Set<Class<?>> requestFilters = new HashSet<Class<?>>();
+
+  private void setupRequestFilters() {
+    if (this.conf.get(LensClientConfig.SESSION_FILTER_NAMES) != null) {
+      String[] filterNames = this.conf.getStrings(LensClientConfig.SESSION_FILTER_NAMES);
+      for (String filterName : filterNames) {
+        Class wsFilterClass = this.conf.getClass(LensClientConfig.getWSFilterImplConfKey(filterName),
null);
+        if (wsFilterClass != null) {
+          requestFilters.add(wsFilterClass);
+        }
+        log.info("Request filter added " + filterName);
+      }
+    }
+  }
   /**
    * Construct parameters required to connect to lens server using values in lens-client-site.xml
    */
   public LensConnectionParams() {
     this.conf = new LensClientConfig();
+    setupRequestFilters();
   }
 
   /**
@@ -55,6 +79,7 @@ public class LensConnectionParams {
    */
   public LensConnectionParams(LensClientConfig conf) {
     this.conf = conf;
+    setupRequestFilters();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java b/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
index 3637ab8..4dec1a2 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
@@ -74,8 +74,7 @@ public class LensMetadataClient {
 
 
   private WebTarget getMetastoreWebTarget() {
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
-    return getMetastoreWebTarget(client);
+    return getMetastoreWebTarget(connection.buildClient());
   }
 
   public List<String> getAlldatabases() {

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensStatement.java b/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
index 4612f6a..397bd82 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
@@ -21,7 +21,6 @@ package org.apache.lens.client;
 import java.util.List;
 
 import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.GenericType;
@@ -40,7 +39,6 @@ import org.apache.commons.lang.StringUtils;
 import org.glassfish.jersey.media.multipart.FormDataBodyPart;
 import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
 import org.glassfish.jersey.media.multipart.FormDataMultiPart;
-import org.glassfish.jersey.media.multipart.MultiPartFeature;
 
 /**
  * Top level class which is used to execute lens queries.
@@ -135,7 +133,7 @@ public class LensStatement {
       throw new IllegalStateException("Lens Connection has to be " + "established before
querying");
     }
 
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
+    Client client = connection.buildClient();
     WebTarget target = getPreparedQueriesWebTarget(client);
 
     QueryPrepareHandle handle = target.request().post(
@@ -157,7 +155,7 @@ public class LensStatement {
       throw new IllegalStateException("Lens Connection has to be " + "established before
querying");
     }
 
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
+    Client client = connection.buildClient();
 
     WebTarget target = getPreparedQueriesWebTarget(client);
 
@@ -252,7 +250,7 @@ public class LensStatement {
    */
   public LensQuery getQuery(QueryHandle handle) {
     try {
-      Client client = ClientBuilder.newClient();
+      Client client = connection.buildClient();
       WebTarget target = getQueryWebTarget(client);
       this.query = target.path(handle.toString()).queryParam("sessionid", connection.getSessionHandle()).request()
         .get(LensQuery.class);
@@ -270,7 +268,7 @@ public class LensStatement {
    */
   public LensPreparedQuery getPreparedQuery(QueryPrepareHandle handle) {
     try {
-      Client client = ClientBuilder.newClient();
+      Client client = connection.buildClient();
       WebTarget target = getPreparedQueriesWebTarget((client));
       return target.path(handle.toString()).queryParam("sessionid", connection.getSessionHandle()).request()
         .get(LensPreparedQuery.class);
@@ -291,7 +289,7 @@ public class LensStatement {
       throw new IllegalStateException("Lens Connection has to be " + "established before
querying");
     }
 
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
+    Client client  = connection.buildClient();
     FormDataMultiPart mp = new FormDataMultiPart();
     mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("sessionid").build(),
connection
       .getSessionHandle(), MediaType.APPLICATION_XML_TYPE));
@@ -323,7 +321,7 @@ public class LensStatement {
       throw new IllegalStateException("Lens Connection has to be " + "established before
querying");
     }
 
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
+    Client client = connection.buildClient();
     WebTarget target = getPreparedQueriesWebTarget((client)).path(phandle.toString());
     FormDataMultiPart mp = new FormDataMultiPart();
     mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("sessionid").build(),
connection
@@ -349,7 +347,7 @@ public class LensStatement {
       throw new IllegalStateException("Lens Connection has to be " + "established before
querying");
     }
 
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
+    Client client = connection.buildClient();
     FormDataMultiPart mp = new FormDataMultiPart();
     mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("sessionid").build(),
connection
       .getSessionHandle(), MediaType.APPLICATION_XML_TYPE));
@@ -374,7 +372,7 @@ public class LensStatement {
    * @return the all queries
    */
   public List<QueryHandle> getAllQueries(String state, String queryName, String user,
long fromDate, long toDate) {
-    WebTarget target = getQueryWebTarget(ClientBuilder.newBuilder().register(MultiPartFeature.class).build());
+    WebTarget target = getQueryWebTarget(connection.buildClient());
     List<QueryHandle> handles = target.queryParam("sessionid", connection.getSessionHandle())
       .queryParam("state", state).queryParam("queryName", queryName).queryParam("user", user)
       .queryParam("fromDate", fromDate).queryParam("toDate", toDate).request()
@@ -393,7 +391,7 @@ public class LensStatement {
    * @return the all prepared queries
    */
   public List<QueryPrepareHandle> getAllPreparedQueries(String userName, String queryName,
long fromDate, long toDate) {
-    Client client = ClientBuilder.newClient();
+    Client client = connection.buildClient();
     WebTarget target = getPreparedQueriesWebTarget(client);
     List<QueryPrepareHandle> handles = target.queryParam("sessionid", connection.getSessionHandle())
       .queryParam("user", userName).queryParam("queryName", queryName).queryParam("fromDate",
fromDate)
@@ -415,7 +413,7 @@ public class LensStatement {
     if (query.getStatus().getStatus() != QueryStatus.Status.SUCCESSFUL) {
       throw new IllegalArgumentException("Result set metadata " + "can be only queries for
successful queries");
     }
-    Client client = ClientBuilder.newClient();
+    Client client = connection.buildClient();
 
     try {
       WebTarget target = getQueryWebTarget(client);
@@ -445,7 +443,7 @@ public class LensStatement {
     if (query.getStatus().getStatus() != QueryStatus.Status.SUCCESSFUL) {
       throw new IllegalArgumentException("Result set metadata " + "can be only queries for
successful queries");
     }
-    Client client = ClientBuilder.newClient();
+    Client client = connection.buildClient();
 
     try {
       WebTarget target = getQueryWebTarget(client);
@@ -466,7 +464,7 @@ public class LensStatement {
     if (query.getStatus().getStatus() != QueryStatus.Status.SUCCESSFUL) {
       throw new IllegalArgumentException("Result set metadata " + "can be only queries for
successful queries");
     }
-    Client client = ClientBuilder.newClient();
+    Client client = connection.buildClient();
 
     try {
       WebTarget target = getQueryWebTarget(client);
@@ -498,7 +496,7 @@ public class LensStatement {
       return false;
     }
 
-    Client client = ClientBuilder.newClient();
+    Client client = connection.buildClient();
     WebTarget target = getQueryWebTarget(client);
 
     APIResult result = target.path(query.getQueryHandle().toString())
@@ -516,7 +514,7 @@ public class LensStatement {
     if (!query.getStatus().isResultSetAvailable()) {
       return false;
     }
-    Client client = ClientBuilder.newClient();
+    Client client = connection.buildClient();
     WebTarget target = getQueryWebTarget(client);
 
     APIResult result = target.path(query.getQueryHandle().toString()).path("resultset")
@@ -532,7 +530,7 @@ public class LensStatement {
    * @return true, if successful
    */
   public boolean destroyPrepared(QueryPrepareHandle phandle) {
-    Client client = ClientBuilder.newClient();
+    Client client = connection.buildClient();
     WebTarget target = getPreparedQueriesWebTarget(client);
 
     APIResult result = target.path(phandle.toString()).queryParam("sessionid", connection.getSessionHandle()).request()

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/main/java/org/apache/lens/client/RequestFilter.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/RequestFilter.java b/lens-client/src/main/java/org/apache/lens/client/RequestFilter.java
new file mode 100644
index 0000000..c603043
--- /dev/null
+++ b/lens-client/src/main/java/org/apache/lens/client/RequestFilter.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.client;
+
+import java.io.IOException;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+
+
+/**
+ * Manage Client Request.
+ */
+
+public class RequestFilter implements ClientRequestFilter {
+  @Override
+  public void filter(ClientRequestContext requestContext) throws IOException {
+    // manage your request parameters here
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/main/resources/lens-client-default.xml
----------------------------------------------------------------------
diff --git a/lens-client/src/main/resources/lens-client-default.xml b/lens-client/src/main/resources/lens-client-default.xml
index 5a8b019..d0d40c5 100644
--- a/lens-client/src/main/resources/lens-client-default.xml
+++ b/lens-client/src/main/resources/lens-client-default.xml
@@ -36,4 +36,14 @@
     <value>http://0.0.0.0:9999/lensapi</value>
     <description>The base url for the lens server</description>
   </property>
+  <property>
+    <name>lens.client.ws.request.filternames</name>
+    <value>requestfilter</value>
+    <description>These JAX-RS filters would be started in the specified order when
lens-client starts</description>
+  </property>
+  <property>
+    <name>lens.client.requestfilter.ws.filter.impl</name>
+    <value>org.apache.lens.client.RequestFilter</value>
+    <description>Implementation class for Request Filter</description>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/test/java/org/apache/lens/client/RequestTestFilter.java
----------------------------------------------------------------------
diff --git a/lens-client/src/test/java/org/apache/lens/client/RequestTestFilter.java b/lens-client/src/test/java/org/apache/lens/client/RequestTestFilter.java
new file mode 100644
index 0000000..f1ad7bd
--- /dev/null
+++ b/lens-client/src/test/java/org/apache/lens/client/RequestTestFilter.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.client;
+
+import java.io.IOException;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+
+import lombok.Getter;
+
+public class RequestTestFilter implements ClientRequestFilter {
+
+  @Getter
+  static boolean accessed = false;
+
+  public void filter(ClientRequestContext requestContext) throws IOException {
+    accessed = true;
+    requestContext.getHeaders().add("DUMMY_HEADER_NAME", "DUMMY_HEADER_VALUE");
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/test/java/org/apache/lens/client/TestLensClient.java
----------------------------------------------------------------------
diff --git a/lens-client/src/test/java/org/apache/lens/client/TestLensClient.java b/lens-client/src/test/java/org/apache/lens/client/TestLensClient.java
index 35d52db..7a00f65 100644
--- a/lens-client/src/test/java/org/apache/lens/client/TestLensClient.java
+++ b/lens-client/src/test/java/org/apache/lens/client/TestLensClient.java
@@ -80,5 +80,6 @@ public class TestLensClient extends LensAllApplicationJerseyTest {
     Assert.assertTrue(client.getAllDatabases().contains("testclientdb"));
     client.dropDatabase("testclientdb", false);
     Assert.assertFalse(client.getAllDatabases().contains("testclientdb"));
+    Assert.assertTrue(RequestTestFilter.isAccessed(), "RequestTestFilter not invoked");
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-client/src/test/resources/lens-client-site.xml
----------------------------------------------------------------------
diff --git a/lens-client/src/test/resources/lens-client-site.xml b/lens-client/src/test/resources/lens-client-site.xml
new file mode 100644
index 0000000..b356e5e
--- /dev/null
+++ b/lens-client/src/test/resources/lens-client-site.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<configuration>
+    <property>
+        <name>lens.client.ws.request.filternames</name>
+        <value>requestfilter</value>
+        <description>These JAX-RS filters would be started in the specified order when
lens-client starts</description>
+    </property>
+    <property>
+        <name>lens.client.requestfilter.ws.filter.impl</name>
+        <value>org.apache.lens.client.RequestTestFilter</value>
+        <description>Implementation class for Request Filter</description>
+    </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/lens-ml-lib/src/main/java/org/apache/lens/client/LensMLJerseyClient.java
----------------------------------------------------------------------
diff --git a/lens-ml-lib/src/main/java/org/apache/lens/client/LensMLJerseyClient.java b/lens-ml-lib/src/main/java/org/apache/lens/client/LensMLJerseyClient.java
index 875e692..2ccdf2a 100644
--- a/lens-ml-lib/src/main/java/org/apache/lens/client/LensMLJerseyClient.java
+++ b/lens-ml-lib/src/main/java/org/apache/lens/client/LensMLJerseyClient.java
@@ -23,7 +23,6 @@ import java.util.Map;
 
 import javax.ws.rs.NotFoundException;
 import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.client.Entity;
 import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.Form;
@@ -39,7 +38,6 @@ import org.apache.hadoop.conf.Configuration;
 import org.glassfish.jersey.media.multipart.FormDataBodyPart;
 import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
 import org.glassfish.jersey.media.multipart.FormDataMultiPart;
-import org.glassfish.jersey.media.multipart.MultiPartFeature;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -85,7 +83,7 @@ public class LensMLJerseyClient {
   }
 
   protected WebTarget getMLWebTarget() {
-    Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
+    Client client = connection.buildClient();
     LensConnectionParams connParams = connection.getLensConnectionParams();
     String baseURI = connParams.getBaseConnectionUrl();
     String mlURI = connParams.getConf().get(LENS_ML_RESOURCE_PATH, DEFAULT_ML_RESOURCE_PATH);

http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/1ba567f5/src/site/apt/user/client-config.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/user/client-config.apt b/src/site/apt/user/client-config.apt
index b482108..49bc4e2 100644
--- a/src/site/apt/user/client-config.apt
+++ b/src/site/apt/user/client-config.apt
@@ -26,8 +26,12 @@ Lens client configuration
 *--+--+---+--+
 |1|lens.client.dbname|default|Default lens database|
 *--+--+---+--+
-|2|lens.client.user.name|anonymous|Lens client user name|
+|2|lens.client.requestfilter.ws.filter.impl|org.apache.lens.client.RequestFilter|Implementation
class for Request Filter|
 *--+--+---+--+
-|3|lens.server.base.url|http://0.0.0.0:9999/lensapi|The base url for the lens server|
+|3|lens.client.user.name|anonymous|Lens client user name|
+*--+--+---+--+
+|4|lens.client.ws.request.filternames|requestfilter|These JAX-RS filters would be started
in the specified order when lens-client starts|
+*--+--+---+--+
+|5|lens.server.base.url|http://0.0.0.0:9999/lensapi|The base url for the lens server|
 *--+--+---+--+
 The configuration parameters and their default values


Mime
View raw message