add jquery para filter and id interceptor

master
lyf666 2017-02-19 09:55:17 +08:00
parent 4c7510ae60
commit 35edf90002
3 changed files with 39 additions and 1 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.cloudowr</groupId> <groupId>cn.cloudowr</groupId>
<artifactId>sdk</artifactId> <artifactId>sdk</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.1.0</version>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -0,0 +1,20 @@
package cn.cloudowr.sdk;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
/**
* Created by lyf66 on 2017/2/16.
*/
public class IdInterceptor implements Interceptor {
@Override
public void intercept(Invocation inv) {
String id = inv.getController().getPara("id");
if (id != null && !id.isEmpty()) {
inv.invoke();
} else {
inv.getController().renderError(400);
}
}
}

View File

@ -0,0 +1,18 @@
package cn.cloudowr.sdk;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import java.util.Map;
/**
* Created by lyf66 on 2017/2/19.
*/
public class JQueryParameterFilter implements Interceptor{
@Override
public void intercept(Invocation inv) {
Map<String, String[]> paraMap = inv.getController().getParaMap();
paraMap.remove("_");
inv.invoke();
}
}