You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2004/05/07 19:23:43 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/environment/http HttpContext.java
joerg 2004/05/07 10:23:43
Modified: src/java/org/apache/cocoon/environment/http HttpContext.java
Log:
added delegate methods for all methods of ServletContext (http://marc.theaimsgroup.com/?t=108310430200001&r=1&w=4)
Revision Changes Path
1.3 +58 -6 cocoon-2.1/src/java/org/apache/cocoon/environment/http/HttpContext.java
Index: HttpContext.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/http/HttpContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HttpContext.java 5 Mar 2004 13:02:55 -0000 1.2
+++ HttpContext.java 7 May 2004 17:23:42 -0000 1.3
@@ -15,14 +15,16 @@
*/
package org.apache.cocoon.environment.http;
-import org.apache.avalon.framework.CascadingRuntimeException;
-import org.apache.cocoon.environment.Context;
-
-import javax.servlet.ServletContext;
+import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
-import java.io.InputStream;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.cocoon.environment.Context;
/**
*
@@ -91,5 +93,55 @@
public String getInitParameter(String name) {
return servletContext.getInitParameter(name);
+ }
+
+ /*
+ * These methods are not in Cocoon's Context interface, but in the
+ * ServletContext. To use them you have to downcast Cocoon's Context
+ * to this HttpContext until we decide to add them to the Context
+ * interface too.
+ *
+ * The following methods are deprecated since Servlet API 2.0 or 2.1
+ * and will not be implemented here:
+ * - public Servlet getServlet(String name)
+ * - public Enumeration getServletNames()
+ * - public Enumeration getServlets()
+ * - public void log(Exception exception, String msg)
+ */
+
+ public ServletContext getContext(String uripath) {
+ return this.servletContext.getContext(uripath);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return this.servletContext.getInitParameterNames();
+ }
+
+ public int getMajorVersion() {
+ return this.servletContext.getMajorVersion();
+ }
+
+ public int getMinorVersion() {
+ return this.servletContext.getMinorVersion();
+ }
+
+ public RequestDispatcher getNamedDispatcher(String name) {
+ return this.servletContext.getNamedDispatcher(name);
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return this.servletContext.getRequestDispatcher(path);
+ }
+
+ public String getServerInfo() {
+ return this.servletContext.getServerInfo();
+ }
+
+ public void log(String msg) {
+ this.servletContext.log(msg);
+ }
+
+ public void log(String msg, Throwable throwable) {
+ this.servletContext.log(msg, throwable);
}
}