mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
优化参数绑定
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.gitee.sop.gateway.controller;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.SopConstants;
|
||||
import com.gitee.sop.gatewaycommon.param.ParamNames;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -29,7 +31,14 @@ public class RedirectController {
|
||||
) throws ServletException, IOException {
|
||||
request.setAttribute(SopConstants.REDIRECT_METHOD_KEY, method);
|
||||
request.setAttribute(SopConstants.REDIRECT_VERSION_KEY, version);
|
||||
request.getRequestDispatcher(path).forward(request, response);
|
||||
String queryString = request.getQueryString();
|
||||
String versionQuery = ParamNames.VERSION_NAME + '=' + version;
|
||||
if (StringUtils.isBlank(queryString)) {
|
||||
queryString = versionQuery;
|
||||
} else {
|
||||
queryString = queryString + '&' + versionQuery;
|
||||
}
|
||||
request.getRequestDispatcher(path + '?' + queryString).forward(request, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user