You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by cm...@apache.org on 2002/08/05 15:52:37 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/util WebdavUtils.java
cmlenz 2002/08/05 06:52:37
Modified: src/webdav/server/org/apache/slide/webdav/util
WebdavUtils.java
Log:
Added a new static method WebdavUtils.getAbsolutePath().
This method should replace PropertyHelper.getAbsoluteURI(), because it (a)
takes the scope into account and (b) takes the servlet-path into account
when the servlet init-param 'default-servlet' is set to false.
Using the new method instead of the old one will make the WebdavServlet
actually work when it is not the default-servlet and/or the scope parameter
is set.
I will deprecate the PropertyHelper.getAbsoluteURI() method and will start
replacing it's usage, but it's being used all over the place.
Revision Changes Path
1.6 +34 -6 jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java
Index: WebdavUtils.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WebdavUtils.java 20 May 2002 12:10:15 -0000 1.5
+++ WebdavUtils.java 5 Aug 2002 13:52:37 -0000 1.6
@@ -269,6 +269,36 @@
/**
+ * Maps the URI of a node in the Slide namespace to an external URI as seen
+ * by clients. This involves adding the context and servlet path to the
+ * URI.
+ *
+ * @param uri the node's URI
+ * @param config configuration of the WebdavServlet
+ *
+ * @return the node's URI as absolute path
+ **/
+ public static String getAbsolutePath
+ (String uri, HttpServletRequest req, WebdavServletConfig config) {
+
+ String result = uri;
+
+ int scopeLength = config.getScope().length();
+ if (scopeLength > 0) {
+ result = uri.substring(scopeLength);
+ }
+
+ String contextPath = req.getContextPath();
+ if (!config.isDefaultServlet()) {
+ contextPath += req.getServletPath();
+ }
+ result = contextPath + result;
+
+ return encodeURL(result);
+ }
+
+
+ /**
* Maps the request URI of a HTTP request to a URI in the Slide namespace
* (this does not necessarily mean that a node exists at that URI).
*
@@ -296,8 +326,6 @@
// prefix the URI with the configured scope
result = config.getScope() + result;
-
-
return decodeURL(fixTomcatURL(result));
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>