- Check when renaming file that name doesn't already exist.
[pithos] / src / gr / ebs / gss / server / rest / RequestHandler.java
index 1361210..1b13c1d 100644 (file)
@@ -184,7 +184,7 @@ public class RequestHandler extends Webdav {
                                        ", " + METHOD_DELETE);
                methodsAllowed.put(PATH_OTHERS, METHOD_GET);
                methodsAllowed.put(PATH_SEARCH, METHOD_GET);
-               methodsAllowed.put(PATH_USERS, METHOD_GET + ", " + METHOD_POST);
+               methodsAllowed.put(PATH_USERS, METHOD_GET);
                methodsAllowed.put(PATH_SHARED, METHOD_GET);
                methodsAllowed.put(PATH_TAGS, METHOD_GET);
                methodsAllowed.put(PATH_TRASH, METHOD_GET + ", " + METHOD_DELETE);
@@ -449,9 +449,10 @@ public class RequestHandler extends Webdav {
                } else if (path.startsWith(PATH_SEARCH)) {
             resp.addHeader("Allow", methodsAllowed.get(PATH_SEARCH));
                        resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
-               } else if (path.startsWith(PATH_USERS))
-                       new UserHandler().postUser(req, resp);
-               else if (path.startsWith(PATH_SHARED)) {
+               } else if (path.startsWith(PATH_USERS)) {
+                       resp.addHeader("Allow", methodsAllowed.get(PATH_USERS));
+                       resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+               } else if (path.startsWith(PATH_SHARED)) {
             resp.addHeader("Allow", methodsAllowed.get(PATH_SHARED));
                        resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
                } else if (path.startsWith(PATH_TAGS)) {
@@ -464,6 +465,8 @@ public class RequestHandler extends Webdav {
                        resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
                } else if (path.startsWith(PATH_FILES))
                        new FilesHandler(getServletContext()).postResource(req, resp);
+               else if (path.equals("/"))
+                       new UserHandler().postUser(req, resp);
                else
                resp.sendError(HttpServletResponse.SC_NOT_FOUND, req.getRequestURI());
        }
@@ -605,6 +608,8 @@ public class RequestHandler extends Webdav {
 
                // Fetch the Authorization header and find the user specified in it.
                String auth = request.getHeader(AUTHORIZATION_HEADER);
+               if (auth == null)
+                       return false;
                String[] authParts = auth.split(" ");
                if (authParts.length != 2)
                        return false;