You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:49:34 UTC
[sling-org-apache-sling-jcr-webdav] 10/38: SLING-256 - Use null for
the workspace name in JCR calls if configured name is empty
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.jcr.webdav-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-webdav.git
commit 82e5c38e47ec0eee09012b0e537f97fb73a601e9
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Feb 19 10:35:38 2008 +0000
SLING-256 - Use null for the workspace name in JCR calls if configured name is empty
git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/webdav@629058 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/jcr/webdav/SimpleWebDavServlet.java | 23 +++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java b/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
index ad286f4..65469b5 100644
--- a/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
+++ b/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
@@ -69,15 +69,24 @@ public class SimpleWebDavServlet extends SimpleWebdavServlet {
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
- // redirect to the default workspace if directly addressing the servlet
- String pinfo = request.getPathInfo();
+ final String pinfo = request.getPathInfo();
+
if (pinfo == null || "/".equals(pinfo)) {
- String uri = request.getRequestURI();
- if (pinfo == null) {
- uri += "/";
+ // redirect to the default workspace if directly addressing the servlet
+ // and if the default workspace name is not null (in which case we'd need
+ // to login to find out the actual workspace name, SLING-256)
+ if(repository.getDefaultWorkspace() == null) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND,
+ "JCR workspace name required, please add it to the end of the URL"
+ + " (for the Jackrabbit embedded repository the default name is 'default') ");
+ } else {
+ String uri = request.getRequestURI();
+ if (pinfo == null) {
+ uri += "/";
+ }
+ uri += repository.getDefaultWorkspace();
+ response.sendRedirect(uri);
}
- uri += repository.getDefaultWorkspace();
- response.sendRedirect(uri);
}
super.service(request, response);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.