001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019:
020: package org.apache.geronimo.jetty6.handler;
021:
022: import java.io.IOException;
023:
024: import javax.servlet.http.HttpServletRequest;
025: import javax.servlet.http.HttpServletResponse;
026: import javax.servlet.ServletException;
027:
028: import org.mortbay.jetty.Handler;
029: import org.mortbay.jetty.Server;
030: import org.mortbay.jetty.handler.ErrorHandler;
031: import org.mortbay.jetty.security.SecurityHandler;
032: import org.mortbay.jetty.servlet.ServletHandler;
033: import org.mortbay.jetty.servlet.SessionHandler;
034: import org.mortbay.jetty.webapp.WebAppContext;
035:
036: /**
037: * @version $Rev: 601149 $ $Date: 2007-12-04 15:30:18 -0800 (Tue, 04 Dec 2007) $
038: */
039: public class TwistyWebAppContext extends WebAppContext {
040:
041: private Handler handler;
042:
043: public TwistyWebAppContext(SecurityHandler securityHandler,
044: SessionHandler sessionHandler,
045: ServletHandler servletHandler, ErrorHandler errorHandler) {
046: super (securityHandler, sessionHandler, servletHandler,
047: errorHandler);
048: }
049:
050: public void setTwistyHandler(Handler handler) {
051: this .handler = handler;
052: }
053:
054: public Handler newTwistyHandler() {
055: return new TwistyHandler();
056: }
057:
058: @Override
059: public void handle(String target, HttpServletRequest request,
060: HttpServletResponse response, int dispatch)
061: throws IOException, ServletException {
062: handler.handle(target, request, response, dispatch);
063: }
064:
065: private class TwistyHandler implements Handler {
066:
067: public void handle(String target, HttpServletRequest request,
068: HttpServletResponse response, int dispatch)
069: throws IOException, ServletException {
070: TwistyWebAppContext.super .handle(target, request, response,
071: dispatch);
072: }
073:
074: public void setServer(Server server) {
075: TwistyWebAppContext.super .setServer(server);
076: }
077:
078: public Server getServer() {
079: return TwistyWebAppContext.super .getServer();
080: }
081:
082: public void destroy() {
083: TwistyWebAppContext.super .destroy();
084: }
085:
086: public void start() throws Exception {
087: TwistyWebAppContext.super .start();
088: }
089:
090: public void stop() throws Exception {
091: TwistyWebAppContext.super .stop();
092: }
093:
094: public boolean isRunning() {
095: return TwistyWebAppContext.super .isRunning();
096: }
097:
098: public boolean isStarted() {
099: return TwistyWebAppContext.super .isStarted();
100: }
101:
102: public boolean isStarting() {
103: return TwistyWebAppContext.super .isStarting();
104: }
105:
106: public boolean isStopping() {
107: return TwistyWebAppContext.super .isStopping();
108: }
109:
110: public boolean isStopped() {
111: return TwistyWebAppContext.super .isStopped();
112: }
113:
114: public boolean isFailed() {
115: return TwistyWebAppContext.super.isFailed();
116: }
117: }
118: }
|