geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r159350 - in geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty: JettyWebAppContext.java interceptor/RequestWrapperBeforeAfter.java
Date Tue, 29 Mar 2005 05:13:35 GMT
Author: jgenender
Date: Mon Mar 28 21:13:35 2005
New Revision: 159350

URL: http://svn.apache.org/viewcvs?view=rev&rev=159350
Log:
Changes to the webcontext and new interceptor

Added:
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrapperBeforeAfter.java
Modified:
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java?view=diff&r1=159349&r2=159350
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
Mon Mar 28 21:13:35 2005
@@ -44,13 +44,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.jetty.interceptor.BeforeAfter;
-import org.apache.geronimo.jetty.interceptor.ComponentContextBeforeAfter;
-import org.apache.geronimo.jetty.interceptor.InstanceContextBeforeAfter;
-import org.apache.geronimo.jetty.interceptor.ThreadClassloaderBeforeAfter;
-import org.apache.geronimo.jetty.interceptor.TransactionContextBeforeAfter;
-import org.apache.geronimo.jetty.interceptor.WebApplicationContextBeforeAfter;
-import org.apache.geronimo.jetty.interceptor.SecurityContextBeforeAfter;
+import org.apache.geronimo.jetty.interceptor.*;
 import org.apache.geronimo.jetty.interceptor.RequestWrappingBeforeAfter;
 import org.apache.geronimo.transaction.context.OnlineUserTransaction;
 import org.apache.geronimo.transaction.TrackedConnectionAssociator;

Added: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrapperBeforeAfter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrapperBeforeAfter.java?view=auto&rev=159350
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrapperBeforeAfter.java
(added)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/interceptor/RequestWrapperBeforeAfter.java
Mon Mar 28 21:13:35 2005
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.jetty.interceptor;
+
+import org.mortbay.http.HttpRequest;
+import org.mortbay.http.HttpResponse;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHttpRequest;
+import org.mortbay.jetty.servlet.ServletHttpResponse;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class RequestWrapperBeforeAfter implements BeforeAfter {
+    private final BeforeAfter next;
+    private final ServletHandler handler;
+
+    public RequestWrapperBeforeAfter(BeforeAfter next, ServletHandler handler) {
+        this.next = next;
+        this.handler = handler;
+    }
+
+    public void before(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse)
{
+        if (httpRequest != null) {
+            ServletHttpRequest request = (ServletHttpRequest) httpRequest.getWrapper();
+            if (request == null) {
+                // Build the request and response.
+
+                String requestURI = httpRequest.getPath();
+                String contextPath = handler.getHttpContext().getContextPath();
+                String relativeURI = requestURI.substring(contextPath.length());
+                request = new ServletHttpRequest(handler, relativeURI, httpRequest);
+                ServletHttpResponse response = new ServletHttpResponse(request, httpResponse);
+                httpRequest.setWrapper(request);
+                httpResponse.setWrapper(response);
+            }
+        }
+
+        if (next != null) {
+            next.before(context, httpRequest, httpResponse);
+        }
+        
+    }
+
+    public void after(Object[] context, HttpRequest httpRequest, HttpResponse httpResponse)
{
+
+    }
+}



Mime
View raw message