歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

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

 }

}

Jetty 的詳細介紹:請點這裡
Jetty 的下載地址:請點這裡

Copyright © Linux教程網 All Rights Reserved