Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. var url = 'rest/loginParametros';
  2. axios.post(url, {
  3. user: this.username,
  4. password: this.password
  5. })
  6. .then(function (response) {
  7. console.log(response);
  8. })
  9. .catch(function (error) {
  10. console.log(error);
  11. });
  12.  
  13. @org.springframework.web.bind.annotation.RestController
  14. @RequestMapping("/rest")
  15. public class RestController {
  16.  
  17. private final Log log = LogFactory.getLog(RestController.class);
  18.  
  19. @PostMapping("/loginParametros")
  20. public ResponseEntity<Boolean> loginParametros(@RequestParam(value = "user", required = true) String user,
  21. @RequestParam(value = "password", required = true) String password)
  22. {
  23. log.info("user: " + user + " password: " + password);
  24. if(user.equals("hitzu") && password.equals("hitzu"))
  25. return new ResponseEntity<>(true, HttpStatus.OK);
  26. return new ResponseEntity<>(false, HttpStatus.OK);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement