cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jheym...@apache.org
Subject svn commit: r330548 [43/132] - in /cocoon/whiteboard/maven2/cocoon-flat-layout: ./ cocoon-ajax-block/ cocoon-ajax-block/api/ cocoon-ajax-block/api/src/ cocoon-ajax-block/api/src/main/ cocoon-ajax-block/api/src/main/java/ cocoon-ajax-block/api/src/main/...
Date Thu, 03 Nov 2005 14:00:48 GMT
Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpResponse.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpResponse.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpResponse.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpResponse.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,210 @@
+/*
+ * Copyright 1999-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.cocoon.environment.http;
+
+import org.apache.cocoon.environment.Cookie;
+import org.apache.cocoon.environment.Response;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Locale;
+
+/**
+ * Implements the {@link org.apache.cocoon.environment.Response} interface
+ * to provide response functionality in the HTTP servlets environment.
+ * 
+ * @author <a href="mailto:dev@cocoon.apache.org">Apache Cocoon Team</a>
+ * @version CVS $Id: HttpResponse.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+
+public final class HttpResponse implements Response {
+
+    /** The real HttpServletResponse object */
+    private final HttpServletResponse res;
+
+    /**
+     * Creates a HttpServletResponse based on a real HttpServletResponse object
+     */
+    protected HttpResponse (HttpServletResponse res) {
+        this.res = res;
+    }
+
+    /**
+     * Create a new cookie which is not added to the response
+     */
+    public Cookie createCookie(String name, String value) {
+        return new HttpCookie(name, value);
+    }
+
+    public void addCookie(Cookie cookie) {
+        if (cookie instanceof HttpCookie) {
+            this.res.addCookie(((HttpCookie)cookie).getServletCookie());
+        } else {
+            javax.servlet.http.Cookie newCookie;
+            newCookie = new javax.servlet.http.Cookie(cookie.getName(), cookie.getValue());
+            newCookie.setComment(cookie.getComment());
+            newCookie.setDomain(cookie.getDomain());
+            newCookie.setMaxAge(cookie.getMaxAge());
+            newCookie.setPath(cookie.getPath());
+            newCookie.setSecure(cookie.getSecure());
+            newCookie.setVersion(cookie.getVersion());
+            this.res.addCookie(newCookie);
+        }
+    }
+
+    public boolean containsHeader(String name) {
+        return this.res.containsHeader(name);
+    }
+
+    public String encodeURL(String url) {
+        if (url != null && url.indexOf(";jsessionid=") != -1)
+            return url;
+        return this.res.encodeURL(url);
+    }
+
+    public String encodeRedirectURL(String url) {
+        if (url != null && url.indexOf(";jsessionid=") != -1) {
+            return url;
+        }
+
+        return this.res.encodeRedirectURL(url);
+    }
+
+    public void sendError(int sc, String msg) throws IOException {
+        this.res.sendError(sc, msg);
+    }
+
+    public void sendError(int sc) throws IOException {
+        this.res.sendError(sc);
+    }
+
+    public void sendRedirect(String location) throws IOException {
+        this.res.sendRedirect(location);
+    }
+
+    public void sendPermanentRedirect(String location) throws IOException {
+        this.res.setHeader("location", location);
+        this.res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
+    }
+    
+    public void setDateHeader(String name, long date) {
+        this.res.setDateHeader(name, date);
+    }
+
+    public void addDateHeader(String name, long date) {
+        this.res.addDateHeader(name, date);
+    }
+
+    public void setHeader(String name, String value) {
+        this.res.setHeader(name, value);
+    }
+
+    public void addHeader(String name, String value) {
+        this.res.addHeader(name, value);
+    }
+
+    public void setIntHeader(String name, int value) {
+        this.res.setIntHeader(name, value);
+    }
+
+    public void addIntHeader(String name, int value) {
+        this.res.addIntHeader(name, value);
+    }
+
+    public void setStatus(int sc) {
+        this.res.setStatus(sc);
+    }
+
+    /**
+     * @deprecated        As of version 2.1, use encodeURL(String url) instead
+     */
+    public String encodeUrl(String url) {
+        return this.res.encodeUrl(url);
+    }
+
+    /**
+     * @deprecated        As of version 2.1, use
+     *              encodeRedirectURL(String url) instead
+     */
+    public String encodeRedirectUrl(String url) {
+        return this.res.encodeRedirectUrl(url);
+    }
+
+    /**
+     * @deprecated As of version 2.1, due to ambiguous meaning of the
+     * message parameter. To set a status code
+     * use <code>setStatus(int)</code>, to send an error with a description
+     * use <code>sendError(int, String)</code>.
+     */
+    public void setStatus(int sc, String sm) {
+        this.res.setStatus(sc, sm);
+    }
+
+    /* The ServletResponse interface methods */
+
+    public String getCharacterEncoding() {
+        return this.res.getCharacterEncoding();
+    }
+
+    public ServletOutputStream getOutputStream() throws IOException {
+        //throw new IllegalStateException ("you are not a serializer or reader");
+        return this.res.getOutputStream();
+    }
+
+    public PrintWriter getWriter() throws IOException {
+        //throw new IllegalStateException ("you are not a serializer or reader");
+        return this.res.getWriter();
+    }
+
+    public void setContentLength(int len) {
+        this.res.setContentLength(len);
+    }
+
+    public void setContentType(String type) {
+        this.res.setContentType(type);
+    }
+
+    public void setBufferSize(int size) {
+        this.res.setBufferSize(size);
+    }
+
+    public int getBufferSize() {
+        return this.res.getBufferSize();
+    }
+
+    public void flushBuffer() throws IOException {
+        this.res.flushBuffer();
+    }
+
+    public boolean isCommitted() {
+        return this.res.isCommitted();
+    }
+
+    public void reset() {
+        this.res.reset();
+    }
+
+    public void setLocale(Locale loc) {
+        this.res.setLocale(loc);
+    }
+
+    public Locale getLocale() {
+        return this.res.getLocale();
+    }
+}
+

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpSession.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpSession.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpSession.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpSession.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,263 @@
+/*
+ * Copyright 1999-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.cocoon.environment.http;
+
+import org.apache.cocoon.environment.impl.AbstractSession;
+
+import java.util.Enumeration;
+
+/**
+ *
+ * Provides a way to identify a user across more than one page
+ * request or visit to a Web site and to store information about that user.
+ *
+ * <p>Cocoon uses this interface to create a session
+ * between a client and the "cocoon server". The session persists
+ * for a specified time period, across more than one connection or
+ * page request from the user. A session usually corresponds to one
+ * user, who may visit a site many times. The server can maintain a
+ * session in many ways such as using cookies or rewriting URLs.
+ *
+ * <p>This interface allows Cocoon to
+ * <ul>
+ * <li>View and manipulate information about a session, such as
+ *     the session identifier, creation time, and last accessed time
+ * <li>Bind objects to sessions, allowing user information to persist
+ *     across multiple user connections
+ * </ul>
+ *
+ * <p>Session information is scoped only to the current context
+ * (<code>Context</code>), so information stored in one context
+ * will not be directly visible in another.
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version CVS $Id: HttpSession.java 170436 2005-05-16 19:50:25Z danielf $
+ *
+ */
+
+public final class HttpSession
+extends AbstractSession {
+
+    javax.servlet.http.HttpSession wrappedSession;
+
+    /**
+     * Construct a new session from an HttpSession
+     */
+    public HttpSession(javax.servlet.http.HttpSession session) {
+        this.wrappedSession = session;
+    }
+
+    /**
+     *
+     * Returns the time when this session was created, measured
+     * in milliseconds since midnight January 1, 1970 GMT.
+     *
+     * @return                                a <code>long</code> specifying
+     *                                         when this session was created,
+     *                                        expressed in
+     *                                        milliseconds since 1/1/1970 GMT
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        invalidated session
+     *
+     */
+    public long getCreationTime() {
+        return this.wrappedSession.getCreationTime();
+    }
+
+    /**
+     *
+     * Returns a string containing the unique identifier assigned
+     * to this session. The identifier is assigned
+     * by the context container and is implementation dependent.
+     *
+     * @return                                a string specifying the identifier
+     *                                        assigned to this session
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        invalidated session
+     *
+     */
+    public String getId() {
+        return this.wrappedSession.getId();
+    }
+
+    /**
+     *
+     * Returns the last time the client sent a request associated with
+     * this session, as the number of milliseconds since midnight
+     * January 1, 1970 GMT.
+     *
+     * <p>Actions that your application takes, such as getting or setting
+     * a value associated with the session, do not affect the access
+     * time.
+     *
+     * @return                                a <code>long</code>
+     *                                        representing the last time
+     *                                        the client sent a request associated
+     *                                        with this session, expressed in
+     *                                        milliseconds since 1/1/1970 GMT
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        invalidated session
+     *
+     */
+
+    public long getLastAccessedTime() {
+        return this.wrappedSession.getLastAccessedTime();
+    }
+
+    /**
+     *
+     * Specifies the time, in seconds, between client requests before the
+     * contextcontainer will invalidate this session.  A negative time
+     * indicates the session should never timeout.
+     *
+     * @param interval                An integer specifying the number
+     *                                 of seconds
+     *
+     */
+    public void setMaxInactiveInterval(int interval) {
+        this.wrappedSession.setMaxInactiveInterval(interval);
+    }
+
+   /**
+    * Returns the maximum time interval, in seconds, that
+    * the context container will keep this session open between
+    * client accesses. After this interval, the context container
+    * will invalidate the session.  The maximum time interval can be set
+    * with the <code>setMaxInactiveInterval</code> method.
+    * A negative time indicates the session should never timeout.
+    *
+    *
+    * @return                an integer specifying the number of
+    *                        seconds this session remains open
+    *                        between client requests
+    *
+    * @see                #setMaxInactiveInterval(int)
+    *
+    *
+    */
+    public int getMaxInactiveInterval() {
+        return this.wrappedSession.getMaxInactiveInterval();
+    }
+
+    /**
+     *
+     * Returns the object bound with the specified name in this session, or
+     * <code>null</code> if no object is bound under the name.
+     *
+     * @param name                a string specifying the name of the object
+     *
+     * @return                        the object with the specified name
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        invalidated session
+     *
+     */
+    public Object getAttribute(String name) {
+        return this.wrappedSession.getAttribute(name);
+    }
+
+    /**
+     *
+     * Returns an <code>Enumeration</code> of <code>String</code> objects
+     * containing the names of all the objects bound to this session.
+     *
+     * @return                        an <code>Enumeration</code> of
+     *                                <code>String</code> objects specifying the
+     *                                names of all the objects bound to
+     *                                this session
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        invalidated session
+     *
+     */
+    public Enumeration getAttributeNames() {
+        return this.wrappedSession.getAttributeNames();
+    }
+
+    /**
+     * Binds an object to this session, using the name specified.
+     * If an object of the same name is already bound to the session,
+     * the object is replaced.
+     *
+     *
+     * @param name                        the name to which the object is bound;
+     *                                        cannot be null
+     *
+     * @param value                        the object to be bound; cannot be null
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        invalidated session
+     *
+     */
+    public void setAttribute(String name, Object value) {
+        this.wrappedSession.setAttribute(name, value);
+    }
+
+    /**
+     *
+     * Removes the object bound with the specified name from
+     * this session. If the session does not have an object
+     * bound with the specified name, this method does nothing.
+     *
+     *
+     * @param name                                the name of the object to
+     *                                                remove from this session
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        invalidated session
+     */
+    public void removeAttribute(String name) {
+        this.wrappedSession.removeAttribute(name);
+    }
+
+    /**
+     *
+     * Invalidates this session
+     * to it.
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        already invalidated session
+     *
+     */
+    public void invalidate() {
+        this.wrappedSession.invalidate();
+    }
+
+    /**
+     *
+     * Returns <code>true</code> if the client does not yet know about the
+     * session or if the client chooses not to join the session.  For
+     * example, if the server used only cookie-based sessions, and
+     * the client had disabled the use of cookies, then a session would
+     * be new on each request.
+     *
+     * @return                                 <code>true</code> if the
+     *                                        server has created a session,
+     *                                        but the client has not yet joined
+     *
+     * @exception IllegalStateException        if this method is called on an
+     *                                        already invalidated session
+     *
+     */
+    public boolean isNew() {
+        return this.wrappedSession.isNew();
+    }
+
+}
+

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/HttpSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/RequestEncodingException.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/RequestEncodingException.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/RequestEncodingException.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/RequestEncodingException.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 1999-2005 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.cocoon.environment.http;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+
+public final class RequestEncodingException extends CascadingRuntimeException
+{
+    public RequestEncodingException(String message)
+    {
+        super(message, null);
+    }
+
+    public RequestEncodingException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/http/RequestEncodingException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import java.util.Map;
+
+import org.apache.cocoon.environment.Context;
+
+/**
+ * Base class for any context
+ *
+ * @version $Id: AbstractContext.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public abstract class AbstractContext 
+    implements Context {
+
+    public Map getAttributes() {
+	return new ContextMap(this);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractRequest.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractRequest.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractRequest.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractRequest.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import java.util.Map;
+
+import org.apache.cocoon.environment.Request;
+
+/**
+ * Base class for any request
+ *
+ * @version $Id: AbstractRequest.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public abstract class AbstractRequest 
+    implements Request {
+
+    public Map getAttributes() {
+	return new RequestMap(this);
+    }
+
+    public Map getParameters() {
+	return new RequestParameterMap(this);
+    }
+
+    public Map getHeaders() {
+	return new RequestHeaderMap(this);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractSession.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractSession.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractSession.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractSession.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import java.util.Map;
+
+import org.apache.cocoon.environment.Session;
+
+/**
+ * Base class for any session
+ *
+ * @version $Id: AbstractSession.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public abstract class AbstractSession 
+    implements Session {
+
+    public Map getAttributes() {
+	return new SessionMap(this);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/AbstractSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/BaseMap.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/BaseMap.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/BaseMap.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/BaseMap.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Base class for context maps
+ *
+ * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @version $Id: BaseMap.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public abstract class BaseMap extends java.util.AbstractMap {
+
+    protected static class Entry implements Map.Entry {
+        private final Object key;
+        private final Object value;
+
+        public Entry(Object key, Object value) {
+            this.key = key;
+            this.value = value;
+        }
+
+        public Object getKey() {
+            return key;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object setValue(Object value) {
+            throw new UnsupportedOperationException();
+        }
+
+        public int hashCode() {
+            return (key != null ? key.hashCode() : 0) ^ (value != null ? value.hashCode() : 0);
+        }
+
+        public boolean equals(Object obj) {
+            if (obj == null || !(obj instanceof Map.Entry)) {
+                return false;
+            }
+
+            Map.Entry other = (Map.Entry) obj;
+            Object key = other.getKey();
+            if (key == this.key || key != null && key.equals(this.key)) {
+                Object value = other.getValue();
+                return value == this.value || value != null && value.equals(this.value);
+            }
+            return false;
+        }
+    }
+
+
+    public BaseMap() {
+    }
+
+    public void clear() {
+        throw new UnsupportedOperationException();
+    }
+
+    public void putAll(Map t) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Object remove(Object key) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Set entrySet() {
+        throw new UnsupportedOperationException();
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/BaseMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/ContextMap.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/ContextMap.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/ContextMap.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/ContextMap.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,73 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import org.apache.cocoon.environment.Context;
+
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Context attributes map
+ *
+ * @version $Id: ContextMap.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public class ContextMap extends BaseMap {
+
+    private Context context;
+
+
+    public ContextMap(Context context) {
+        this.context = context;
+    }
+
+    public Object get(Object key) {
+        return context.getAttribute(key.toString());
+    }
+
+    public Object put(Object key, Object value) {
+        String sKey = key.toString();
+        Object old = context.getAttribute(sKey);
+        context.setAttribute(sKey, value);
+        return old;
+    }
+
+    public Object remove(Object key) {
+        String sKey = key.toString();
+        Object old = context.getAttribute(sKey);
+        context.removeAttribute(sKey);
+        return old;
+    }
+
+    public Set entrySet() {
+        Set entries = new HashSet();
+        for (Enumeration e = context.getAttributeNames(); e.hasMoreElements();) {
+            String name = (String) e.nextElement();
+            entries.add(new BaseMap.Entry(name, context.getAttribute(name)));
+        }
+
+        return entries;
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof ContextMap)) {
+            return false;
+        }
+
+        return super.equals(obj);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/ContextMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestHeaderMap.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestHeaderMap.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestHeaderMap.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestHeaderMap.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import org.apache.cocoon.environment.Request;
+
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Request headers map
+ *
+ * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @version $Id: RequestHeaderMap.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public class RequestHeaderMap extends BaseMap {
+
+    private Request request;
+
+
+    public RequestHeaderMap(Request request) {
+        this.request = request;
+    }
+
+    public Object get(Object key) {
+        return request.getHeader(key.toString());
+    }
+
+    public Set entrySet() {
+        Set entries = new HashSet();
+        for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) {
+            String name = (String) e.nextElement();
+            entries.add(new BaseMap.Entry(name, request.getHeader(name)));
+        }
+
+        return entries;
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof RequestHeaderMap)) {
+            return false;
+        }
+
+        return super.equals(obj);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestHeaderMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestMap.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestMap.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestMap.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestMap.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import org.apache.cocoon.environment.Request;
+
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Request attributes map
+ *
+ * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @version $Id: RequestMap.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public class RequestMap extends BaseMap {
+
+    private Request request;
+
+
+    public RequestMap(Request request) {
+        this.request = request;
+    }
+
+    public Object get(Object key) {
+        return request.getAttribute(key.toString());
+    }
+
+    public Object put(Object key, Object value) {
+        String sKey = key.toString();
+        Object old = request.getAttribute(sKey);
+        request.setAttribute(sKey, value);
+        return old;
+    }
+
+    public Object remove(Object key) {
+        String sKey = key.toString();
+        Object old = request.getAttribute(sKey);
+        request.removeAttribute(sKey);
+        return old;
+    }
+
+    public Set entrySet() {
+        Set entries = new HashSet();
+        for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();) {
+            String name = (String) e.nextElement();
+            entries.add(new BaseMap.Entry(name, request.getAttribute(name)));
+        }
+
+        return entries;
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof RequestMap)) {
+            return false;
+        }
+
+        return super.equals(obj);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestParameterMap.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestParameterMap.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestParameterMap.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestParameterMap.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,60 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import org.apache.cocoon.environment.Request;
+
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Request parameters map
+ *
+ * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @version $Id: RequestParameterMap.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public class RequestParameterMap extends BaseMap {
+
+    private Request request;
+
+
+    public RequestParameterMap(Request request) {
+        this.request = request;
+    }
+
+    public Object get(Object key) {
+        return request.getParameter(key.toString());
+    }
+
+    public Set entrySet() {
+        Set entries = new HashSet();
+        for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
+            String name = (String) e.nextElement();
+            entries.add(new BaseMap.Entry(name, request.getParameter(name)));
+        }
+
+        return entries;
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof RequestParameterMap)) {
+            return false;
+        }
+
+        return super.equals(obj);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/RequestParameterMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/SessionMap.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/SessionMap.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/SessionMap.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/SessionMap.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 1999-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.cocoon.environment.impl;
+
+import org.apache.cocoon.environment.Session;
+
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Session attributes map
+ *
+ * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @version $Id: SessionMap.java 170436 2005-05-16 19:50:25Z danielf $
+ */
+public class SessionMap extends BaseMap {
+
+    private Session session;
+
+
+    public SessionMap(Session session) {
+        this.session = session;
+    }
+
+    public Object get(Object key) {
+        return session.getAttribute(key.toString());
+    }
+
+    public Object put(Object key, Object value) {
+        String sKey = key.toString();
+        Object old = session.getAttribute(sKey);
+        session.setAttribute(sKey, value);
+        return old;
+    }
+
+    public Object remove(Object key) {
+        String sKey = key.toString();
+        Object old = session.getAttribute(sKey);
+        session.removeAttribute(sKey);
+        return old;
+    }
+
+    public Set entrySet() {
+        Set entries = new HashSet();
+        for (Enumeration e = session.getAttributeNames(); e.hasMoreElements();) {
+            String name = (String) e.nextElement();
+            entries.add(new BaseMap.Entry(name, session.getAttribute(name)));
+        }
+
+        return entries;
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof SessionMap)) {
+            return false;
+        }
+
+        return super.equals(obj);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/impl/SessionMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/BlockEnvironmentHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/BlockEnvironmentHelper.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/BlockEnvironmentHelper.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/BlockEnvironmentHelper.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1999-2005 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.cocoon.environment.internal;
+
+import java.net.URL;
+
+import org.apache.cocoon.components.blocks.Block;
+
+/**
+ * Hack used for geting hold on the current block manager without
+ * making core code dependent of the experimental blocks code.
+ *
+ * @version $Id: BlockEnvironmentHelper.java 312659 2005-10-10 14:11:48Z cziegeler $
+ * @since 2.2 
+ */
+public class BlockEnvironmentHelper
+    extends EnvironmentHelper {
+
+    // Hack for getting it to compile
+    private BlockEnvironmentHelper(URL context) {
+        super(context);
+    }
+
+    public static Block getCurrentBlock() {
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        if ( stack != null && !stack.isEmpty()) {
+            for (int i = stack.getOffset(); i >= 0; i--) {
+                final EnvironmentInfo info = (EnvironmentInfo)stack.get(i);
+                if (info.processor instanceof Block) {
+                    return (Block)info.processor;
+                }
+            }
+        }
+        return null;
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/BlockEnvironmentHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,461 @@
+/*
+ * Copyright 1999-2005 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.cocoon.environment.internal;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.Processor;
+import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.xml.XMLConsumer;
+import org.apache.excalibur.source.Source;
+
+/**
+ * Helper class for maintaining the environment stack.
+ *
+ * This is an internal class, and it might change in an incompatible way over time.
+ * For developing your own components/applications based on Cocoon, you shouldn't
+ * really need it.
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version $Id: EnvironmentHelper.java 312659 2005-10-10 14:11:48Z cziegeler $
+ * @since 2.2
+ */
+public class EnvironmentHelper
+extends AbstractLogEnabled
+implements SourceResolver, Serviceable, Disposable {
+
+    /** The environment information */
+    static protected final ThreadLocal environmentStack = new ThreadLocal();
+
+    /** The real source resolver */
+    protected org.apache.excalibur.source.SourceResolver resolver;
+
+    /** The service manager */
+    protected ServiceManager manager;
+
+    /** The complete prefix */
+    protected String prefix;
+
+     /** The Context path */
+    protected String context;
+
+    /** The last prefix, which is stripped off from the request uri */
+    protected String lastPrefix;
+
+    /**
+     * Constructor
+     *
+     */
+    public EnvironmentHelper(URL context) {
+        if ( context != null ) {
+            this.context = context.toExternalForm();
+        }
+    }
+
+    /**
+     * Constructor
+     *
+     */
+    public EnvironmentHelper(EnvironmentHelper parent) {
+        this.context = parent.context;
+        this.lastPrefix = parent.lastPrefix;
+        this.prefix = parent.prefix;
+    }
+
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+        this.resolver = (org.apache.excalibur.source.SourceResolver)
+                          this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
+        Source source = null;
+        try {
+            source = this.resolver.resolveURI(this.context);
+            this.context = source.getURI();
+
+        } catch (IOException ioe) {
+            throw new ServiceException("EnvironmentHelper", "Unable to resolve environment context. ", ioe);
+        } finally {
+            this.resolver.release(source);
+        }
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release( this.resolver );
+            this.resolver = null;
+            this.manager = null;
+        }
+    }
+
+    /**
+     * @see org.apache.excalibur.source.SourceResolver#release(org.apache.excalibur.source.Source)
+     */
+    public void release(Source source) {
+        this.resolver.release(source);
+    }
+
+    /**
+     * @see org.apache.excalibur.source.SourceResolver#resolveURI(java.lang.String, java.lang.String, java.util.Map)
+     */
+    public Source resolveURI(final String location,
+                             String baseURI,
+                             final Map    parameters)
+    throws MalformedURLException, IOException {
+        return this.resolver.resolveURI(location,
+                                        (baseURI == null ? this.context : baseURI),
+                                        parameters);
+    }
+
+    /**
+     * @see org.apache.excalibur.source.SourceResolver#resolveURI(java.lang.String)
+     */
+    public Source resolveURI(final String location)
+    throws MalformedURLException, IOException {
+        return this.resolveURI(location, null, null);
+    }
+
+    /**
+     * Return the current context URI
+     */
+    public String getContext() {
+        return this.context;
+    }
+
+    /**
+     * Return the prefix
+     */
+    public String getPrefix() {
+        return this.prefix;
+    }
+
+    /**
+     * Change the context of the environment.
+     * @param env The environment to change
+     * @throws ProcessingException
+     */
+    public void changeContext(Environment env)
+    throws ProcessingException {
+        if ( this.lastPrefix != null ) {
+            final String uris = env.getURI();
+            if (!uris.startsWith(this.lastPrefix)) {
+                final String message = "The current URI (" + uris +
+                                 ") doesn't start with given prefix (" + this.lastPrefix + ")";
+                throw new ProcessingException(message);
+            }
+            // we don't need to check for slash at the beginning
+            // of uris - the prefix always ends with a slash!
+            final int l = this.lastPrefix.length();
+            env.setURI(this.prefix, uris.substring(l));
+        }
+    }
+
+    /**
+     * Adds an prefix to the overall stripped off prefix from the request uri
+     */
+    public void changeContext(Source newSource, String newPrefix)
+    throws IOException {
+        final String newContext = newSource.getURI();
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Changing Cocoon context");
+            getLogger().debug("  from context(" + this.context + ") and prefix(" + this.prefix + ")");
+            getLogger().debug("  to context(" + newContext + ") and prefix(" + newPrefix + ")");
+        }
+        int l = newPrefix.length();
+        if (l >= 1) {
+            this.lastPrefix = newPrefix;
+            if ( this.prefix == null ) {
+                this.prefix = "";
+            }
+            final StringBuffer buffer = new StringBuffer(this.prefix);
+            buffer.append(newPrefix);
+            // check for a slash at the beginning to avoid problems with subsitemaps
+            if ( buffer.charAt(buffer.length()-1) != '/') {
+                buffer.append('/');
+                this.lastPrefix = this.lastPrefix + '/';
+            }
+            this.prefix = buffer.toString();
+        } else {
+            this.lastPrefix = null;
+        }
+
+        if (SourceUtil.getScheme(this.context).equals("zip")) {
+            // if the resource is zipped into a war file (e.g. Weblogic temp deployment)
+            // FIXME (VG): Is this still required? Better to unify both cases.
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Base context is zip: " + this.context);
+            }
+
+            org.apache.excalibur.source.Source source = null;
+            try {
+                source = this.resolver.resolveURI(this.context + newContext);
+                this.context = source.getURI();
+            } finally {
+                this.resolver.release(source);
+            }
+        } else {
+            String sContext;
+            // if we got a absolute context or one with a protocol resolve it
+            if (newContext.charAt(0) == '/') {
+                // context starts with the '/' - absolute file URL
+                sContext = "file:" + newContext;
+            } else if (newContext.indexOf(':') > 1) {
+                // context have ':' - absolute URL
+                sContext = newContext;
+            } else {
+                // context is relative to old one
+                sContext = this.context + '/' + newContext;
+            }
+
+            // Cut the file name part from context (if present)
+            int i = sContext.lastIndexOf('/');
+            if (i != -1 && i + 1 < sContext.length()) {
+                sContext = sContext.substring(0, i + 1);
+            }
+
+            Source source = null;
+            try {
+                source = this.resolver.resolveURI(sContext);
+                this.context = source.getURI();
+            } finally {
+                this.resolver.release(source);
+            }
+        }
+
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("New context is " + this.context);
+        }
+    }
+
+    /**
+     * This hook must be called by the sitemap each time a sitemap is entered.
+     *
+     * <p>This method should never raise an exception, except when the
+     * parameters are not set!</p>
+     *
+     * @throws ProcessingException if processor is null
+     */
+    public static void enterProcessor(Processor processor,
+                                      ServiceManager manager,
+                                      Environment env)
+    throws ProcessingException {
+        if (null == processor) {
+            throw new ProcessingException("Processor is not set.");
+        }
+
+        EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        if (stack == null) {
+            stack = new EnvironmentStack();
+            environmentStack.set(stack);
+        }
+        stack.pushInfo(new EnvironmentInfo(processor, stack.getOffset(), manager, env));
+        stack.setOffset(stack.size() - 1);
+    }
+
+    /**
+     * This hook must be called by the sitemap each time a sitemap is left.
+     *
+     * <p>It's the counterpart to the {@link #enterProcessor(Processor, ServiceManager, Environment)}
+     * method.</p>
+     */
+    public static void leaveProcessor() {
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        final EnvironmentInfo info = (EnvironmentInfo)stack.pop();
+        stack.setOffset(info.oldStackCount);
+    }
+
+    /**
+     * This method is used for entering a new environment.
+     *
+     * @throws ProcessingException if there is no current processing environment
+     */
+    public static void enterEnvironment(Environment env)
+    throws ProcessingException {
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        EnvironmentInfo info = null;
+        if ( stack != null && !stack.isEmpty()) {
+            info = stack.getCurrentInfo();
+        } else {
+            throw new ProcessingException("There must be a current processing environment.");
+        }
+
+        stack.pushInfo(new EnvironmentInfo(info.processor, stack.getOffset(), info.manager, env));
+        stack.setOffset(stack.size() - 1);
+    }
+
+    /**
+     * This method is used for leaving the current environment.
+     * 
+     * <p>It's the counterpart to the {@link #enterEnvironment(Environment)} method.</p>
+     */
+    public static Environment leaveEnvironment() {
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        final EnvironmentInfo info = (EnvironmentInfo)stack.pop();
+        stack.setOffset(info.oldStackCount);
+
+        return info.environment;
+    }
+
+    /**
+     * INTERNAL METHOD. Do not use, can be removed without warning or deprecation cycle.
+     */
+    public static int markEnvironment() {
+        // TODO (CZ): This is only for testing - remove it later on. See also Cocoon.java.
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        if (stack != null) {
+            return stack.size();
+        }
+
+        return 0;
+    }
+
+    /**
+     * INTERNAL METHOD. Do not use, can be removed without warning or deprecation cycle.
+     */
+    public static void checkEnvironment(int depth, Logger logger)
+    throws Exception {
+        // TODO (CZ): This is only for testing - remove it later on. See also Cocoon.java.
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        int currentDepth = stack != null? stack.size() : 0;
+        if (currentDepth != depth) {
+            logger.error("ENVIRONMENT STACK HAS NOT BEEN CLEANED PROPERLY!");
+            throw new ProcessingException("Environment stack has not been cleaned up properly. " +
+                                          "Please report this (and if possible, together with a test case) " +
+                                          "to the Cocoon developers.");
+        }
+    }
+
+    /**
+     * Return the environment
+     */
+    public static Environment getCurrentEnvironment() {
+        final EnvironmentStack stack = (EnvironmentStack) environmentStack.get();
+        if ( stack != null && !stack.empty() ) {
+            final EnvironmentInfo info = stack.getCurrentInfo();
+            return info.environment;
+        }
+        return null;
+    }
+
+    /**
+     * Return the current processor
+     */
+    public static Processor getCurrentProcessor() {
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        if ( stack != null && !stack.isEmpty()) {
+            final EnvironmentInfo info = stack.getCurrentInfo();
+            return info.processor;
+        }
+        return null;
+    }
+
+    /**
+     * Get the current sitemap component manager.
+     * This method return the current sitemap component manager. This
+     * is the manager that holds all the components of the currently
+     * processed (sub)sitemap.
+     */
+    static public ServiceManager getSitemapServiceManager() {
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        if ( stack != null && !stack.isEmpty()) {
+            final EnvironmentInfo info = stack.getCurrentInfo();
+            return info.manager;
+        }
+        return null;
+    }
+
+    /**
+     * Create an environment aware xml consumer for the cocoon
+     * protocol
+     */
+    public static XMLConsumer createEnvironmentAwareConsumer(XMLConsumer consumer) {
+        final EnvironmentStack stack = (EnvironmentStack)environmentStack.get();
+        final EnvironmentInfo info = stack.getCurrentInfo();
+        return stack.getEnvironmentAwareConsumerWrapper(consumer, info.oldStackCount);
+    }
+
+    /**
+     * Create an environment aware xml consumer that push an
+     * environment before calling the consumer.
+     */
+    public static XMLConsumer createPushEnvironmentConsumer(XMLConsumer consumer, Environment environment) {
+        return new PushEnvironmentChanger(consumer, environment);
+    }
+
+    /**
+     * Create an environment aware xml consumer that pop and save the
+     * current environment before calling the consumer.
+     */
+    public static XMLConsumer createPopEnvironmentConsumer(XMLConsumer consumer) {
+        return new PopEnvironmentChanger(consumer);
+    }
+
+    /**
+     * A runnable wrapper that inherits the environment stack of the thread it is
+     * created in.
+     * <p>
+     * It's defined as an abstract class here to use some internals of EnvironmentHelper, and
+     * should only be used through its public counterpart, {@link org.apache.cocoon.environment.CocoonRunnable}
+     */
+    public static abstract class AbstractCocoonRunnable implements Runnable {
+        private Object parentStack = null;
+
+        public AbstractCocoonRunnable() {
+            // Clone the environment stack of the calling thread.
+            // We'll use it in run() below
+            Object stack = EnvironmentHelper.environmentStack.get();
+            if (stack != null) {
+                this.parentStack = ((EnvironmentStack)stack).clone();
+            }
+        }
+
+        /**
+         * Calls {@link #doRun()} within the environment context of the creating thread.
+         */
+        public final void run() {
+            // Install the stack from the parent thread and run the Runnable
+            Object oldStack = environmentStack.get();
+            EnvironmentHelper.environmentStack.set(this.parentStack);
+            try {
+                doRun();
+            } finally {
+                // Restore the previous stack
+                EnvironmentHelper.environmentStack.set(oldStack);
+            }
+            // FIXME: Check the lifetime of this run compared to the parent thread.
+            // A CocoonThread is meant to start and die within the execution period of the parent request,
+            // and it is an error if it lives longer as the parent environment is no more valid.
+        }
+
+        abstract protected void doRun();
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelperException.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelperException.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelperException.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelperException.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 1999-2005 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.cocoon.environment.internal;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+
+/**
+ * @version $Id$
+ * @since 2.2
+ */
+public class EnvironmentHelperException extends CascadingRuntimeException {
+
+    public EnvironmentHelperException(String message) {
+        super(message, null);
+    }
+
+    public EnvironmentHelperException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentHelperException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1999-2005 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.cocoon.environment.internal;
+
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.Processor;
+import org.apache.cocoon.environment.Environment;
+
+/**
+ * This object holds a set of objects for an environment.
+ *
+ * This is an internal class, and it might change in an incompatible way over time.
+ * For developing your own components/applications based on Cocoon, you shouldn't 
+ * really need it.
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version $Id: EnvironmentInfo.java 312659 2005-10-10 14:11:48Z cziegeler $
+ * @since 2.2
+ */
+public class EnvironmentInfo {
+
+    public final Processor      processor;
+    public final int            oldStackCount;
+    public final ServiceManager manager;
+    public final Environment    environment;
+
+    public EnvironmentInfo(Processor processor, 
+                           int oldStackCount,
+                           ServiceManager manager,
+                           Environment    environment) {
+        this.processor = processor;
+        this.oldStackCount = oldStackCount;
+        this.manager = manager;
+        this.environment = environment;
+    }
+}
+

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentStack.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentStack.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentStack.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentStack.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,227 @@
+/*
+ * Copyright 1999-2005 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.cocoon.environment.internal;
+
+import org.apache.cocoon.xml.XMLConsumer;
+import org.apache.commons.collections.ArrayStack;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+/**
+ * The stack for the processing environment.
+ *
+ * This is an internal class, and it might change in an incompatible way over time.
+ * For developing your own components/applications based on Cocoon, you shouldn't 
+ * really need it.
+ * This is a special implementation of a stack for the handling of the
+ * cocoon protocol and the sitemap source resolving.
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ * @version $Id: EnvironmentStack.java 312659 2005-10-10 14:11:48Z cziegeler $
+ * @since 2.2
+ */
+final class EnvironmentStack 
+    extends ArrayStack 
+    implements Cloneable {
+
+    int offset;
+
+    EnvironmentInfo getCurrentInfo() {
+        return (EnvironmentInfo)this.get(offset);
+    }
+
+    void pushInfo(EnvironmentInfo info) {
+        this.push(info);
+    }
+
+    EnvironmentInfo popInfo() {
+        return (EnvironmentInfo)this.pop();
+    }
+
+    EnvironmentInfo peekInfo() {
+        return (EnvironmentInfo)this.peek();
+    }
+
+    int getOffset() {
+        return this.offset;
+    }
+
+    void setOffset(int value) {
+        this.offset = value;  
+    }
+
+    public Object clone() {
+        EnvironmentStack old = (EnvironmentStack) super.clone();
+        old.offset = offset;
+        return old;
+    }
+
+    XMLConsumer getEnvironmentAwareConsumerWrapper(XMLConsumer consumer, 
+                                                   int oldOffset) {
+        return new EnvironmentChanger(consumer, this, oldOffset, this.offset);
+    }
+}
+
+/**
+ * This class is an {@link XMLConsumer} that changes the current environment.
+ * When a pipeline calls an internal pipeline, two environments are
+ * established: one for the calling pipeline and one for the internal pipeline.
+ * Now, if SAX events are send from the internal pipeline, they are
+ * received by some component of the calling pipeline, so inbetween we
+ * have to change the environment forth and back.
+ */
+final class EnvironmentChanger
+implements XMLConsumer {
+
+    final XMLConsumer consumer;
+    final EnvironmentStack stack;
+    final int oldOffset;
+    final int newOffset;
+
+    EnvironmentChanger(XMLConsumer consumer, EnvironmentStack es,
+                       int oldOffset, int newOffset) {
+        this.consumer = consumer;
+        this.stack = es;
+        this.oldOffset = oldOffset;
+        this.newOffset = newOffset;
+    }
+
+    public void setDocumentLocator(Locator locator) {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.setDocumentLocator(locator);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void startDocument()
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.startDocument();
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void endDocument()
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.endDocument();
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void startPrefixMapping(String prefix, String uri)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.startPrefixMapping(prefix, uri);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void endPrefixMapping(String prefix)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.endPrefixMapping(prefix);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void startElement(String uri, String loc, String raw, Attributes a)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.startElement(uri, loc, raw, a);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void endElement(String uri, String loc, String raw)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.endElement(uri, loc, raw);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void characters(char c[], int start, int len)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.characters(c, start, len);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void ignorableWhitespace(char c[], int start, int len)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.ignorableWhitespace(c, start, len);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void processingInstruction(String target, String data)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.processingInstruction(target, data);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void skippedEntity(String name)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.skippedEntity(name);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void startDTD(String name, String publicId, String systemId)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.startDTD(name, publicId, systemId);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void endDTD()
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.endDTD();
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void startEntity(String name)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.startEntity(name);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void endEntity(String name)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.endEntity(name);
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void startCDATA()
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.startCDATA();
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void endCDATA()
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.endCDATA();
+        this.stack.setOffset(this.newOffset);
+    }
+
+    public void comment(char ch[], int start, int len)
+    throws SAXException {
+        this.stack.setOffset(this.oldOffset);
+        this.consumer.comment(ch, start, len);
+        this.stack.setOffset(this.newOffset);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/EnvironmentStack.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 1999-2005 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.cocoon.environment.internal;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.cocoon.components.source.impl.SitemapSourceInfo;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
+
+/**
+ * Local extension of EnvironmentWrapper to propagate otherwise blocked
+ * methods to the actual environment.
+ * 
+ * @version $Id: ForwardEnvironmentWrapper.java 312659 2005-10-10 14:11:48Z cziegeler $
+ * @since 2.2
+ */
+public final class ForwardEnvironmentWrapper extends EnvironmentWrapper {
+
+    public ForwardEnvironmentWrapper(Environment env,
+                                     SitemapSourceInfo info, 
+                                     Logger logger) {
+        super(env, info, logger, false);
+    }
+
+    /**
+     * @see org.apache.cocoon.environment.Environment#setStatus(int)
+     */
+    public void setStatus(int statusCode) {
+        environment.setStatus(statusCode);
+    }
+
+    /**
+     * @see org.apache.cocoon.environment.Environment#setContentLength(int)
+     */
+    public void setContentLength(int length) {
+        environment.setContentLength(length);
+    }
+
+    /**
+     * @see org.apache.cocoon.environment.Environment#setContentType(java.lang.String)
+     */
+    public void setContentType(String contentType) {
+        environment.setContentType(contentType);
+    }
+
+    /**
+     * @see org.apache.cocoon.environment.Environment#getContentType()
+     */
+    public String getContentType() {
+        return environment.getContentType();
+    }
+
+    /**
+     * @see org.apache.cocoon.environment.Environment#isResponseModified(long)
+     */
+    public boolean isResponseModified(long lastModified) {
+        return environment.isResponseModified(lastModified);
+    }
+
+    /**
+     * @see org.apache.cocoon.environment.Environment#setResponseIsNotModified()
+     */
+    public void setResponseIsNotModified() {
+        environment.setResponseIsNotModified();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.environment.Environment#redirect(java.lang.String, boolean, boolean)
+    public void redirect(String newURL, boolean global, boolean permanent)
+    throws IOException {
+        this.environment.redirect(newURL, global, permanent);
+    }
+     */
+
+}
\ No newline at end of file

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/java/org/apache/cocoon/environment/internal/ForwardEnvironmentWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message