Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.35 KB | None | 0 0
  1. Sun Jan 22 21:05:28 MSK 2017
  2. There was an unexpected error (type=Not Found, status=404).
  3. No message available
  4.  
  5. package com.theligue.webservice;
  6.  
  7. import org.springframework.boot.CommandLineRunner;
  8. import org.springframework.boot.SpringApplication;
  9. import org.springframework.boot.autoconfigure.SpringBootApplication;
  10. import org.springframework.boot.context.properties.EnableConfigurationProperties;
  11. import org.springframework.context.annotation.Bean;
  12.  
  13. import com.theligue.webservice.storage.StorageProperties;
  14. import com.theligue.webservice.storage.StorageService;
  15.  
  16.  
  17.  
  18. @SpringBootApplication
  19. @EnableConfigurationProperties(StorageProperties.class)
  20. public class Application {
  21.  
  22. public static void main(String[] args) {
  23. System.out.println("00000000000000000000000000000000000000000000");
  24. SpringApplication.run(Application.class, args);
  25. System.out.println("11111111111111111111111111111111111111");
  26. }
  27.  
  28. @Bean
  29. CommandLineRunner init(StorageService storageService) {
  30. System.out.println("222222222222222222222222222222222222222222222222");
  31. return (args) -> {
  32. storageService.deleteAll();
  33. storageService.init();
  34. };
  35. }
  36. }
  37.  
  38. and this is the File uploader controller File :
  39.  
  40. package com.theligue.webservice;
  41. import org.springframework.beans.factory.annotation.Autowired;
  42. import org.springframework.core.io.Resource;
  43. import org.springframework.http.HttpHeaders;
  44. import org.springframework.http.ResponseEntity;
  45. import org.springframework.stereotype.Controller;
  46. import org.springframework.ui.Model;
  47. import org.springframework.web.bind.annotation.*;
  48. import org.springframework.web.multipart.MultipartFile;
  49. import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder;
  50. import org.springframework.web.servlet.mvc.support.RedirectAttributes;
  51.  
  52. import com.theligue.webservice.storage.StorageFileNotFoundException;
  53. import com.theligue.webservice.storage.StorageService;
  54.  
  55.  
  56. import java.io.IOException;
  57. import java.util.stream.Collectors;
  58.  
  59. @Controller
  60. @RequestMapping("/api")
  61. public class FileUploadController {
  62. private final StorageService storageService;
  63.  
  64. @Autowired
  65. public FileUploadController(StorageService storageService) {
  66. System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
  67. this.storageService = storageService;
  68. }
  69.  
  70. @GetMapping("/")
  71. public String listUploadedFiles(Model model) throws IOException {
  72. System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
  73.  
  74. model.addAttribute("files", storageService
  75. .loadAll()
  76. .map(path ->
  77. MvcUriComponentsBuilder
  78. .fromMethodName(FileUploadController.class, "serveFile", path.getFileName().toString())
  79. .build().toString())
  80. .collect(Collectors.toList()));
  81. System.out.println("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
  82. return "uploadForm";
  83. }
  84.  
  85. @GetMapping("/files/{filename:.+}")
  86. @ResponseBody
  87. public ResponseEntity<Resource> serveFile(@PathVariable String filename) {
  88.  
  89. Resource file = storageService.loadAsResource(filename);
  90. return ResponseEntity
  91. .ok()
  92. .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=""+file.getFilename()+""")
  93. .body(file);
  94. }
  95.  
  96. @PostMapping("/")
  97. public String handleFileUpload(@RequestParam("file") MultipartFile file,
  98. RedirectAttributes redirectAttributes) {
  99.  
  100. storageService.store(file);
  101. redirectAttributes.addFlashAttribute("message",
  102. "You successfully uploaded " + file.getOriginalFilename() + "!");
  103.  
  104. return "redirect:/";
  105. }
  106.  
  107. @ExceptionHandler(StorageFileNotFoundException.class)
  108. public ResponseEntity handleStorageFileNotFound(StorageFileNotFoundException exc) {
  109. return ResponseEntity.notFound().build();
  110. }
  111.  
  112.  
  113. }
  114.  
  115. 00000000000000000000000000000000000000000000
  116. 00000000000000000000000000000000000000000000
  117.  
  118. . ____ _ __ _ _
  119. /\ / ___'_ __ _ _(_)_ __ __ _
  120. ( ( )___ | '_ | '_| | '_ / _` |
  121. \/ ___)| |_)| | | | | || (_| | ) ) ) )
  122. ' |____| .__|_| |_|_| |___, | / / / /
  123. =========|_|==============|___/=/_/_/_/
  124. :: Spring Boot :: (v1.4.3.RELEASE)
  125.  
  126. 2017-01-22 21:05:08.319 INFO 1572 --- [ restartedMain] com.theligue.webservice.Application : Starting Application on DESKTOP-M1QNJT9 with PID 1572 (started by Mohammad Taha in C:UsersMohammad TahaworkspacetheLigueLigueWebServices)
  127. 2017-01-22 21:05:08.322 INFO 1572 --- [ restartedMain] com.theligue.webservice.Application : No active profile set, falling back to default profiles: default
  128. 2017-01-22 21:05:08.637 INFO 1572 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1c13f3d5: startup date [Sun Jan 22 21:05:08 MSK 2017]; root of context hierarchy
  129. 2017-01-22 21:05:11.743 INFO 1572 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
  130. 2017-01-22 21:05:11.760 INFO 1572 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service Tomcat
  131. 2017-01-22 21:05:11.763 INFO 1572 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6
  132. 2017-01-22 21:05:11.949 INFO 1572 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
  133. 2017-01-22 21:05:11.949 INFO 1572 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3315 ms
  134. 2017-01-22 21:05:12.198 INFO 1572 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
  135. 2017-01-22 21:05:12.202 INFO 1572 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
  136. 2017-01-22 21:05:12.203 INFO 1572 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
  137. 2017-01-22 21:05:12.203 INFO 1572 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
  138. 2017-01-22 21:05:12.203 INFO 1572 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
  139. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  140. 2017-01-22 21:05:12.317 WARN 1572 --- [ restartedMain] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation should only be used on methods with parameters: public java.util.Collection com.theligue.webservice.service.PlayerService.getFakeDataObject()
  141. 222222222222222222222222222222222222222222222222
  142. 2017-01-22 21:05:12.950 INFO 1572 --- [ restartedMain] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
  143. 2017-01-22 21:05:13.013 INFO 1572 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:4}] to localhost:27017
  144. 2017-01-22 21:05:13.015 INFO 1572 --- [localhost:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 4, 1]}, minWireVersion=0, maxWireVersion=5, maxDocumentSize=16777216, roundTripTimeNanos=568071}
  145. 2017-01-22 21:05:13.334 INFO 1572 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1c13f3d5: startup date [Sun Jan 22 21:05:08 MSK 2017]; root of context hierarchy
  146. 2017-01-22 21:05:13.554 INFO 1572 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/],methods=[GET]}" onto public java.lang.String com.theligue.webservice.FileUploadController.listUploadedFiles(org.springframework.ui.Model) throws java.io.IOException
  147. 2017-01-22 21:05:13.555 INFO 1572 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/files/{filename:.+}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> com.theligue.webservice.FileUploadController.serveFile(java.lang.String)
  148. 2017-01-22 21:05:13.556 INFO 1572 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/],methods=[POST]}" onto public java.lang.String com.theligue.webservice.FileUploadController.handleFileUpload(org.springframework.web.multipart.MultipartFile,org.springframework.web.servlet.mvc.support.RedirectAttributes)
  149. 2017-01-22 21:05:13.559 INFO 1572 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
  150. 2017-01-22 21:05:13.560 INFO 1572 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
  151. 2017-01-22 21:05:13.605 INFO 1572 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  152. 2017-01-22 21:05:13.605 INFO 1572 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  153. 2017-01-22 21:05:13.655 INFO 1572 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  154. 2017-01-22 21:05:14.328 INFO 1572 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
  155. 2017-01-22 21:05:14.408 INFO 1572 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
  156. 2017-01-22 21:05:14.489 INFO 1572 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
  157. 2017-01-22 21:05:14.498 INFO 1572 --- [ restartedMain] com.theligue.webservice.Application : Started Application in 6.679 seconds (JVM running for 7.413)
  158. 11111111111111111111111111111111111111
  159. 2017-01-22 21:05:28.908 INFO 1572 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
  160. 2017-01-22 21:05:28.908 INFO 1572 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
  161. 2017-01-22 21:05:28.930 INFO 1572 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement