mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
1.7.1
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-gateway-common</artifactId>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
<version>1.7.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud zuul ↓↓↓ -->
|
||||
|
@@ -0,0 +1,31 @@
|
||||
package com.gitee.sop.gateway;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.SopConstants;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author tanghc
|
||||
*/
|
||||
@Controller
|
||||
public class RedirectController {
|
||||
|
||||
@Value("${zuul.servlet-path}")
|
||||
private String path;
|
||||
|
||||
@RequestMapping("/{method}/{version}/")
|
||||
public String redirect(
|
||||
@PathVariable("method") String method
|
||||
, @PathVariable("version") String version
|
||||
, HttpServletRequest request
|
||||
) {
|
||||
request.setAttribute(SopConstants.REDIRECT_METHOD_KEY, method);
|
||||
request.setAttribute(SopConstants.REDIRECT_VERSION_KEY, version);
|
||||
return "forward:" + path;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user