
cn.zfs.swaggerui.controller.SwaggerController Maven / Gradle / Ivy
package cn.zfs.swaggerui.controller;
import cn.zfs.swaggerui.util.HttpClientUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URISyntaxException;
/**
* @className: SwaggerController
* @author: ZFS
* @date: 2018/10/10 18:50
*/
@Slf4j
@RestController
public class SwaggerController {
@Autowired
HttpClientUtils httpClientUtils;
/**
* swagger 基础API访问
*
* @param agreement 协议
* @param domain 域名
* @param port 端口号
* @param path 访问路径
* @param request 请求
* @param response 响应
* @return string
* @throws IOException IOException
*/
@GetMapping("getBasic")
public String getBasic(@RequestParam(required = false, defaultValue = "http") String agreement,
@RequestParam(required = true, defaultValue = "localhost") String domain,
@RequestParam(required = false, defaultValue = "80") String port,
@RequestParam(required = true, defaultValue = "/") String path,
@RequestParam(required = true, defaultValue = "GET") String method,
@RequestParam(required = true, defaultValue = "") String param,
HttpServletRequest request, HttpServletResponse response) throws IOException, URISyntaxException {
return httpClientUtils.requestUrl(agreement, domain, port, path, method, param, request, response);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy