Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 140adb8d3 -> c4917ade1


ZEPPELIN-748 make websocket maxTextMessageSize configurable

### What is this PR for?
Allow the user to modify the value for  websocket maxTextMessageSize via conf. 
Recently a user filed an issue asking for the size to be configurable.

### What type of PR is it?
Improvement

### Todos
* [ ] - Task

### What is the Jira issue?
[ZEPPELIN-748](https://issues.apache.org/jira/browse/ZEPPELIN-748)

### How should this be tested?
modify the value for maxTextMessageSize in zeppelin-site.xml or zeppelin-env.sh

### Screenshots (if appropriate)
<img width="990" alt="screen shot 2016-03-18 at 3 35 19 pm" 
src="https://cloud.githubusercontent.com/assets/2031306/13874611/1297844c-ed1f-11e5-8512-7307f6c4177d.png";>

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? yes. updated.

Author: Renjith Kamath <[email protected]>

Closes #784 from r-kamath/ZEPPELIN-748 and squashes the following commits:

d3ac141 [Renjith Kamath] update property name
07b38f1 [Renjith Kamath] ZEPPELIN-748 make websocket maxTextMessageSize 
configurable


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

Branch: refs/heads/master
Commit: c4917ade11c07b005af7859fc1d70dc3d2058ec2
Parents: 140adb8
Author: Renjith Kamath <[email protected]>
Authored: Mon Mar 21 12:02:46 2016 +0530
Committer: Felix Cheung <[email protected]>
Committed: Mon Mar 28 19:07:41 2016 -0700

----------------------------------------------------------------------
 conf/zeppelin-env.sh.template                                 | 1 +
 conf/zeppelin-site.xml.template                               | 6 ++++++
 docs/install/install.md                                       | 6 ++++++
 .../main/java/org/apache/zeppelin/server/ZeppelinServer.java  | 3 ++-
 .../java/org/apache/zeppelin/conf/ZeppelinConfiguration.java  | 7 ++++++-
 5 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/c4917ade/conf/zeppelin-env.sh.template
----------------------------------------------------------------------
diff --git a/conf/zeppelin-env.sh.template b/conf/zeppelin-env.sh.template
index ef37909..638162c 100644
--- a/conf/zeppelin-env.sh.template
+++ b/conf/zeppelin-env.sh.template
@@ -62,4 +62,5 @@
 # export ZEPPELIN_SPARK_USEHIVECONTEXT  # Use HiveContext instead of 
SQLContext if set true. true by default.
 # export ZEPPELIN_SPARK_CONCURRENTSQL   # Execute multiple SQL concurrently if 
set true. false by default.
 # export ZEPPELIN_SPARK_MAXRESULT       # Max number of SparkSQL result to 
display. 1000 by default.
+# export ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE       # Size in characters 
of the maximum text message to be received by websocket. Defaults to 1024000
 

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/c4917ade/conf/zeppelin-site.xml.template
----------------------------------------------------------------------
diff --git a/conf/zeppelin-site.xml.template b/conf/zeppelin-site.xml.template
index d904494..93d0495 100755
--- a/conf/zeppelin-site.xml.template
+++ b/conf/zeppelin-site.xml.template
@@ -225,5 +225,11 @@
   <description>Anonymous user allowed by default</description>
 </property>
 
+<property>
+  <name>zeppelin.websocket.max.text.message.size</name>
+  <value>1024000</value>
+  <description>Size in characters of the maximum text message to be received 
by websocket. Defaults to 1024000</description>
+</property>
+
 </configuration>
 

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/c4917ade/docs/install/install.md
----------------------------------------------------------------------
diff --git a/docs/install/install.md b/docs/install/install.md
index 494ee7f..1e204a9 100644
--- a/docs/install/install.md
+++ b/docs/install/install.md
@@ -231,6 +231,12 @@ You can configure Zeppelin with both **environment 
variables** in `conf/zeppelin
     <td>interpreter</td>
     <td>Zeppelin interpreter directory</td>
   </tr>
+  <tr>
+    <td>ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE</td>
+    <td>zeppelin.websocket.max.text.message.size</td>
+    <td>1024000</td>
+    <td>Size in characters of the maximum text message to be received by 
websocket.</td>
+  </tr>
 </table>
 
 Maybe you need to configure individual interpreter. If so, please check 
**Interpreter** section in Zeppelin documentation.

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/c4917ade/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
index 08b179b..bfd3f90 100644
--- 
a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
+++ 
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
@@ -173,8 +173,9 @@ public class ZeppelinServer extends Application {
 
   private static ServletContextHandler 
setupNotebookServer(ZeppelinConfiguration conf) {
     notebookWsServer = new NotebookServer();
+    String maxTextMessageSize = conf.getWebsocketMaxTextMessageSize();
     final ServletHolder servletHolder = new ServletHolder(notebookWsServer);
-    servletHolder.setInitParameter("maxTextMessageSize", "1024000");
+    servletHolder.setInitParameter("maxTextMessageSize", maxTextMessageSize);
 
     final ServletContextHandler cxfContext = new ServletContextHandler(
         ServletContextHandler.SESSIONS);

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/c4917ade/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
index 174e6d2..b33391a 100755
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
@@ -387,6 +387,10 @@ public class ZeppelinConfiguration extends 
XMLConfiguration {
     return 
Arrays.asList(getString(ConfVars.ZEPPELIN_ALLOWED_ORIGINS).toLowerCase().split(","));
   }
 
+  public String getWebsocketMaxTextMessageSize() {
+    return getString(ConfVars.ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE);
+  }
+
   public Map<String, String> dumpConfigurations(ZeppelinConfiguration conf,
                                                 ConfigurationKeyPredicate 
predicate) {
     Map<String, String> configurations = new HashMap<>();
@@ -496,7 +500,8 @@ public class ZeppelinConfiguration extends XMLConfiguration 
{
     // Allows a way to specify a ',' separated list of allowed origins for 
rest and websockets
     // i.e. http://localhost:8080
     ZEPPELIN_ALLOWED_ORIGINS("zeppelin.server.allowed.origins", "*"),
-    ZEPPELIN_ANONYMOUS_ALLOWED("zeppelin.anonymous.allowed", true);
+    ZEPPELIN_ANONYMOUS_ALLOWED("zeppelin.anonymous.allowed", true),
+    
ZEPPELIN_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE("zeppelin.websocket.max.text.message.size",
 "1024000");
 
     private String varName;
     @SuppressWarnings("rawtypes")

Reply via email to