Don't use the unsafe Accept-Charset header, since its contents are already defined...
[pithos] / src / gr / ebs / gss / client / GSS.java
index 3f9f8f8..a8fceb3 100644 (file)
@@ -193,6 +193,11 @@ public class GSS implements EntryPoint, WindowResizeListener {
         */
        private String token;
 
+       /**
+        * The WebDAV password of the current user
+        */
+       private String webDAVPassword;
+
        private PickupDragController dragController;
 
        public void onModuleLoad() {
@@ -369,20 +374,6 @@ public class GSS implements EntryPoint, WindowResizeListener {
         * Parse and store the user credentials to the appropriate fields.
         */
        private void parseUserCredentials() {
-               //------------------------
-               // XXX This part is only for development environments!
-               // XXX Remove/comment for production deployment!
-               final String _username = Window.Location.getParameter("user");
-               token = Window.Location.getParameter("token");
-               if (_username != null) {
-                       DeferredCommand.addCommand(new Command() {
-                               public void execute() {
-                                       fetchUser(_username);
-                               }
-                       });
-                       return;
-               }
-               //------------------------
                Configuration conf = (Configuration) GWT.create(Configuration.class);
                String cookie = conf.authCookie();
                String auth = Cookies.getCookie(cookie);
@@ -401,6 +392,9 @@ public class GSS implements EntryPoint, WindowResizeListener {
                final String username = auth.substring(0, sepIndex);
                if (username == null)
                        authenticateUser();
+
+               refreshWebDAVPassword();
+
                DeferredCommand.addCommand(new Command() {
                        public void execute() {
                                fetchUser(username);
@@ -656,6 +650,16 @@ public class GSS implements EntryPoint, WindowResizeListener {
                return statusPanel;
        }
 
+
+       /**
+        * Retrieve the userDetailsPanel.
+        *
+        * @return the userDetailsPanel
+        */
+       public UserDetailsPanel getUserDetailsPanel() {
+               return userDetailsPanel;
+       }
+
        /**
         * Retrieve the dragController.
         *
@@ -669,6 +673,10 @@ public class GSS implements EntryPoint, WindowResizeListener {
                return token;
        }
 
+       public String getWebDAVPassword() {
+               return webDAVPassword;
+       }
+
        public void removeGlassPanel(){
                glassPanel.removeFromParent();
        }
@@ -682,6 +690,15 @@ public class GSS implements EntryPoint, WindowResizeListener {
                return currentUserResource;
        }
 
+       /**
+        * Modify the currentUserResource.
+        *
+        * @param newUser the new currentUserResource
+        */
+       public void setCurrentUserResource(UserResource newUser) {
+               currentUserResource = newUser;
+       }
+
        public static native void preventIESelection() /*-{
        $doc.body.onselectstart = function () { return false; };
        }-*/;
@@ -699,4 +716,13 @@ public class GSS implements EntryPoint, WindowResizeListener {
                return GWT.getModuleBaseURL() + conf.apiPath();
        }
 
+       public void refreshWebDAVPassword() {
+               Configuration conf = (Configuration) GWT.create(Configuration.class);
+               String domain = Window.Location.getHostName();
+               String path = Window.Location.getPath();
+               String cookie = conf.webdavCookie();
+               webDAVPassword = Cookies.getCookie(cookie);
+               Cookies.setCookie(cookie, "", null, domain, path, false);
+       }
+
 }