0

i need help with my Spring Restful Service Script. Iam trying to set Default Values in a Post Body and i need to know thats possible? or not?

Its about a login who needs default values.

It works with Get Function with the following Code:

@ResponseBody
@RequestMapping(value= {"login/"}, 
    method = {RequestMethod.GET, RequestMethod.POST}, 
    consumes = {MediaType.TEXT_PLAIN_VALUE },
    produces = {MediaType.APPLICATION_JSON_VALUE}

public String login(@RequestParam(value= "user", defaultValue = "") String user,
                    @RequestParam(value ="password", defaultValue = "") String password)
{
    System.out.println(user+"---"+password);

}

But the Data are very sensible so i need to post them.

Artur Rem
  • 209
  • 1
  • 4
  • 18
  • Your code should work. See http://stackoverflow.com/questions/16504401/spring-mvc-default-value-not-working – Evgeni Dimitrov Jan 07 '14 at 19:23
  • I tried this but i dont get any values. My Problem is that i dont know how to build the Http Post. SHould i set the Values in the Body or in the Url? I need to set the Values in the Body for hiding sensible values in my Body but i need to set default values if the needed values dont excist. – Artur Rem Jan 08 '14 at 08:24
  • One way is to create ajax post: http://hayageek.com/jquery-ajax-post/ – Evgeni Dimitrov Jan 08 '14 at 08:39
  • Thank you for your comment but i never worked with ajax... im using for my test the firefox addon RESTClient. Can someone help me with that ? – Artur Rem Jan 08 '14 at 08:59
  • See this http://stackoverflow.com/questions/13132794/firefox-add-on-restclient-how-to-input-post-parameters – Evgeni Dimitrov Jan 08 '14 at 09:50
  • Thank you everything is solved. I use the same add on and this answer was totally that what i seeked. – Artur Rem Jan 10 '14 at 09:38

0 Answers0