Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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/install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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_SERVER_CONTEXT_PATH</td>
<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 @@ -170,7 +170,7 @@ private static ServletContextHandler setupNotebookServer(ZeppelinConfiguration c
ServletContextHandler.SESSIONS);

cxfContext.setSessionHandler(new SessionHandler());
cxfContext.setContextPath("/");
cxfContext.setContextPath(conf.getServerContextPath());
cxfContext.addServlet(servletHolder, "/ws/*");
cxfContext.addFilter(new FilterHolder(CorsFilter.class), "/*",
EnumSet.allOf(DispatcherType.class));
Expand Down Expand Up @@ -210,16 +210,16 @@ 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.addServlet(cxfServletHolder, "/*");
cxfContext.setContextPath(conf.getServerContextPath());
cxfContext.addServlet(cxfServletHolder, "/api/*");

cxfContext.addFilter(new FilterHolder(CorsFilter.class), "/*",
EnumSet.allOf(DispatcherType.class));
Expand All @@ -230,12 +230,12 @@ private static WebAppContext setupWebAppContext(
ZeppelinConfiguration conf) {

WebAppContext webApp = new WebAppContext();
webApp.setContextPath(conf.getServerContextPath());
File warPath = new File(conf.getString(ConfVars.ZEPPELIN_WAR));
if (warPath.isDirectory()) {
// Development mode, read from FS
// webApp.setDescriptor(warPath+"/WEB-INF/web.xml");
webApp.setResourceBase(warPath.getPath());
webApp.setContextPath("/");
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 getServerContextPath() {
return getString(ConfVars.ZEPPELIN_SERVER_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_SERVER_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