Advertisement
aozerets

Untitled

May 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. package com.instaloper.internship.logger.frontend.controller
  2.  
  3. import com.instaloper.internship.logger.model.Request
  4. import com.instaloper.internship.logger.model.RequestType
  5. import com.instaloper.internship.logger.service.RequestService
  6. import org.springframework.stereotype.Controller
  7. import org.springframework.web.bind.annotation.RequestMapping
  8. import org.slf4j.Logger
  9. import org.slf4j.LoggerFactory
  10. import org.springframework.beans.factory.annotation.Autowired
  11. import org.springframework.http.HttpMethod
  12. import org.springframework.http.HttpRequest
  13. import org.springframework.http.server.ServerHttpRequest
  14. import org.springframework.ui.Model
  15. import org.springframework.web.bind.annotation.RequestBody
  16. import org.springframework.web.bind.annotation.RequestParam
  17.  
  18. @Controller
  19. @RequestMapping("/*")
  20. class RequestController @Autowired constructor(
  21. private val requestService: RequestService
  22. //al http: RequestType
  23. ) {
  24. @RequestMapping("/*")
  25. fun addRequest(address : ServerHttpRequest, http : HttpMethod, @RequestBody body: RequestBody ) {
  26. //val type = RequestType(http)
  27.  
  28. val ip = address.remoteAddress.toString()
  29. val query = body.toString()
  30. val request = Request(null, http, ip, query)
  31.  
  32. requestService.add(request)
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement