Skip to content

Commit

Permalink
fix(comet): Fixed request parameter has unreadable code problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
yizzuide committed Apr 24, 2020
1 parent 7ca67b8 commit 320f272
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.Charset;

/**
* CometRequestFilter
Expand All @@ -29,6 +30,8 @@ public void init(FilterConfig filterConfig) {

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
// 设置编码,防止Spring MVC注册Filter顺序问题导致乱码问题
servletRequest.setCharacterEncoding(Charset.defaultCharset().toString());
ServletRequest requestWrapper = servletRequest;
// 如果有Form表单数据则不读取body,交给SpringMVC框架处理(但@CometParam功能仍然有效)
if (CollectionUtils.isEmpty(servletRequest.getParameterMap())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ public void copyBodyToResponse() throws IOException {
* Copy the cached body content to the response.
* @param complete whether to set a corresponding content length
* for the complete cached body content
* @throws IOException Socket IO exception
*/
protected void copyBodyToResponse(boolean complete) throws IOException {
if (this.content.size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public interface Ice {
* @param body 业务数据
* @param delay 延迟时间
* @param <T> 业务数据类型
* @return Job
* @since 3.0.9
*/
<T> Job<T> build(String id, String topic, T body, Duration delay);
Expand All @@ -68,6 +69,7 @@ public interface Ice {
* @param body 业务数据
* @param delay 延迟时间ms
* @param <T> 业务数据类型
* @return Job
* @since 3.0.9
*/
<T> Job<T> build(String id, String topic, T body, long delay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* TTR重试超载监听器
*
* <pre>
* 通过配置 {@link IceProperties#isEnableJobTimerDistributed()} 配合Dead queue的使用有以下情况:
* 通过配置 `ice.enable-job-timer-distributed` 配合Dead queue的使用有以下情况:
* 1. TTR重试超载监听器未添加或执行失败 + 未开启Dead queue:通过计算延迟因子继续重试,并有错误级别的日志打印
* 2. TTR重试超载监听器未添加或执行失败 + 开启Dead queue:延迟任务进入Dead queue,原数据保留
* 3. TTR重试超载监听器执行成功 + 未开启Dead queue:延迟任务和原数据都将被移除
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public static String extractValue(JoinPoint joinPoint, String express) {
* @param <T> 包装对象类型
* @throws IllegalAccessException 非法访问异常
* @throws InvocationTargetException 方法调用异常
* @return 返回原有值
*/
public static <T> Object invokeWithWrapperInject(Object target, Method method, List<T> wrapperList, Class<T> wrapperClazz, Function<T, Object> wrapperBody, BiConsumer<T, Object> wipeWrapperBody) throws IllegalAccessException, InvocationTargetException {
// 没有参数
Expand Down

0 comments on commit 320f272

Please sign in to comment.