You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2003/09/18 15:15:17 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/util ServletHelper.java
andreas 2003/09/18 06:15:17
Modified: src/java/org/apache/lenya/util ServletHelper.java
Log:
added method to obtain webapp URL based on context and request URI
Revision Changes Path
1.4 +13 -3 cocoon-lenya/src/java/org/apache/lenya/util/ServletHelper.java
Index: ServletHelper.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/util/ServletHelper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletHelper.java 31 Aug 2003 13:05:02 -0000 1.3
+++ ServletHelper.java 18 Sep 2003 13:15:16 -0000 1.4
@@ -85,11 +85,21 @@
*/
public static String getWebappURI(Request request) {
String context = request.getContextPath();
+ String requestUri = request.getRequestURI();
+ return getWebappURI(context, requestUri);
+ }
+
+ /**
+ * Returns the URL inside the web application (without the context prefix).
+ * @param context The context prefix.
+ * @param requestUri The complete request URI.
+ * @return A string.
+ */
+ public static String getWebappURI(String context, String requestUri) {
if (context == null) {
context = "";
}
- String url = request.getRequestURI().substring(context.length());
-
+ String url = requestUri.substring(context.length());
if (url.length() > 0 && !url.startsWith("/")) {
url = "/" + url;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org