Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions conf/zeppelin-site.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
<description>Server port.</description>
</property>

<property>
<name>zeppelin.server.context.path</name>
<value>/</value>
<description>Context Path of the Web Application</description>
</property>

<property>
<name>zeppelin.notebook.dir</name>
<value>notebook</value>
Expand Down
6 changes: 6 additions & 0 deletions docs/docs/install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ Configuration can be done by both environment variable(conf/zeppelin-env.sh) and
<td>8080</td>
<td>Zeppelin server port. Note that port+1 is used for web socket</td>
</tr>
<tr>
<td>ZEPPELIN_CONTEXT_PATH</td>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be ZEPPELIN_SERVER_CONTEXT_PATH?
there is a object called ZeppelinContext in the Spark interpreter group and this name might be confusing

<td>zeppelin.server.context.path</td>
<td>/</td>
<td>Context Path of the Web Application</td>
</tr>
<tr>
<td>ZEPPELIN_NOTEBOOK_DIR</td>
<td>zeppelin.notebook.dir</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static void main(String[] args) throws Exception {
jettyServer = setupJettyServer(conf);

// REST api
final ServletContextHandler restApi = setupRestApiContextHandler();
final ServletContextHandler restApi = setupRestApiContextHandler(conf);

// Notebook server
final ServletContextHandler notebook = setupNotebookServer(conf);
Expand Down Expand Up @@ -168,7 +168,7 @@ private static ServletContextHandler setupNotebookServer(ZeppelinConfiguration c
ServletContextHandler.SESSIONS);

cxfContext.setSessionHandler(new SessionHandler());
cxfContext.setContextPath("/");
cxfContext.setContextPath(conf.getContextPath());
cxfContext.addServlet(servletHolder, "/ws/*");
cxfContext.addFilter(new FilterHolder(CorsFilter.class), "/*",
EnumSet.allOf(DispatcherType.class));
Expand Down Expand Up @@ -208,15 +208,15 @@ private static SSLContext getSslContext(ZeppelinConfiguration conf)
return scf.getSslContext();
}

private static ServletContextHandler setupRestApiContextHandler() {
private static ServletContextHandler setupRestApiContextHandler(ZeppelinConfiguration conf) {
final ServletHolder cxfServletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
cxfServletHolder.setInitParameter("javax.ws.rs.Application", ZeppelinServer.class.getName());
cxfServletHolder.setName("rest");
cxfServletHolder.setForcedPath("rest");

final ServletContextHandler cxfContext = new ServletContextHandler();
cxfContext.setSessionHandler(new SessionHandler());
cxfContext.setContextPath("/api");
cxfContext.setContextPath(conf.getContextPath() + "/api");
cxfContext.addServlet(cxfServletHolder, "/*");

cxfContext.addFilter(new FilterHolder(CorsFilter.class), "/*",
Expand All @@ -233,7 +233,7 @@ private static WebAppContext setupWebAppContext(
// Development mode, read from FS
// webApp.setDescriptor(warPath+"/WEB-INF/web.xml");
webApp.setResourceBase(warPath.getPath());
webApp.setContextPath("/");
webApp.setContextPath(conf.getContextPath());
webApp.setParentLoaderPriority(true);
} else {
// use packaged WAR
Expand Down
2 changes: 1 addition & 1 deletion zeppelin-web/src/components/baseUrl/baseUrl.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ angular.module('zeppelinWebApp').service('baseUrlSrv', function() {

this.getWebsocketUrl = function() {
var wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
return wsProtocol + '//' + location.hostname + ':' + this.getPort() + '/ws';
return wsProtocol + '//' + location.hostname + ':' + this.getPort() + skipTrailingSlash(location.pathname) + '/ws';
};

this.getRestApiBase = function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ public int getServerPort() {
return getInt(ConfVars.ZEPPELIN_PORT);
}

public String getContextPath() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for naming of this..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixcheung Makes sense. Just pushed an update that does this.

return getString(ConfVars.ZEPPELIN_CONTEXT_PATH);
}

public String getKeyStorePath() {
return getRelativeDir(
String.format("%s/%s",
Expand Down Expand Up @@ -383,6 +387,7 @@ public static enum ConfVars {
ZEPPELIN_HOME("zeppelin.home", "../"),
ZEPPELIN_ADDR("zeppelin.server.addr", "0.0.0.0"),
ZEPPELIN_PORT("zeppelin.server.port", 8080),
ZEPPELIN_CONTEXT_PATH("zeppelin.server.context.path", "/"),
ZEPPELIN_SSL("zeppelin.ssl", false),
ZEPPELIN_SSL_CLIENT_AUTH("zeppelin.ssl.client.auth", false),
ZEPPELIN_SSL_KEYSTORE_PATH("zeppelin.ssl.keystore.path", "keystore"),
Expand Down