Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.instaloper.internship.logger.frontend.controller
- import com.instaloper.internship.logger.model.Request
- import com.instaloper.internship.logger.model.RequestType
- import com.instaloper.internship.logger.service.RequestService
- import org.springframework.stereotype.Controller
- import org.springframework.web.bind.annotation.RequestMapping
- import org.slf4j.Logger
- import org.slf4j.LoggerFactory
- import org.springframework.beans.factory.annotation.Autowired
- import org.springframework.http.HttpMethod
- import org.springframework.http.HttpRequest
- import org.springframework.http.server.ServerHttpRequest
- import org.springframework.ui.Model
- import org.springframework.web.bind.annotation.RequestBody
- import org.springframework.web.bind.annotation.RequestParam
- @Controller
- @RequestMapping("/*")
- class RequestController @Autowired constructor(
- private val requestService: RequestService
- //al http: RequestType
- ) {
- @RequestMapping("/*")
- fun addRequest(address : ServerHttpRequest, http : HttpMethod, @RequestBody body: RequestBody ) {
- //val type = RequestType(http)
- val ip = address.remoteAddress.toString()
- val query = body.toString()
- val request = Request(null, http, ip, query)
- requestService.add(request)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement