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 021 package org.apache.geronimo.jetty6.handler; 022 023 import java.io.IOException; 024 025 import javax.servlet.http.HttpServletRequest; 026 import javax.servlet.http.HttpServletResponse; 027 import javax.servlet.ServletException; 028 029 import org.mortbay.jetty.Handler; 030 import org.mortbay.jetty.Server; 031 import org.mortbay.jetty.handler.ErrorHandler; 032 import org.mortbay.jetty.security.SecurityHandler; 033 import org.mortbay.jetty.servlet.ServletHandler; 034 import org.mortbay.jetty.servlet.SessionHandler; 035 import org.mortbay.jetty.webapp.WebAppContext; 036 037 /** 038 * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $ 039 */ 040 public class TwistyWebAppContext extends WebAppContext { 041 042 private Handler handler; 043 044 045 public TwistyWebAppContext(SecurityHandler securityHandler, SessionHandler sessionHandler, ServletHandler servletHandler, ErrorHandler errorHandler) { 046 super(securityHandler, sessionHandler, servletHandler, errorHandler); 047 } 048 049 public void setTwistyHandler(Handler handler) { 050 this.handler = handler; 051 } 052 053 public Handler newTwistyHandler() { 054 return new TwistyHandler(); 055 } 056 057 @Override 058 public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException { 059 handler.handle(target, request, response, dispatch); 060 } 061 062 private class TwistyHandler implements Handler { 063 064 public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException { 065 TwistyWebAppContext.super.handle(target, request, response, dispatch); 066 } 067 068 public void setServer(Server server) { 069 TwistyWebAppContext.super.setServer(server); 070 } 071 072 public Server getServer() { 073 return TwistyWebAppContext.super.getServer(); 074 } 075 076 public void destroy() { 077 TwistyWebAppContext.super.destroy(); 078 } 079 080 public void start() throws Exception { 081 TwistyWebAppContext.super.start(); 082 } 083 084 public void stop() throws Exception { 085 TwistyWebAppContext.super.stop(); 086 } 087 088 public boolean isRunning() { 089 return TwistyWebAppContext.super.isRunning(); 090 } 091 092 public boolean isStarted() { 093 return TwistyWebAppContext.super.isStarted(); 094 } 095 096 public boolean isStarting() { 097 return TwistyWebAppContext.super.isStarting(); 098 } 099 100 public boolean isStopping() { 101 return TwistyWebAppContext.super.isStopping(); 102 } 103 104 public boolean isStopped() { 105 return TwistyWebAppContext.super.isStopped(); 106 } 107 108 public boolean isFailed() { 109 return TwistyWebAppContext.super.isFailed(); 110 } 111 } 112 }