|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
package kr.xit.ens.ktgbs.web;
|
|
|
|
|
|
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.media.Content;
|
|
|
|
@ -14,6 +12,14 @@ import kr.xit.biz.ens.model.ktgbs.KtGbsDTO;
|
|
|
|
|
import kr.xit.biz.ktgbs.service.IBizKtGbsService;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <pre>
|
|
|
|
|
* description : KT GBIS 에서 사용 되는 API
|
|
|
|
@ -78,4 +84,44 @@ public class KtGbsInboundController {
|
|
|
|
|
public KtCommonDTO.KtCommonResponse messageResult(@RequestBody final KtGbsDTO.MsgRsltRequest reqDTO) {
|
|
|
|
|
return bizService.messageResult(reqDTO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "링크이미지 출력")
|
|
|
|
|
@GetMapping(value = "/goji/sys/util/lnk/img")
|
|
|
|
|
public void printImg(HttpServletRequest request, HttpServletResponse response, @RequestParam String link, @RequestParam String type) throws IOException {
|
|
|
|
|
|
|
|
|
|
String mime = null;
|
|
|
|
|
if ("jpg".equals(type) || "jpeg".equals(type))
|
|
|
|
|
mime = "image/jpeg";
|
|
|
|
|
else if ("png".equals(type))
|
|
|
|
|
mime = "image/png";
|
|
|
|
|
else if ("gif".equals(type))
|
|
|
|
|
mime = "image/gif";
|
|
|
|
|
else
|
|
|
|
|
mime = "image/jpeg";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (InputStream inputStream = new URL(link).openStream();
|
|
|
|
|
ServletOutputStream outputStream = response.getOutputStream();) {
|
|
|
|
|
|
|
|
|
|
response.setHeader("Cache-Control", "no-store");
|
|
|
|
|
response.setHeader("Pragma", "no-cache");
|
|
|
|
|
response.setDateHeader("Expires", 0);
|
|
|
|
|
response.setContentType(mime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int length;
|
|
|
|
|
byte[] buffer = new byte[1024];
|
|
|
|
|
while ((length = inputStream.read(buffer)) != -1) {
|
|
|
|
|
outputStream.write(buffer, 0, length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
|
|
|
|
|
} catch (FileNotFoundException e) {
|
|
|
|
|
response.getWriter().println("File is Not Found." + e.getMessage());
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
response.getWriter().println("I/O Error Occurred!!. " + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|