org.mortbay.jetty.handler.HandlerCollection Java Examples

The following examples show how to use org.mortbay.jetty.handler.HandlerCollection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Jetty6PluginServer.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the handler structure to receive a webapp. Also put in a DefaultHandler so we get a nice page than a 404
 * if we hit the root and the webapp's context isn't at root.
 */
public void configureHandlers() throws Exception {
    this.defaultHandler = new DefaultHandler();
    this.requestLogHandler = new RequestLogHandler();
    if (this.requestLog != null) {
        this.requestLogHandler.setRequestLog(this.requestLog);
    }

    this.contexts = (ContextHandlerCollection) server.getChildHandlerByClass(ContextHandlerCollection.class);
    if (this.contexts == null) {
        this.contexts = new ContextHandlerCollection();
        this.handlers = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        if (this.handlers == null) {
            this.handlers = new HandlerCollection();
            this.server.setHandler(handlers);
            this.handlers.setHandlers(new Handler[]{this.contexts, this.defaultHandler, this.requestLogHandler});
        } else {
            this.handlers.addHandler(this.contexts);
        }
    }
}
 
Example #2
Source File: Jetty6PluginServer.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the handler structure to receive a webapp. Also put in a DefaultHandler so we get a nice page than a 404
 * if we hit the root and the webapp's context isn't at root.
 */
public void configureHandlers() throws Exception {
    this.defaultHandler = new DefaultHandler();
    this.requestLogHandler = new RequestLogHandler();
    if (this.requestLog != null) {
        this.requestLogHandler.setRequestLog(this.requestLog);
    }

    this.contexts = (ContextHandlerCollection) server.getChildHandlerByClass(ContextHandlerCollection.class);
    if (this.contexts == null) {
        this.contexts = new ContextHandlerCollection();
        this.handlers = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        if (this.handlers == null) {
            this.handlers = new HandlerCollection();
            this.server.setHandler(handlers);
            this.handlers.setHandlers(new Handler[]{this.contexts, this.defaultHandler, this.requestLogHandler});
        } else {
            this.handlers.addHandler(this.contexts);
        }
    }
}
 
Example #3
Source File: Jetty6PluginServer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the handler structure to receive a webapp. Also put in a DefaultHandler so we get a nice page than a 404
 * if we hit the root and the webapp's context isn't at root.
 */
public void configureHandlers() throws Exception {
    this.defaultHandler = new DefaultHandler();
    this.requestLogHandler = new RequestLogHandler();
    if (this.requestLog != null) {
        this.requestLogHandler.setRequestLog(this.requestLog);
    }

    this.contexts = (ContextHandlerCollection) server.getChildHandlerByClass(ContextHandlerCollection.class);
    if (this.contexts == null) {
        this.contexts = new ContextHandlerCollection();
        this.handlers = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        if (this.handlers == null) {
            this.handlers = new HandlerCollection();
            this.server.setHandler(handlers);
            this.handlers.setHandlers(new Handler[]{this.contexts, this.defaultHandler, this.requestLogHandler});
        } else {
            this.handlers.addHandler(this.contexts);
        }
    }
}
 
Example #4
Source File: Jetty6PluginServer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Set up the handler structure to receive a webapp. Also put in a DefaultHandler so we get a nice page than a 404
 * if we hit the root and the webapp's context isn't at root.
 */
public void configureHandlers() throws Exception {
    this.defaultHandler = new DefaultHandler();
    this.requestLogHandler = new RequestLogHandler();
    if (this.requestLog != null) {
        this.requestLogHandler.setRequestLog(this.requestLog);
    }

    this.contexts = (ContextHandlerCollection) server.getChildHandlerByClass(ContextHandlerCollection.class);
    if (this.contexts == null) {
        this.contexts = new ContextHandlerCollection();
        this.handlers = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
        if (this.handlers == null) {
            this.handlers = new HandlerCollection();
            this.server.setHandler(handlers);
            this.handlers.setHandlers(new Handler[]{this.contexts, this.defaultHandler, this.requestLogHandler});
        } else {
            this.handlers.addHandler(this.contexts);
        }
    }
}
 
Example #5
Source File: EmbeddedServer.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8081 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/reporting" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    server.start();
    server.join();
}
 
Example #6
Source File: EmbeddedServer.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8081 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/reporting" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    server.start();
    server.join();
}
 
Example #7
Source File: EmbeddedServer.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8080 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/xdocreport-webapp" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    // JSP Servlet + Context
    Context jsp_ctx = new Context( servlet_contexts, "/jsp", Context.SESSIONS );
    jsp_ctx.addServlet( new ServletHolder( new org.apache.jasper.servlet.JspServlet() ), "*.jsp" );

    server.start();
    server.join();
}
 
Example #8
Source File: EmbeddedServer.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8081 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/reporting" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );

    server.start();
    server.join();
}