260609_01_ENH: 단축 url 테스트

This commit is contained in:
2026-06-09 17:36:14 +09:00
parent 7881ac8433
commit b601c3fce8
3 changed files with 46 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ repositories {
}
dependencies {
implementation "com.kri.common:starter:beta.1.1.13"
implementation "com.kri.common:starter:beta.1.1.23"
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'

View File

@@ -0,0 +1,45 @@
package com.kri.intranet.extension.controller;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.net.URI;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriComponentsBuilder;
@RestController
@RequestMapping("/api/v1/short-url")
@RequiredArgsConstructor
@Tag(name = "ShortUrl", description = "단축 URL API")
public class ShortUrlController {
@PostMapping("/{shortKey}")
public ResponseEntity<Void> redirectShortUrl(
@PathVariable String shortKey,
@RequestParam MultiValueMap<String, String> params
) {
//String targetUrl = shortUrlService.findTargetUrl(shortKey);
String targetUrl = "https://kon.kric.com/project/2606002_A/INDEX.asp";
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(targetUrl);
params.forEach((key, values) -> {
for (String value : values) {
builder.queryParam(key, value);
}
});
URI redirectUri = builder.build(true).toUri();
return ResponseEntity
.status(HttpStatus.FOUND)
.location(redirectUri)
.build();
}
}

View File

@@ -30,8 +30,6 @@ kri:
# 내부 운영용(원하면)
admin-api-enabled: true
admin-allow-ips:
- 127.0.0.1/32
- 0:0:0:0:0:0:0:1
- 211.254.145.130/32
# apikey 보관 DB(MySQL)
db:
@@ -60,8 +58,6 @@ kri:
web:
enabled: true # 공통 Web 구성 사용 여부 (기본 true)
webmvc:
enabled: true # 공통 Webmvc 구성 사용 여부 (기본 true)
redis:
enabled: false # RedisQueueHelper 사용 시 true
scheduling: