Changeset 761


Ignore:
Timestamp:
10/08/10 21:47:23 (14 years ago)
Author:
gaba
Message:
 
Location:
MDService2/trunk/MDService2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice2_ui.js

    r760 r761  
    4747                }
    4848
    49 //////////////                         
     49//////////////         
     50                //saveWorkspace();
    5051                loadWorkspaceProfiles();
    5152                loadCollections();                     
     
    5960                addFunctionality();
    6061                addVisuals();
     62               
    6163});
    6264
     
    355357
    356358        var JSONText = JSON.stringify(jsonw["WorkspaceProfile"]);
    357         $.post("/MDService2/workspaceprofilesave/1/" + JSONText, "");
     359        //var JSONText = JSON.stringify({"aa.a":"r"});
     360        notifyUser(JSONText,'debug');
     361        $.get("/MDService2/workspaceprofilesave/",JSONText);
    358362}
    359363////////////////////////////////////////////////
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/WorkspaceAction.java

    r742 r761  
    22
    33import java.io.BufferedInputStream;
     4import java.io.BufferedReader;
    45import java.io.ByteArrayInputStream;
     6import java.io.ByteArrayOutputStream;
    57import java.io.File;
    68import java.io.FileInputStream;
    79import java.io.IOException;
    810import java.io.InputStream;
     11import java.io.InputStreamReader;
    912import java.net.MalformedURLException;
    1013import java.net.URL;
     14import java.util.Enumeration;
    1115
    1216import java.io.StringReader;
    1317import java.io.StringWriter;
    1418
     19import javax.servlet.ServletInputStream;
    1520import javax.servlet.http.HttpServletRequest;
    1621import javax.xml.parsers.DocumentBuilder;
     
    3136import net.sf.json.xml.XMLSerializer;
    3237
     38import java.security.AccessController;
     39import java.security.PrivilegedActionException;
     40import java.security.PrivilegedExceptionAction;
     41//import javax.servlet.ServletInputStream;
     42import org.apache.catalina.connector.CoyoteInputStream;
     43import org.apache.catalina.security.SecurityUtil;
     44
     45
     46
    3347import org.apache.struts2.interceptor.ServletRequestAware;
    3448import org.w3c.dom.Document;
     
    6680       
    6781        //private HttpServletRequest request;
    68          
    69         public String getData() {
     82       
     83        public String getData(){
    7084                return data;
    7185        }
     
    350364       
    351365*/
    352         public String save(){
    353                
    354         String jsonData = getData();
     366        public String save() throws IOException {
     367               
     368        String jsonData = null ;//= getData();
     369             
     370     // Extract the post content from the request
     371//        ///@SuppressWarnings("unchecked")
     372        //Enumeration<String> paramEnum = this.getServletRequest().getParameterNames();
     373        //paramEnum.hasMoreElements();
     374        //jsonData = (String) paramEnum.nextElement();
     375        Admin.notifyUser(this.getServletRequest().getContentType());
     376        ServletInputStream sins = this.getServletRequest().getInputStream();
     377        sins.reset();
     378        int contentLen = this.getServletRequest().getContentLength();
     379
     380        if ( contentLen >= 1 ) {
     381
     382                byte buffer[] = new byte[ contentLen ];
     383
     384                try{
     385                        int len = sins.readLine( buffer, 0, buffer.length );
     386                        jsonData = new String( buffer, 0, len );
     387                }catch (IOException e){
     388                        Admin.notifyUser("exception");
     389                }
     390        }
     391
    355392        Admin.notifyUser("JSON data:"+jsonData);
    356393       
Note: See TracChangeset for help on using the changeset viewer.