title: HTTP Status 400 : The request sent by the client was syntactically incorrect
body: <p>Here is <code>LocationSearchMetaData.java</code></p>
  
  <pre><code>public class LocationSearchMetaData {
      private int page;
      private String tag;
      private SearchPreferences prefs;
      private PublishMsgSearchLocality locality;
  
      public PublishMsgSearchLocality getLocality() {
          return locality;
      }
  
      public void setLocality(PublishMsgSearchLocality locality) {
          this.locality = locality;
      }
  
      public SearchPreferences getPrefs() {
          return prefs;
      }
  
      public void setPrefs(SearchPreferences prefs) {
          this.prefs = prefs;
      }    
  
      public int getPage() {
          return page;
      }
  
      public void setPage(int page) {
          this.page = page;
      }    
  
      public String getTag() {
          return tag;
      }
  
      public void setTag(String tag) {
          this.tag = tag;
      }
  }
  </code></pre>
  
  <p><code>SearchPreferences.java</code></p>
  
  <pre><code>public abstract class SearchPreferences {
      private String radius; 
      private boolean useCurrLoc;    
  
      public boolean isUseCurrLoc() {
          return useCurrLoc;
      }
  
      public void setUseCurrLoc(boolean useCurrLoc) {
          this.useCurrLoc = useCurrLoc;
      }    
  
      public String getRadius() {
          return radius;
      }
  
      public void setRadius(String radius) {
          this.radius = radius;
      }
  }
  </code></pre>
  
  <p><code>PublishMsgSearchLocality.java</code></p>
  
  <pre><code>public class PublishMsgSearchLocality {
      private String formatted_address;
      private double lat;
      private double lon;
  
      public String getFormatted_address() {
          return formatted_address;
      }
  
      public void setFormatted_address(String formatted_address) {
          this.formatted_address = formatted_address;
      }
  
      public double getLat() {
          return lat;
      }
  
      public void setLat(double lat) {
          this.lat = lat;
      }
  
      public double getLon() {
          return lon;
      }
  
      public void setLon(double lon) {
          this.lon = lon;
      }
  }
  </code></pre>
  
  <p>My controller</p>
  
  <pre><code>@RestController
  @CrossOrigin
  @RequestMapping("/api/v1.0/search")
  public class SearchController {
      @Autowired
      private SearchService search;
  
      @Autowired
      private AppInstances instances;    
  
      @RequestMapping(value="tag",method=RequestMethod.POST)
      public List&lt;PublishMessageSearchModel&gt; searchByTag(@RequestBody LocationSearchMetaData metaData)
      {        
          return search.search(instances.getEsClient(), metaData.getLocality().getLat(), metaData.getLocality().getLon(), Integer.parseInt(metaData.getPrefs().getRadius()), metaData.getTag(), metaData.getPage());
      }     
  }
  </code></pre>
  
  <p>My client request is like this</p>
  
  <pre><code>    var req = {                   
         method: 'POST',
         url: 'http://192.168.1.2:8084/mobapp/api/v1.0/search/tag',
         headers: {
           'Content-Type': "application/json"
         },
         data: searchFormService.getTagSearhReqData()
      };
  
      $http(req).then(function(d){
        console.log("search data :: "+JSON.stringify(d));
      }, function(e){
  </code></pre>
  
  <p>Here is how actual data request</p>
  
  <pre><code>{"prefs":{"radius":"25","useCurrLoc":true},"page":1,"locality":{"formatted_address":"mylocation","lat":11.9313,"lon":60.579999999},"tag":"tag3"}
  </code></pre>
  
  <p>Error i getting :</p>
  
  <pre><code>HTTP Status 400 : The request sent by the client was syntactically incorrect.
  </code></pre>