mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Allow to configure the context path of the webapp via zeppelin.server.context.path property or ZEPPELIN_CONTEXT_PATH env variable + add doc on this
This commit is contained in:
parent
0c50712e3e
commit
9095d5d3b5
5 changed files with 23 additions and 6 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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_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>
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class ZeppelinServer extends Application {
|
|||
jettyServer = setupJettyServer(conf);
|
||||
|
||||
// REST api
|
||||
final ServletContextHandler restApi = setupRestApiContextHandler();
|
||||
final ServletContextHandler restApi = setupRestApiContextHandler(conf);
|
||||
|
||||
// Notebook server
|
||||
final ServletContextHandler notebook = setupNotebookServer(conf);
|
||||
|
|
@ -170,7 +170,7 @@ public class ZeppelinServer extends Application {
|
|||
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));
|
||||
|
|
@ -210,7 +210,7 @@ public class ZeppelinServer extends Application {
|
|||
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");
|
||||
|
|
@ -218,7 +218,7 @@ public class ZeppelinServer extends Application {
|
|||
|
||||
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), "/*",
|
||||
|
|
@ -235,7 +235,7 @@ public class ZeppelinServer extends Application {
|
|||
// 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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -268,6 +268,10 @@ public class ZeppelinConfiguration extends XMLConfiguration {
|
|||
return getInt(ConfVars.ZEPPELIN_PORT);
|
||||
}
|
||||
|
||||
public String getContextPath() {
|
||||
return getString(ConfVars.ZEPPELIN_CONTEXT_PATH);
|
||||
}
|
||||
|
||||
public String getKeyStorePath() {
|
||||
return getRelativeDir(
|
||||
String.format("%s/%s",
|
||||
|
|
@ -383,6 +387,7 @@ public class ZeppelinConfiguration extends XMLConfiguration {
|
|||
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"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue