IDEMPIERE-3238:WebUIServlet deprecated? init.d/idempiere script not getting log message
override-web need more configuration to work https://www.eclipse.org/jetty/documentation/9.3.x/override-web-xml.html but it's not necessary now. just move code of WebUIServlet to LoggedSessionListener
This commit is contained in:
parent
2e4c0ce43f
commit
f63375a31f
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||
version="3.1">
|
||||
|
||||
<!-- //// -->
|
||||
<!-- ZK -->
|
||||
<servlet>
|
||||
<description>ZK loader for ZUML pages</description>
|
||||
<servlet-name>zkLoader</servlet-name>
|
||||
<servlet-class>
|
||||
org.adempiere.webui.session.WebUIServlet
|
||||
</servlet-class>
|
||||
<!-- Must. Specifies URI of the update engine (DHtmlUpdateServlet).
|
||||
It must be the same as <url-pattern> for the update engine.
|
||||
-->
|
||||
<init-param>
|
||||
<param-name>update-uri</param-name>
|
||||
<param-value>/zkau</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>compress</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>zkLoader</servlet-name>
|
||||
<url-pattern>*.zul</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>zkLoader</servlet-name>
|
||||
<url-pattern>*.zhtml</url-pattern>
|
||||
</servlet-mapping>
|
||||
<!-- //// -->
|
||||
</web-app>
|
|
@ -1,6 +1,9 @@
|
|||
package org.adempiere.webui;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
@ -9,14 +12,20 @@ import javax.servlet.http.HttpSessionEvent;
|
|||
import javax.servlet.http.HttpSessionListener;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.adempiere.util.ServerContextURLHandler;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.ServerStateChangeEvent;
|
||||
import org.compiere.model.ServerStateChangeListener;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
public class LoggedSessionListener implements HttpSessionListener, ServletContextListener, ServerStateChangeListener{
|
||||
private static Hashtable<String, HttpSession> AD_SessionList = new Hashtable<String, HttpSession>();
|
||||
private static CLogger logger = CLogger.getCLogger(LoggedSessionListener.class);
|
||||
|
||||
@Override
|
||||
public void sessionCreated(HttpSessionEvent evt) {
|
||||
|
@ -42,6 +51,36 @@ public class LoggedSessionListener implements HttpSessionListener, ServletContex
|
|||
@Override
|
||||
public void contextInitialized(ServletContextEvent arg0) {
|
||||
DestroyAllSession();
|
||||
|
||||
// bring from depricate class WebUIServlet
|
||||
/** Initialise context for the current thread*/
|
||||
Properties serverContext = new Properties();
|
||||
serverContext.put(ServerContextURLHandler.SERVER_CONTEXT_URL_HANDLER, new ServerContextURLHandler() {
|
||||
public void showURL(String url) {
|
||||
SessionManager.getAppDesktop().showURL(url, true);
|
||||
}
|
||||
});
|
||||
ServerContext.setCurrentInstance(serverContext);
|
||||
|
||||
String propertyFile = Ini.getFileName(false);
|
||||
File file = new File(propertyFile);
|
||||
if (!file.exists())
|
||||
{
|
||||
throw new IllegalStateException("idempiere.properties is not setup. PropertyFile="+propertyFile);
|
||||
}
|
||||
if (!Adempiere.isStarted())
|
||||
{
|
||||
boolean started = Adempiere.startup(false);
|
||||
if(!started)
|
||||
{
|
||||
throw new AdempiereException("Could not start iDempiere");
|
||||
}
|
||||
}
|
||||
|
||||
logger.log(Level.OFF, "context initialized");
|
||||
/**
|
||||
* End iDempiere Start
|
||||
*/
|
||||
}
|
||||
|
||||
public void DestroyAllSession() {
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: Posterita Ajax UI *
|
||||
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
|
||||
* or via info@posterita.org or http://www.posterita.org/ *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.adempiere.webui.session;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Ini;
|
||||
import org.zkoss.zk.ui.http.DHtmlLayoutServlet;
|
||||
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.adempiere.util.ServerContextURLHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
|
||||
* @date Feb 25, 2007
|
||||
* @version $Revision: 0.10 $
|
||||
*/
|
||||
public class WebUIServlet extends DHtmlLayoutServlet
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5625631664012999381L;
|
||||
/** Logger for the class * */
|
||||
private static CLogger logger;
|
||||
|
||||
public void init(ServletConfig servletConfig) throws ServletException
|
||||
{
|
||||
super.init(servletConfig);
|
||||
|
||||
/** Initialise context for the current thread*/
|
||||
Properties serverContext = new Properties();
|
||||
serverContext.put(ServerContextURLHandler.SERVER_CONTEXT_URL_HANDLER, new ServerContextURLHandler() {
|
||||
public void showURL(String url) {
|
||||
SessionManager.getAppDesktop().showURL(url, true);
|
||||
}
|
||||
});
|
||||
ServerContext.setCurrentInstance(serverContext);
|
||||
|
||||
String propertyFile = Ini.getFileName(false);
|
||||
File file = new File(propertyFile);
|
||||
if (!file.exists())
|
||||
{
|
||||
throw new IllegalStateException("idempiere.properties is not setup. PropertyFile="+propertyFile);
|
||||
}
|
||||
if (!Adempiere.isStarted())
|
||||
{
|
||||
boolean started = Adempiere.startup(false);
|
||||
if(!started)
|
||||
{
|
||||
throw new ServletException("Could not start iDempiere");
|
||||
}
|
||||
}
|
||||
|
||||
logger = CLogger.getCLogger(WebUIServlet.class);
|
||||
|
||||
logger.log(Level.OFF, "iDempiere Web Client started successfully");
|
||||
/**
|
||||
* End iDempiere Start
|
||||
*/
|
||||
}
|
||||
|
||||
protected void doGet(HttpServletRequest request,
|
||||
HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
super.doGet(request, response);
|
||||
}
|
||||
|
||||
protected void doPost(HttpServletRequest request,
|
||||
HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
|
||||
super.doPost(request, response);
|
||||
}
|
||||
|
||||
public void service(ServletRequest request, ServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
super.service(request, response);
|
||||
}
|
||||
|
||||
public ServletConfig getServletConfig()
|
||||
{
|
||||
return super.getServletConfig();
|
||||
}
|
||||
|
||||
public String getServletInfo()
|
||||
{
|
||||
return super.getServletInfo();
|
||||
}
|
||||
|
||||
public void destroy()
|
||||
{
|
||||
super.destroy();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue