title: Passing Object to Java from AngularJS
body: <p>i'm in trouble with this problem.
  I've a Javascript structur like this:</p>
  
  <pre><code>$scope.setting= {
      enabled: false,
      host:"",
      port:"",
      user:"",
      pwd:"",
      path:"/",
      filePrefix:"",
      type:"",
      sendInterval:"",
      dataPeriod:"",
      compression:false,
      subscription:[]
  };
  </code></pre>
  
  <p>In the controller i modify the subscription array, but when i pass it to the java code:</p>
  
  <pre><code>$http.post('/api/testAndSetFTPSetting', $scope.setting)
      .success(function (data) {
          console.log(data);
      })
      .error(function (data, status, header, config) {
      });
  </code></pre>
  
  <p>the subscription array is null.</p>
  
  <p>Here the API</p>
  
  <pre><code>@RequestMapping(value = {"/api/testAndSetFTPSetting"}, method={RequestMethod.POST})
      @ResponseBody
      public boolean testAndSetFTPSetting(FTPConfiguration ftp) throws JAXBException {
  
          System.out.println(ftp.getSubscribtion().size()); // here i've ever 0 and ftp.getSubscribtion() return me null
  
          return true;
  
      }
  </code></pre>
  
  <p>Here the Java Class who controls the object:</p>
  
  <pre><code>    @XmlRootElement(name="FTPconfiguration")
      @XmlAccessorType (XmlAccessType.FIELD)
      public class FTPConfiguration{
          boolean enabled = false;            
          String host="127.0.0.1";            
          int port=22;                        
          String user="root";                 
          String pwd="";                      
          String path="/";                    
          String filePrefix="data";           
          FTPType type=FTPType.SFTP;          
          int sendInterval=15;                
          int dataPeriod=5;                   
          boolean compression=false;          
          @XmlElementWrapper(name="subscriptions")
          List&lt;String&gt; subscription = new LinkedList&lt;String&gt;();   
  
  
          public FTPConfiguration() {
          }
  
          public FTPConfiguration(boolean enabled,String host, int port, String user, String pwd, String path, String filePrefix,
                  FTPType type, int sendInterval, int dataPeriod, boolean compression, List&lt;String&gt; subscription) {
              super();
              this.host = host;
              this.port = port;
              this.user = user;
              this.pwd = pwd;
              this.path = path;
              this.filePrefix = filePrefix;
              this.type = type;
              this.sendInterval = sendInterval;
              this.dataPeriod = dataPeriod;
              this.compression = compression;
              if(subscription != null)
                  this.subscription.addAll(subscription);
          }
          // setter and getter method
  </code></pre>
  
  <p>Where is my fault?</p>