org.nofdev.servicefacade.ServiceController.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of service-host-mvc Show documentation
Show all versions of service-host-mvc Show documentation
The server side componet of Nofdev RPC framework
package org.nofdev.servicefacade
import com.fasterxml.jackson.core.JsonProcessingException
import com.fasterxml.jackson.databind.JavaType
import com.fasterxml.jackson.databind.ObjectMapper
import groovy.transform.CompileStatic
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.aop.framework.AopProxyUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.stereotype.Service
import org.springframework.util.ReflectionUtils
import org.springframework.web.bind.annotation.*
import java.lang.reflect.Method
import java.lang.reflect.Type
/**
* Created by wangxuesong on 15/8/14.
*/
@RestController
@RequestMapping("/service")
@CompileStatic
public class ServiceController {
private static final Logger logger = LoggerFactory.getLogger(ServiceController.class);
@Autowired
private ExceptionSettings excepitonSettings;
@Autowired
private ApplicationContext context;
@Autowired
private ObjectMapper objectMapper
@RequestMapping("json/{packageName}/{interfaceName}/{methodName}")
public ResponseEntity json(@PathVariable String packageName,
@PathVariable String interfaceName,
@PathVariable String methodName,
@RequestParam(value = "params", required = false) String params,
@RequestHeader(required = false) Map header) {
def serviceContext = ServiceContextHolder.serviceContext
HttpJsonResponse