PDA

View Full Version : Change context root of administration console



bjork
05-16-2012, 10:10 AM
I am trying to change the context root of the administration console from / to /admin. I have extended the org.pentaho.pac.common.server.JettyServer class with a new class overriding createServletContext() and configureServlets(Context servletContext) see below. I have changed the classpath in start-pac.sh to -cp $CLASSPATH org.pentaho.pac.server.JettyServerAdmin. However when I start the administration console it is still running under context root /

How can I change the context root?


package org.pentaho.pac.server;

import org.mortbay.jetty.handler.ContextHandlerCollection;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;

public class JettyServerAdmin extends JettyServer {

public JettyServerAdmin() {
super();
}

protected Context createServletContext() {
ContextHandlerCollection contextHandlers = new ContextHandlerCollection();
Context servletContext = new Context(contextHandlers, "/admin", Context.SESSIONS); //$NON-NLS-1$
servletContext.setResourceBase( getResourceBaseName() );
servletContext.setWelcomeFiles( getWelcomeFiles() );

return servletContext;
}

public void configureServlets( Context servletContext ) {
// add servlets
ServletHolder defaultServlet = new ServletHolder(new DefaultConsoleServlet("/admin-ce", this)); //$NON-NLS-1$
servletContext.addServlet(defaultServlet, "/admin/*"); //$NON-NLS-1$
servletContext.addServlet(defaultServlet, "/admin/halt"); //$NON-NLS-1$

ServletHolder welcomeServlet = new ServletHolder(new BrowserLocaleServlet());
servletContext.addServlet(welcomeServlet, "/admin/browserlocalesvc"); //$NON-NLS-1$

ServletHolder pacsvc = new ServletHolder(new org.pentaho.pac.server.PacServiceImpl());
servletContext.addServlet(pacsvc, "/admin/pacsvc"); //$NON-NLS-1$

ServletHolder schedulersvc = new ServletHolder(new org.pentaho.pac.server.SchedulerServiceImpl());
servletContext.addServlet(schedulersvc, "/admin/schedulersvc"); //$NON-NLS-1$

ServletHolder subscriptionsvc = new ServletHolder(new org.pentaho.pac.server.SubscriptionServiceImpl());
servletContext.addServlet(subscriptionsvc, "/admin/subscriptionsvc"); //$NON-NLS-1$

ServletHolder solutionrepositorysvc = new ServletHolder(new org.pentaho.pac.server.SolutionRepositoryServiceImpl());
servletContext.addServlet(solutionrepositorysvc, "/admin/solutionrepositorysvc"); //$NON-NLS-1$

ServletHolder jdbcdriverdiscoveryservice = new ServletHolder(new org.pentaho.pac.server.common.JdbcDriverDiscoveryServiceImpl());
servletContext.addServlet(jdbcdriverdiscoveryservice, "/admin/jdbcdriverdiscoverysvc"); //$NON-NLS-1$

ServletHolder hibernateconfigurationservice = new ServletHolder(new org.pentaho.pac.server.common.HibernateConfigurationServiceImpl());
servletContext.addServlet(hibernateconfigurationservice, "/admin/hibernateconfigurationsvc"); //$NON-NLS-1$

}
}