dims 01/05/25 09:01:49
Modified: src/org/apache/cocoon/environment AbstractEnvironment.java
src/org/apache/cocoon/environment/http HttpEnvironment.java
src/org/apache/cocoon/servlet CocoonServlet.java
Log:
Remove use of File in HttpEnvironment. This is work in progress for servlet
engines like WebLogic that return null for ServletContext's getRealPath when
deployed as WAR.
Revision Changes Path
1.4 +16 -8
xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractEnvironment.java 2001/05/23 08:57:26 1.3
+++ AbstractEnvironment.java 2001/05/25 16:01:47 1.4
@@ -46,35 +46,43 @@
/**
* Constructs the abstract enviornment
*/
- public AbstractEnvironment(String uri, String view, String context)
+ public AbstractEnvironment(String uri, String view, String file)
throws MalformedURLException {
- this(uri, view, new File(context), null);
+ this(uri, view, new File(file), null);
}
/**
* Constructs the abstract enviornment
*/
- public AbstractEnvironment(String uri, String view, String context,
String action)
+ public AbstractEnvironment(String uri, String view, String file, String
action)
throws MalformedURLException {
- this(uri, view, new File(context), action);
+ this(uri, view, new File(file), action);
}
/**
* Constructs the abstract enviornment
*/
- public AbstractEnvironment(String uri, String view, File context)
+ public AbstractEnvironment(String uri, String view, File file)
throws MalformedURLException {
- this(uri, view, context, null);
+ this(uri, view, file, null);
}
/**
* Constructs the abstract enviornment
*/
- public AbstractEnvironment(String uri, String view, File context, String
action)
+ public AbstractEnvironment(String uri, String view, File file, String
action)
throws MalformedURLException {
+ this(uri, view, file.toURL(), action);
+ }
+
+ /**
+ * Constructs the abstract enviornment
+ */
+ public AbstractEnvironment(String uri, String view, URL context, String
action)
+ throws MalformedURLException {
this.pushURI(uri);
this.view = view;
- this.context = context.toURL();
+ this.context = context;
this.action = action;
this.objectModel = new HashMap();
}
1.2 +4 -2
xml-cocoon2/src/org/apache/cocoon/environment/http/HttpEnvironment.java
Index: HttpEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/http/HttpEnvironment.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpEnvironment.java 2001/05/09 20:49:45 1.1
+++ HttpEnvironment.java 2001/05/25 16:01:47 1.2
@@ -45,12 +45,14 @@
* Constructs a HttpEnvironment object from a HttpServletRequest
* and HttpServletResponse objects
*/
- public HttpEnvironment (String uri, HttpServletRequest req,
+ public HttpEnvironment (String uri,
+ URL rootURL,
+ HttpServletRequest req,
HttpServletResponse res,
ServletContext servletContext,
HttpContext context)
throws MalformedURLException, IOException {
- super(uri, req.getParameter(Constants.VIEW_PARAM),
servletContext.getRealPath("/"), req.getParameter(Constants.ACTION_PARAM));
+ super(uri, req.getParameter(Constants.VIEW_PARAM), rootURL,
req.getParameter(Constants.ACTION_PARAM));
this.request = new HttpRequest (req, this);
this.response = new HttpResponse (res);
1.7 +4 -1
xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CocoonServlet.java 2001/05/25 14:25:59 1.6
+++ CocoonServlet.java 2001/05/25 16:01:48 1.7
@@ -57,7 +57,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.6 $ $Date: 2001/05/25 14:25:59 $
+ * @version CVS $Revision: 1.7 $ $Date: 2001/05/25 16:01:48 $
*/
public class CocoonServlet extends HttpServlet {
@@ -534,7 +534,10 @@
HttpServletResponse res)
throws Exception {
HttpEnvironment env;
+
+ File root = new File(this.servletContext.getRealPath("/"));
env = new HttpEnvironment(uri,
+ root.toURL(),
req,
res,
this.servletContext,
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]