zoukankan      html  css  js  c++  java
  • Jetty Struts2 Result ‘Null’ Not Found


    OGNL会执行执行安全检测,但是并不被GAE所支持,解决方法是创建一个监听器,将安全检查处理器置空



    OgnlRuntime.setSecurityManager(null);


    web.xml添加

    <listener>
    		<listener-class>com.llx.gps.listener.Struts2ListenerOnGAE</listener-class>
    	</listener>
    package com.llx.gps.listener;
    
    import javax.servlet.ServletContextEvent;
    import javax.servlet.ServletContextListener;
    import javax.servlet.http.HttpSessionAttributeListener;
    import javax.servlet.http.HttpSessionBindingEvent;
    import javax.servlet.http.HttpSessionEvent;
    import javax.servlet.http.HttpSessionListener;
    
    import ognl.OgnlRuntime;
    
    public class Struts2ListenerOnGAE implements ServletContextListener, HttpSessionListener, HttpSessionAttributeListener {
    
    	public void contextInitialized(ServletContextEvent sce) {
    		OgnlRuntime.setSecurityManager(null);
    	}
    
    	@Override
    	public void contextDestroyed(ServletContextEvent arg0) {
    		// TODO Auto-generated method stub
    
    	}
    
    	@Override
    	public void sessionCreated(HttpSessionEvent arg0) {
    		// TODO Auto-generated method stub
    
    	}
    
    	@Override
    	public void sessionDestroyed(HttpSessionEvent arg0) {
    		// TODO Auto-generated method stub
    
    	}
    
    	@Override
    	public void attributeAdded(HttpSessionBindingEvent arg0) {
    		// TODO Auto-generated method stub
    
    	}
    
    	@Override
    	public void attributeRemoved(HttpSessionBindingEvent arg0) {
    		// TODO Auto-generated method stub
    
    	}
    
    	@Override
    	public void attributeReplaced(HttpSessionBindingEvent arg0) {
    		// TODO Auto-generated method stub
    
    	}
    
    }
    


  • 相关阅读:
    程序员修炼之道阅读笔记1
    构建之法阅读笔记6
    构建之法阅读笔记5
    构建之法阅读笔记4
    构建之法阅读笔记3
    构建之法阅读笔记2
    关于搜狗输入法的评价
    找水王
    用户场景
    个人工作总结
  • 原文地址:https://www.cnblogs.com/bbsno1/p/3260617.html
Copyright © 2011-2022 走看看