K
K
Karina2015-09-14 12:57:25
Angular
Karina, 2015-09-14 12:57:25

How to form long query using angular for spring framework?

It is necessary: ​​to form a long post, according to the type (address/street='Avenu'&house=5&flat=10)
Probably, I tried 10 ways.
tried like this:

$http.post("name_site/download_data", { street: "Avenu",  house: 5} ).success(function (data) {
});

So:
$http.post("name_site/download_data/" + "street=Avenu&house=5"  ).success(function (data) {
});

In controller:
not working:
@RequestMapping(value="/download_data", method=RequestMethod.POST)
  public void downloadData(@RequestParam(value = "street") String street) throws IOException {      
    System.out.println(street);      
  }

does not work:
@RequestMapping(value="/download_data/{data}", method=RequestMethod.POST)
  public void downloadData(@PathVariable("street") String street) throws IOException {      
    System.out.println(street);      
  }

and tried a lot more.
But! it happens that in the console I have values. And everything is fine. But in the console I have a stable error: 404.
How do you do it?
Thanks everyone for the replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Karina, 2015-09-14
@iKapex

public void downloadData(@RequestBody String data) {
...
}

data - will contain json

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question