提交 fdba9b4d 编写于 作者: O o2null

Merge branch 'fix/context' into 'master'

proxy with queryString

See merge request o2oa/o2oa!1757
......@@ -12,16 +12,19 @@ public class Proxy extends ProxyServlet {
@Override
protected String rewriteTarget(HttpServletRequest request) {
String url = request.getRequestURL().toString();
return target(url, this.getServletConfig().getInitParameter("port"));
String parameter = request.getQueryString();
return target(url, parameter, this.getServletConfig().getInitParameter("port"));
}
private String target(String url, String port) {
private String target(String url, String parameter, String port) {
int x = StringUtils.indexOf(url, ":", 8);
int y = StringUtils.indexOf(url, "/", 8);
if ((x > 0) && (y > 0)) {
return url.substring(0, x) + port(url, port) + url.substring(y);
return url.substring(0, x) + port(url, port) + url.substring(y)
+ (StringUtils.isBlank(parameter) ? "" : "?" + parameter);
} else if (y > 0) {
return url.substring(0, y) + port(url, port) + url.substring(y);
return url.substring(0, y) + port(url, port) + url.substring(y)
+ (StringUtils.isBlank(parameter) ? "" : "?" + parameter);
} else {
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册