|
|
@@ -14,6 +14,7 @@ import javax.servlet.ServletResponse;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import org.apache.log4j.Logger;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
|
|
import org.springframework.web.context.support.XmlWebApplicationContext;
|
|
|
@@ -23,12 +24,19 @@ import org.springframework.web.context.support.XmlWebApplicationContext;
|
|
|
* @author liusw
|
|
|
*/
|
|
|
public class KeyWordFilter implements Filter {
|
|
|
+
|
|
|
public static Set<String> keyworsSet = null;
|
|
|
|
|
|
+ /**
|
|
|
+ * hessian 请求路径前缀
|
|
|
+ */
|
|
|
+ private static String HESSIAN_URI_PREFIX = "/api/service/";
|
|
|
+
|
|
|
+ private Logger logger = Logger.getLogger(this.getClass());
|
|
|
+
|
|
|
@Override
|
|
|
public void destroy() {
|
|
|
// TODO Auto-generated method stub
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -40,8 +48,11 @@ public class KeyWordFilter implements Filter {
|
|
|
response.setContentType("application/json; charset=utf-8");
|
|
|
String contentType = req.getContentType();
|
|
|
String method = req.getMethod();
|
|
|
- // POST请求 或 PUT请求,并且不是附件上传请求
|
|
|
- if(("POST".equals(method) || "PUT".equals(method)) && (StringUtils.isEmpty(contentType) || !contentType.contains("multipart"))){
|
|
|
+ String uri = req.getRequestURI();
|
|
|
+ // POST请求 或 PUT请求,并且不是附件上传请求,并且不是hessian请求
|
|
|
+ if(("POST".equals(method) || "PUT".equals(method)) &&
|
|
|
+ (StringUtils.isEmpty(contentType) || !contentType.contains("multipart")) &&
|
|
|
+ !uri.startsWith(HESSIAN_URI_PREFIX)){
|
|
|
//注入Service
|
|
|
ServletContext sc = req.getSession().getServletContext();
|
|
|
XmlWebApplicationContext cxt = (XmlWebApplicationContext) WebApplicationContextUtils.getWebApplicationContext(sc);
|