Merge pull request #1395 from dataease/pr@v1.5@fix_iframe_public_link

fix: 第三方iframe嵌入公共链接
This commit is contained in:
fit2cloud-chenyw 2021-12-06 11:06:42 +08:00 committed by GitHub
commit e509c020cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Controller
@RequestMapping
@ -45,13 +46,14 @@ public class IndexController {
}
@GetMapping("/link/{index}")
public String link(@PathVariable(value = "index", required = true) Long index) {
public void link(@PathVariable(value = "index", required = true) Long index) {
String url = panelLinkService.getUrlByIndex(index);
HttpServletResponse response = ServletUtils.response();
String param = url.substring(url.indexOf("?") + 1);
Cookie cookie = new Cookie("link", param.split("=")[1]);
response.addCookie(cookie);
return url;
try {
response.sendRedirect(url);
} catch (IOException e) {
e.printStackTrace();
}
}