Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. @RestController
  2. @RequestMapping("/api")
  3. public class PwsResource {
  4. @RequestMapping(value = "/import-data", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
  5. public ResponseEntity importData() throws URISyntaxException, IOException {
  6. ....
  7. if (!path.isEmpty()) {
  8. importService.importData(path);
  9. return new ResponseEntity<>(HttpStatus.OK);
  10. } else {
  11. return new ResponseEntity<>(HttpStatus.NO_CONTENT);
  12. }
  13. }
  14.  
  15. <script type="text/javascript">
  16. $(document).ready(function () {
  17.  
  18. $('#import').click(function (event) {
  19. $.ajax({
  20. url: 'api/import-data',
  21. data: '',
  22. type: "GET",
  23.  
  24. beforeSend: function (xhr) {
  25. xhr.setRequestHeader("Accept", "application/json");
  26. xhr.setRequestHeader("Content-Type", "application/json");
  27. },
  28. success: function () {
  29. console.log("done")
  30. }
  31. });
  32. });
  33. });
  34. </script>
  35.  
  36. server:
  37. port: 3000
  38.  
  39. spring:
  40. profiles:
  41. active: live
  42. datasource:
  43. url: jdbc:mysql:/server:3306/project?autoReconnect=true
  44. username: root
  45. password: password
  46.  
  47. server:
  48. contextPath: /project
  49. session-timeout: 28800
  50. spring:
  51. profiles:
  52. active: live
  53. view:
  54. prefix: /ui/
  55. suffix: .html
  56. mvc:
  57. locale: en_UK
  58. date-format: yyyy-MM-dd'T'HH:mm:ss.SSSZ
  59. jmx:
  60. enabled: false
  61. datasource:
  62. dataSourceClassName: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
  63. url: jdbc:mysql://server:3306/project?autoReconnect=true
  64. username: root
  65. password: password
  66. cachePrepStmts: true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement