Salome HOME
Fix for uploading of files with names containing specific (accented, ampersand) chara...
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / UploadAction.java
index a5548dd530847d46fe7e3264217e11927c44b444..95b5b3874f74a086e691303a0277d101776271b2 100644 (file)
@@ -1,6 +1,8 @@
 package org.splat.simer;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 
 import org.splat.kernel.Do;
 import org.splat.service.technical.RepositoryService;
@@ -85,6 +87,7 @@ public class UploadAction extends Action {
                initializationFullScreenContext(Constants.SYSADMIN_MENU,
                                Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
                                Constants.OPEN);
+               setSimanContext("#Database_Management.htm");
 
                return SUCCESS;
        }
@@ -162,6 +165,20 @@ public class UploadAction extends Action {
                return _uploadFileName;
        }
 
+       /**
+        * Get fileName with url special symbols canceled for usage in struts.xml.
+        * @return the encoded uploaded file name.
+        */
+       public String getCanceledFileName() {
+               String res = _uploadFileName;
+               try {
+                       res = URLEncoder.encode(res, "ISO-8859-1");
+               } catch (UnsupportedEncodingException e) {
+                       LOG.error("Reason: ", e);
+               }
+               return res;
+       }
+       
        /**
         * Get the action to which the uploaded file is passed.
         *