From 87ddfa51002bc93ac20b5740108dd290985aff9c Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Fri, 12 Jun 2026 14:36:44 +0900 Subject: [PATCH] =?UTF-8?q?260612=5F06=5FENH:=20redirect=20=EC=99=B8?= =?UTF-8?q?=EC=97=90=EB=8F=84=20url=EC=9D=84=20=EB=B0=9B=EC=95=84=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EB=82=B4=EC=9A=A9=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kri/shorturl/controller/ShortUrlController.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/kri/shorturl/controller/ShortUrlController.java b/src/main/java/com/kri/shorturl/controller/ShortUrlController.java index e6cb25c..7f50b7e 100644 --- a/src/main/java/com/kri/shorturl/controller/ShortUrlController.java +++ b/src/main/java/com/kri/shorturl/controller/ShortUrlController.java @@ -6,7 +6,6 @@ import com.kri.shorturl.dto.ShortUrlCreateRequestDto; import com.kri.shorturl.service.ShortUrlService; import io.swagger.v3.oas.annotations.tags.Tag; import java.net.URI; -import java.time.LocalDate; import java.time.LocalDateTime; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @@ -19,7 +18,6 @@ import org.springframework.web.bind.annotation.RequestBody; 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") @@ -29,6 +27,16 @@ public class ShortUrlController { private final ShortUrlService shortUrlService; + @GetMapping("/{shortKey}") + public String getRedirectUrl( + @PathVariable String shortKey, + @RequestParam MultiValueMap params + ) { + URI redirectUri = shortUrlService.getRedirectUri(shortKey, params); + + return redirectUri.toString(); + } + @GetMapping("/redirect/{shortKey}") public ResponseEntity redirectShortUrl( @PathVariable String shortKey,