Frage

I want to hit a url and pass some filepath in it : here is the sample url:

localhost:8080/CoreEngine/addrecording/obd_msisdn_pankaj/9958557426/9999620647/{D:\Islamic\first}

Last one is a filepath.

i am receiving this at my controller as :

@RequestMapping(value="/addrecording/{tablename}/{aparty}/{bparty}/{filename}")

 public @ResponseBody String addRecord(@PathVariable("tablename") String tablename, @PathVariable("aparty") String aparty, @PathVariable("bparty") String bparty , @PathVariable("filename") String filename)
{
return "done";
}

It works for url :

http://127.0.0.1:8080/CoreEngine/addrecording/thispank/356783956/67456/gdshhfdsg

But if i hit url :

http://127.0.0.1:8080/CoreEngine/addrecording/thispank/356783956/67456/E:\out_of_ofc\songs\Spirit.mp3

It does not work for filepath and gives following error at browser :

it gives error : vedio playback aborted due to network error

if i hit url as

127.0.0.1:8080/CoreEngine/addrecording/obd_msisdn_pankaj/9958557426/9999620647/?path=E:\out_of_ofc\songs\Spirit.mp3

The requested resource is not available.

Can anybody provide a solution to this problem.

War es hilfreich?

Lösung

This can be done by using GET request method instead of post request and using @requestparam method.

@RequestMapping(value="/addrecording", method = RequestMethod.GET)
public @ResponseBody String addRecord(HttpServletRequest request,HttpServletResponse response,@RequestParam("tablename") String tablename, @RequestParam("aparty") String aparty, @RequestParam("bparty") String bparty , @RequestParam("filename") String filename)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top