Adempiere 3.1.2
This commit is contained in:
parent
64eca30fca
commit
43c7859095
|
|
@ -3,59 +3,67 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AdRedirector will forward the Ad Request to the destination URL and log the request
|
* AdRedirector will forward the Ad Request to the destination URL and log the request
|
||||||
* @author Yves Sandfort
|
* @author Yves Sandfort
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class AdRedirector extends HttpServletCM
|
public class AdRedirector extends HttpServletCM
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Get request
|
* Process the HTTP Get request
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
if (request.getParameter("CM_Ad_ID")!=null) {
|
if (request.getParameter("CM_Ad_ID")!=null) {
|
||||||
try {
|
try {
|
||||||
String CM_Ad_ID = request.getParameter("CM_Ad_ID");
|
String CM_Ad_ID = request.getParameter("CM_Ad_ID");
|
||||||
MAd thisAd = new MAd(ctx, Integer.parseInt(CM_Ad_ID), "webCM");
|
MAd thisAd = new MAd(ctx, Integer.parseInt(CM_Ad_ID), "webCM");
|
||||||
thisAd.addClick(request);
|
thisAd.addClick(request);
|
||||||
response.sendRedirect(thisAd.getTargetURL());
|
response.sendRedirect(thisAd.getTargetURL());
|
||||||
} catch (Exception E) {
|
} catch (Exception E) {
|
||||||
response.sendError(500, "Internal Error while processing Ad Redirect...");
|
response.sendError(500, "Internal Error while processing Ad Redirect...");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response.sendError(500,"Unknown or illegal Ad set, can't handle request...");
|
response.sendError(500,"Unknown or illegal Ad set, can't handle request...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Post request
|
* Process the HTTP Post request
|
||||||
* to simplify we reuse the doGet functionality
|
* to simplify we reuse the doGet functionality
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet(request, response);
|
doGet(request, response);
|
||||||
} // doPost
|
} // doPost
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,154 +3,152 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
import org.compiere.cm.utils.*;
|
import org.compiere.cm.utils.*;
|
||||||
import org.compiere.cm.xml.*;
|
import org.compiere.cm.xml.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast Servlet This servlet normally does Page processing for all pages,
|
* Broadcast Servlet This servlet normally does Page processing for all pages,
|
||||||
* so it creates context etc.
|
* so it creates context etc.
|
||||||
*
|
*
|
||||||
* @author Yves Sandfort
|
* @author Yves Sandfort
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class Broadcast extends HttpServletCM
|
public class Broadcast extends HttpServletCM
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Get Request
|
* Process Get Request
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
// Create New Session
|
// Create New Session
|
||||||
HttpSession sess = request.getSession (true);
|
HttpSession sess = request.getSession (true);
|
||||||
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
||||||
StringBuffer output = new StringBuffer ();
|
StringBuffer output = new StringBuffer ();
|
||||||
// Check whether internalMediaURL is build up, otherwise create it. (can
|
// We will reset the Media URL for each request. Should be moved in the session.
|
||||||
// be started only from a servlet!)
|
resetInternalMediaURL (request);
|
||||||
if (getInternalMediaURL () == null)
|
|
||||||
setInternalMediaURL (request);
|
|
||||||
if (configLoaded && !fatalError)
|
if (configLoaded && !fatalError)
|
||||||
{
|
{
|
||||||
String acceptLanguage = request.getHeader ("Accept-Language");
|
String acceptLanguage = request.getHeader ("Accept-Language");
|
||||||
String acceptCharset = request.getHeader ("Accept-Charset");
|
String acceptCharset = request.getHeader ("Accept-Charset");
|
||||||
LocaleHandler lhandler = new LocaleHandler (acceptLanguage,
|
LocaleHandler lhandler = new LocaleHandler (acceptLanguage,
|
||||||
acceptCharset);
|
acceptCharset);
|
||||||
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
||||||
false, "");
|
false, "");
|
||||||
StringBuffer xmlCode = new StringBuffer();
|
StringBuffer xmlCode = new StringBuffer();
|
||||||
StringBuffer xmlAppend = new StringBuffer();
|
StringBuffer xmlAppend = new StringBuffer();
|
||||||
|
|
||||||
// Fill up ExternalMediaURL
|
// Fill up ExternalMediaURL
|
||||||
//if (externalMediaURL == null) {
|
//if (externalMediaURL == null) {
|
||||||
if (thisRequest.getWebProject()!=null)
|
if (thisRequest.getWebProject()!=null)
|
||||||
externalMediaURL = getExternalMediaURL (thisRequest
|
externalMediaURL = getExternalMediaURL (thisRequest
|
||||||
.getWebProject ().get_ID ());
|
.getWebProject ().get_ID ());
|
||||||
else
|
else
|
||||||
externalMediaURL = getInternalMediaURL();
|
externalMediaURL = getInternalMediaURL();
|
||||||
//}
|
//}
|
||||||
sess.setAttribute ("ctx", getCtx());
|
sess.setAttribute ("ctx", getCtx());
|
||||||
// This Request has a Processor Class Name, so we should process it!
|
// This Request has a Processor Class Name, so we should process it!
|
||||||
if (thisRequest.getProcClassName ()!=null) {
|
if (thisRequest.getProcClassName ()!=null) {
|
||||||
try {
|
try {
|
||||||
org.compiere.cm.Extend thisProcessor = thisRequest.getProcClass();
|
org.compiere.cm.Extend thisProcessor = thisRequest.getProcClass();
|
||||||
thisProcessor.doIt ();
|
thisProcessor.doIt ();
|
||||||
xmlAppend.append(thisProcessor.getXML());
|
xmlAppend.append(thisProcessor.getXML());
|
||||||
if (thisProcessor.getRedirectURL()!=null)
|
if (thisProcessor.getRedirectURL()!=null)
|
||||||
thisRequest.setRedirectURL(thisProcessor.getRedirectURL());
|
thisRequest.setRedirectURL(thisProcessor.getRedirectURL());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ex.printStackTrace ();
|
ex.printStackTrace ();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (thisRequest.getIsRedirect ())
|
if (thisRequest.getIsRedirect ())
|
||||||
{
|
{
|
||||||
// If we need to redirect as the URL is different do it beofre
|
// If we need to redirect as the URL is different do it beofre
|
||||||
// we transmit to client
|
// we transmit to client
|
||||||
response.sendRedirect (thisRequest.getRedirectURL ());
|
response.sendRedirect (thisRequest.getRedirectURL ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No need to redirect so we will display the content
|
// No need to redirect so we will display the content
|
||||||
// Generate the needed XMLCode
|
// Generate the needed XMLCode
|
||||||
Generator thisXMLGen = new Generator (this, request,
|
Generator thisXMLGen = new Generator (this, request,
|
||||||
thisRequest, xmlAppend);
|
thisRequest, xmlAppend);
|
||||||
xmlCode.append(thisXMLGen.get ());
|
xmlCode.append(thisXMLGen.get ());
|
||||||
// Get or generate Template needed
|
// Get or generate Template needed
|
||||||
String xslCode = templateCache.getCM_Template (
|
String xslCode = templateCache.getCM_Template (
|
||||||
thisRequest.getCM_Container ().getCM_Template_ID (),
|
thisRequest.getCM_Container ().getCM_Template_ID (),
|
||||||
thisRequest.getWebProject ().get_ID ())
|
thisRequest.getWebProject ().get_ID ())
|
||||||
.getPreBuildTemplate ().toString ();
|
.getPreBuildTemplate ().toString ();
|
||||||
// Put it all together
|
// Put it all together
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
output.append (XSLTProcessor.run (request, xslCode, xmlCode.toString()));
|
output.append (XSLTProcessor.run (request, xslCode, xmlCode.toString()));
|
||||||
}
|
}
|
||||||
catch (Exception E)
|
catch (Exception E)
|
||||||
{
|
{
|
||||||
response.sendError (500);
|
response.sendError (500);
|
||||||
}
|
}
|
||||||
// response.setContentType("text/html; charset=" +
|
// response.setContentType("text/html; charset=" +
|
||||||
// lhandler.getCharset());
|
// lhandler.getCharset());
|
||||||
response.setContentType ("text/html; charset=UTF-8");
|
response.setContentType ("text/html; charset=UTF-8");
|
||||||
response.setHeader ("CMBuild", buildDate);
|
response.setHeader ("CMBuild", buildDate);
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
out = response.getWriter ();
|
out = response.getWriter ();
|
||||||
out.print (output.toString ());
|
out.print (output.toString ());
|
||||||
out.close ();
|
out.close ();
|
||||||
|
|
||||||
if (thisRequest.getWebProject()!=null) {
|
if (thisRequest.getWebProject()!=null) {
|
||||||
// We will log the request in a seperate task to speed up page display
|
// We will log the request in a seperate task to speed up page display
|
||||||
AccessLogger thisAccessLogger = new AccessLogger(request, this, thisRequest);
|
AccessLogger thisAccessLogger = new AccessLogger(request, this, thisRequest);
|
||||||
thisAccessLogger.setFileSize(new java.math.BigDecimal(output.length()));
|
thisAccessLogger.setFileSize(new java.math.BigDecimal(output.length()));
|
||||||
thisAccessLogger.start();
|
thisAccessLogger.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fatalError)
|
else if (fatalError)
|
||||||
{
|
{
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
out = response.getWriter ();
|
out = response.getWriter ();
|
||||||
out.print ("<H1>Fatal Error:" + ErrorMessage + "</H1>");
|
out.print ("<H1>Fatal Error:" + ErrorMessage + "</H1>");
|
||||||
out.close ();
|
out.close ();
|
||||||
}
|
}
|
||||||
} // doGet
|
} // doGet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Post Request (handled by get)
|
* Process Post Request (handled by get)
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet (request, response);
|
doGet (request, response);
|
||||||
} // doPost
|
} // doPost
|
||||||
} // Broadcast
|
} // Broadcast
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* 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
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
* You should have received a copy of the GNU General Public License along
|
* 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.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||||
|
|
@ -22,84 +22,84 @@ import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.*;
|
||||||
import org.compiere.cm.utils.*;
|
import org.compiere.cm.utils.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Community Servlet to handle login, BPartner create & Update etc.
|
* Community Servlet to handle login, BPartner create & Update etc.
|
||||||
*
|
*
|
||||||
* @author Yves Sandfort
|
* @author Yves Sandfort
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class Community extends HttpServletCM
|
public class Community extends HttpServletCM
|
||||||
{
|
{
|
||||||
/** Logging */
|
/** Logging */
|
||||||
private CLogger log = CLogger.getCLogger(getClass());
|
private CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Get Request
|
* Process Get Request
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
HttpSession sess = request.getSession (true);
|
HttpSession sess = request.getSession (true);
|
||||||
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
||||||
|
|
||||||
Properties ctx = getCtx();
|
ctx = getCtx();
|
||||||
|
|
||||||
if (sess.getAttribute ("ctx")!=null)
|
if (sess.getAttribute ("ctx")!=null)
|
||||||
ctx = (Properties) sess.getAttribute ("ctx");
|
ctx = (Properties) sess.getAttribute ("ctx");
|
||||||
|
|
||||||
if (ctx.get ("#AD_Client_ID")!=null) {
|
if (ctx.get ("#AD_Client_ID")!=null) {
|
||||||
RequestAnalyzer thisRequest = new RequestAnalyzer(this, request, false, null);
|
RequestAnalyzer thisRequest = new RequestAnalyzer(this, request, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WebSessionCtx wsc = (WebSessionCtx)sess.getAttribute(WebSessionCtx.NAME);
|
WebSessionCtx wsc = (WebSessionCtx)sess.getAttribute(WebSessionCtx.NAME);
|
||||||
// Create New
|
// Create New
|
||||||
if (wsc == null)
|
if (wsc == null)
|
||||||
{
|
{
|
||||||
int [] allIDs = X_W_Store.getAllIDs ("W_Store", "AD_Client_ID=" + ctx.get ("#AD_Client_ID"), "");
|
int [] allIDs = X_W_Store.getAllIDs ("W_Store", "AD_Client_ID=" + ctx.get ("#AD_Client_ID"), "");
|
||||||
if (allIDs!=null && allIDs.length>0)
|
if (allIDs!=null && allIDs.length>0)
|
||||||
{
|
{
|
||||||
wsc = WebSessionCtx.get(request, allIDs[0]);
|
wsc = WebSessionCtx.get(request, allIDs[0]);
|
||||||
wsc.setWStore (allIDs[0]);
|
wsc.setWStore (allIDs[0]);
|
||||||
sess.setAttribute(WebSessionCtx.NAME, wsc);
|
sess.setAttribute(WebSessionCtx.NAME, wsc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WebLogin thisLogin = new WebLogin(request, response, ctx);
|
WebLogin thisLogin = new WebLogin(request, response, ctx);
|
||||||
thisLogin.init ();
|
thisLogin.init ();
|
||||||
if (!thisLogin.action ())
|
if (!thisLogin.action ())
|
||||||
{
|
{
|
||||||
WebUtil.reload(thisLogin.getMessage(), thisLogin.getUpdate_page (), sess, request, response, getServletContext());
|
WebUtil.reload(thisLogin.getMessage(), thisLogin.getUpdate_page (), sess, request, response, getServletContext());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String url = thisLogin.getForward ();
|
String url = thisLogin.getForward ();
|
||||||
if (!url.startsWith("/"))
|
if (!url.startsWith("/"))
|
||||||
url = "/" + url;
|
url = "/" + url;
|
||||||
log.info("doPost - Forward to " + url);
|
log.info("doPost - Forward to " + url);
|
||||||
response.sendRedirect (url);
|
response.sendRedirect (url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Post Request (handled by get)
|
* Process Post Request (handled by get)
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet (request, response);
|
doGet (request, response);
|
||||||
} // doPost
|
} // doPost
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* 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
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
* You should have received a copy of the GNU General Public License along
|
* 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.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||||
|
|
@ -15,104 +15,105 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Yves Sandfort
|
* @author Yves Sandfort
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public abstract class Extend implements Serializable
|
public abstract class Extend implements Serializable
|
||||||
{
|
{
|
||||||
protected HttpServletRequest e_request;
|
protected HttpServletRequest e_request;
|
||||||
protected HttpSession e_session;
|
protected HttpSession e_session;
|
||||||
protected Properties ctx;
|
protected Properties ctx;
|
||||||
protected WebInfo wi = null;
|
protected WebInfo wi = null;
|
||||||
private StringBuffer e_xmlCode;
|
private StringBuffer e_xmlCode;
|
||||||
private String e_redirectURL;
|
private String e_redirectURL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend
|
* Extend
|
||||||
* @param request
|
* @param request
|
||||||
|
* @param t_ctx
|
||||||
*/
|
*/
|
||||||
public Extend (HttpServletRequest request, Properties t_ctx) {
|
public Extend (HttpServletRequest request, Properties t_ctx) {
|
||||||
ctx = t_ctx;
|
ctx = t_ctx;
|
||||||
e_request = request;
|
e_request = request;
|
||||||
e_session = request.getSession();
|
e_session = request.getSession();
|
||||||
if (e_session.getAttribute (WebInfo.NAME)!=null)
|
if (e_session.getAttribute (WebInfo.NAME)!=null)
|
||||||
{
|
{
|
||||||
wi = (WebInfo) e_session.getAttribute (WebInfo.NAME);
|
wi = (WebInfo) e_session.getAttribute (WebInfo.NAME);
|
||||||
}
|
}
|
||||||
e_xmlCode = new StringBuffer();
|
e_xmlCode = new StringBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set XML Code
|
* set XML Code
|
||||||
* @param xmlCode
|
* @param xmlCode
|
||||||
*/
|
*/
|
||||||
protected void setXML(StringBuffer xmlCode)
|
protected void setXML(StringBuffer xmlCode)
|
||||||
{
|
{
|
||||||
e_xmlCode = xmlCode;
|
e_xmlCode = xmlCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* append XML Code
|
* append XML Code
|
||||||
* @param xmlCode String containing XMLCode
|
* @param xmlCode String containing XMLCode
|
||||||
*/
|
*/
|
||||||
public void appendXML(String xmlCode)
|
public void appendXML(String xmlCode)
|
||||||
{
|
{
|
||||||
e_xmlCode.append(xmlCode);
|
e_xmlCode.append(xmlCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* append XML Code
|
* append XML Code
|
||||||
* @param xmlCode Stringbuffer containing XMLCode
|
* @param xmlCode Stringbuffer containing XMLCode
|
||||||
*/
|
*/
|
||||||
public void appendXML(StringBuffer xmlCode)
|
public void appendXML(StringBuffer xmlCode)
|
||||||
{
|
{
|
||||||
e_xmlCode.append(xmlCode);
|
e_xmlCode.append(xmlCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get XML Code
|
* get XML Code
|
||||||
* @returns xmlCode
|
* @returns xmlCode
|
||||||
*/
|
*/
|
||||||
protected StringBuffer getXML()
|
protected StringBuffer getXML()
|
||||||
{
|
{
|
||||||
if (e_xmlCode==null)
|
if (e_xmlCode==null)
|
||||||
return new StringBuffer("");
|
return new StringBuffer("");
|
||||||
return e_xmlCode;
|
return e_xmlCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get Redirect URL
|
* get Redirect URL
|
||||||
* @param redirectURL
|
* @param redirectURL
|
||||||
*/
|
*/
|
||||||
protected String getRedirectURL()
|
protected String getRedirectURL()
|
||||||
{
|
{
|
||||||
return e_redirectURL;
|
return e_redirectURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set Redirect URL
|
* set Redirect URL
|
||||||
* @param redirectURL
|
* @param redirectURL
|
||||||
*/
|
*/
|
||||||
protected void setRedirectURL(String redirectURL)
|
protected void setRedirectURL(String redirectURL)
|
||||||
{
|
{
|
||||||
e_redirectURL = redirectURL;
|
e_redirectURL = redirectURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Properties getCtx()
|
protected Properties getCtx()
|
||||||
{
|
{
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean doIt()
|
protected boolean doIt()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,377 +3,374 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import org.compiere.cm.cache.*;
|
import org.compiere.cm.cache.*;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HttpServletCM we extended the normal HttpServlet to store some global
|
* HttpServletCM we extended the normal HttpServlet to store some global
|
||||||
* environment and cache here
|
* environment and cache here
|
||||||
*
|
*
|
||||||
* @author Yves Sandfort
|
* @author Yves Sandfort
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class HttpServletCM extends HttpServlet
|
public class HttpServletCM extends HttpServlet
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* serialVersionUID for serializable HttpServlet
|
* serialVersionUID for serializable HttpServlet
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* status if config is loaded... true if loaded false is default after
|
* status if config is loaded... true if loaded false is default after
|
||||||
* startup
|
* startup
|
||||||
*/
|
*/
|
||||||
protected static boolean configLoaded = false;
|
protected static boolean configLoaded = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fatalError stores a shared variable which will be set to yes whenever a
|
* fatalError stores a shared variable which will be set to yes whenever a
|
||||||
* global Server Error from which we can not recover occurs. You should not
|
* global Server Error from which we can not recover occurs. You should not
|
||||||
* set it manually as will stop all servlet's and will not rerun them unless
|
* set it manually as will stop all servlet's and will not rerun them unless
|
||||||
* set back to false true if there is a global error false if there is no
|
* set back to false true if there is a global error false if there is no
|
||||||
* global error
|
* global error
|
||||||
*/
|
*/
|
||||||
protected static boolean fatalError = false;
|
protected static boolean fatalError = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* belongs to fatalError, should get a corresponding error message to
|
* belongs to fatalError, should get a corresponding error message to
|
||||||
* display in the web frontend. null if no error
|
* display in the web frontend. null if no error
|
||||||
*/
|
*/
|
||||||
protected static String ErrorMessage = null;
|
protected static String ErrorMessage = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* special application templates ssometimes depend on a special version,
|
* special application templates ssometimes depend on a special version,
|
||||||
* this is to give them an idea. Is included in the XML Code.
|
* this is to give them an idea. Is included in the XML Code.
|
||||||
*/
|
*/
|
||||||
protected static String buildDate = "200606062343";
|
protected static String buildDate = "200606062343";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DomainCache is storing the domains of the system, to reduce DB lookups
|
* DomainCache is storing the domains of the system, to reduce DB lookups
|
||||||
*/
|
*/
|
||||||
protected static Domain domainCache = new Domain ();
|
protected static Domain domainCache = new Domain ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebProject is storing the projects often used by the system, to reduce DB
|
* WebProject is storing the projects often used by the system, to reduce DB
|
||||||
* lookups
|
* lookups
|
||||||
*/
|
*/
|
||||||
protected static WebProject webProjectCache = new WebProject ();
|
protected static WebProject webProjectCache = new WebProject ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChatCache is storing the chat's often used by the system, to reduce DB
|
* ChatCache is storing the chat's often used by the system, to reduce DB
|
||||||
* lookups
|
* lookups
|
||||||
*/
|
*/
|
||||||
protected static Chat chatCache = new Chat ();
|
protected static Chat chatCache = new Chat ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContainerCache is storing the containers's often used by the system, to
|
* ContainerCache is storing the containers's often used by the system, to
|
||||||
* reduce DB lookups
|
* reduce DB lookups
|
||||||
*/
|
*/
|
||||||
protected static Container containerCache = new Container ();
|
protected static Container containerCache = new Container ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContainerElementCache is storing the container's elements often used by
|
* ContainerElementCache is storing the container's elements often used by
|
||||||
* the system, to reduce DB lookups
|
* the system, to reduce DB lookups
|
||||||
*/
|
*/
|
||||||
protected static ContainerElement containerElementCache = new ContainerElement ();
|
protected static ContainerElement containerElementCache = new ContainerElement ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContainerTreeCache is storing the container's tree often used by the
|
* ContainerTreeCache is storing the container's tree often used by the
|
||||||
* system, to reduce DB lookups
|
* system, to reduce DB lookups
|
||||||
*/
|
*/
|
||||||
protected static ContainerTree containerTreeCache = new ContainerTree ();
|
protected static ContainerTree containerTreeCache = new ContainerTree ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MediaServerCache is storing the project's media server in combination
|
* MediaServerCache is storing the project's media server in combination
|
||||||
* with Request Info
|
* with Request Info
|
||||||
*/
|
*/
|
||||||
protected static MediaServer mediaServerCache = new MediaServer ();
|
protected static MediaServer mediaServerCache = new MediaServer ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TemplateCache stores the oftens used templates
|
* TemplateCache stores the oftens used templates
|
||||||
*/
|
*/
|
||||||
protected static Template templateCache = new Template ();
|
protected static Template templateCache = new Template ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XMLCache stores the oftens used templates
|
* XMLCache stores the oftens used templates
|
||||||
*/
|
*/
|
||||||
protected static XML xmlCache = new XML ();
|
protected static XML xmlCache = new XML ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context of this Servlet
|
* Context of this Servlet
|
||||||
*/
|
*/
|
||||||
protected Properties ctx = null;
|
protected Properties ctx = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String containing the internal media path (should not be used for real
|
* String containing the internal media path (should not be used for real
|
||||||
* page deployment) the normal broadcaster will replace this URL with the
|
* page deployment) the normal broadcaster will replace this URL with the
|
||||||
* correct media server for this client
|
* correct media server for this client
|
||||||
*/
|
*/
|
||||||
protected static String internalMediaURL = null;
|
protected String internalMediaURL = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String containing the external media URL
|
* String containing the external media URL
|
||||||
*/
|
*/
|
||||||
protected String externalMediaURL = null;
|
protected String externalMediaURL = null;
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected CLogger log = CLogger.getCLogger (this.getClass ());
|
protected CLogger log = CLogger.getCLogger (this.getClass ());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init
|
* Init
|
||||||
*
|
*
|
||||||
* @param config
|
* @param config
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
*/
|
*/
|
||||||
public void init (ServletConfig config)
|
public void init (ServletConfig config)
|
||||||
throws ServletException
|
throws ServletException
|
||||||
{
|
{
|
||||||
super.init (config);
|
super.init (config);
|
||||||
if (!WebEnv.initWeb (config))
|
if (!WebEnv.initWeb (config))
|
||||||
throw new ServletException ("Broadcast.init");
|
throw new ServletException ("Broadcast.init");
|
||||||
if (!DB.isConnected ())
|
if (!DB.isConnected ())
|
||||||
{
|
{
|
||||||
fatalError = true;
|
fatalError = true;
|
||||||
ErrorMessage = "Connection to DB dropped!";
|
ErrorMessage = "Connection to DB dropped!";
|
||||||
log.severe ("No Database Connection!");
|
log.severe ("No Database Connection!");
|
||||||
}
|
}
|
||||||
org.compiere.cm.utils.CMEnv cmEnv = new org.compiere.cm.utils.CMEnv ();
|
org.compiere.cm.utils.CMEnv cmEnv = new org.compiere.cm.utils.CMEnv ();
|
||||||
ctx = cmEnv.getDefaults ();
|
ctx = cmEnv.getDefaults ();
|
||||||
chatCache.setCtx (ctx);
|
chatCache.setCtx (ctx);
|
||||||
containerCache.setCtx (ctx);
|
containerCache.setCtx (ctx);
|
||||||
containerElementCache.setCtx (ctx);
|
containerElementCache.setCtx (ctx);
|
||||||
containerTreeCache.setCtx (ctx);
|
containerTreeCache.setCtx (ctx);
|
||||||
domainCache.setCtx (ctx);
|
domainCache.setCtx (ctx);
|
||||||
mediaServerCache.setCtx (ctx);
|
mediaServerCache.setCtx (ctx);
|
||||||
templateCache.setCtx (ctx);
|
templateCache.setCtx (ctx);
|
||||||
webProjectCache.setCtx (ctx);
|
webProjectCache.setCtx (ctx);
|
||||||
xmlCache.setCtx(ctx);
|
xmlCache.setCtx(ctx);
|
||||||
if (!fatalError)
|
if (!fatalError)
|
||||||
configLoaded = true;
|
configLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current build version/date of the servlet engine, this is
|
* Returns the current build version/date of the servlet engine, this is
|
||||||
* used by special application templates which depend on certain
|
* used by special application templates which depend on certain
|
||||||
* functionality to check for their availability.
|
* functionality to check for their availability.
|
||||||
*
|
*
|
||||||
* @return the Build Date as a string in format YYYYMMDDHHMM
|
* @return the Build Date as a string in format YYYYMMDDHHMM
|
||||||
*/
|
*/
|
||||||
public String getBuildDate ()
|
public String getBuildDate ()
|
||||||
{
|
{
|
||||||
return buildDate;
|
return buildDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ContainerCache Object
|
* Returns the ContainerCache Object
|
||||||
*
|
*
|
||||||
* @return CO Object Container
|
* @return CO Object Container
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.Container getContainerCache ()
|
public org.compiere.cm.cache.Container getContainerCache ()
|
||||||
{
|
{
|
||||||
return containerCache;
|
return containerCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ChatCache Object
|
* Returns the ChatCache Object
|
||||||
*
|
*
|
||||||
* @return CO Object Chat
|
* @return CO Object Chat
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.Chat getChatCache ()
|
public org.compiere.cm.cache.Chat getChatCache ()
|
||||||
{
|
{
|
||||||
return chatCache;
|
return chatCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ContainerElementCache Object
|
* Returns the ContainerElementCache Object
|
||||||
*
|
*
|
||||||
* @return CO Object ContainerElement
|
* @return CO Object ContainerElement
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.ContainerElement getContainerElementCache ()
|
public org.compiere.cm.cache.ContainerElement getContainerElementCache ()
|
||||||
{
|
{
|
||||||
return containerElementCache;
|
return containerElementCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ContainerTreeCache Object
|
* Returns the ContainerTreeCache Object
|
||||||
*
|
*
|
||||||
* @return CO Object ContainerElement
|
* @return CO Object ContainerElement
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.ContainerTree getContainerTreeCache ()
|
public org.compiere.cm.cache.ContainerTree getContainerTreeCache ()
|
||||||
{
|
{
|
||||||
return containerTreeCache;
|
return containerTreeCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the DomainCache Object
|
* Returns the DomainCache Object
|
||||||
*
|
*
|
||||||
* @return CO Object Domain
|
* @return CO Object Domain
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.Domain getDomainCache ()
|
public org.compiere.cm.cache.Domain getDomainCache ()
|
||||||
{
|
{
|
||||||
return domainCache;
|
return domainCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the MediaServerCache Object
|
* Returns the MediaServerCache Object
|
||||||
*
|
*
|
||||||
* @return CO Object MediaServer
|
* @return CO Object MediaServer
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.MediaServer getMediaServerCache ()
|
public org.compiere.cm.cache.MediaServer getMediaServerCache ()
|
||||||
{
|
{
|
||||||
return mediaServerCache;
|
return mediaServerCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the WebProjectCache Object
|
* Returns the WebProjectCache Object
|
||||||
*
|
*
|
||||||
* @return CO Object WebProject
|
* @return CO Object WebProject
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.WebProject getWebProjectCache ()
|
public org.compiere.cm.cache.WebProject getWebProjectCache ()
|
||||||
{
|
{
|
||||||
return webProjectCache;
|
return webProjectCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Template Object
|
* Returns the Template Object
|
||||||
*
|
*
|
||||||
* @return CO Object Template
|
* @return CO Object Template
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.Template getTemplateCache ()
|
public org.compiere.cm.cache.Template getTemplateCache ()
|
||||||
{
|
{
|
||||||
return templateCache;
|
return templateCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Template Object
|
* Returns the Template Object
|
||||||
*
|
*
|
||||||
* @return CO Object Template
|
* @return CO Object Template
|
||||||
*/
|
*/
|
||||||
public org.compiere.cm.cache.XML getXMLCache ()
|
public org.compiere.cm.cache.XML getXMLCache ()
|
||||||
{
|
{
|
||||||
return xmlCache;
|
return xmlCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the internalMediaURL for replacement
|
* Returns the internalMediaURL for replacement
|
||||||
*
|
*
|
||||||
* @return String with internal MediaURL normally context + "/" + media +
|
* @return String with internal MediaURL normally context + "/" + media +
|
||||||
* "/"
|
* "/"
|
||||||
*/
|
*/
|
||||||
public String getInternalMediaURL ()
|
public String getInternalMediaURL ()
|
||||||
{
|
{
|
||||||
return internalMediaURL;
|
return internalMediaURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the sessionMediaURL, this is the ideal Media URL for this Request
|
* Returns the sessionMediaURL, this is the ideal Media URL for this Request
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* the Request for this
|
* the Request for this
|
||||||
* @param CM_WebProject_ID
|
* @param CM_WebProject_ID
|
||||||
* Returns the WebProject ID
|
* Returns the WebProject ID
|
||||||
* @return String with session MediaURL, if none found we return the
|
* @return String with session MediaURL, if none found we return the
|
||||||
* internal one
|
* internal one
|
||||||
*/
|
*/
|
||||||
public String getSessionMediaURL (HttpServletRequest request,
|
public String getSessionMediaURL (HttpServletRequest request,
|
||||||
int CM_WebProject_ID)
|
int CM_WebProject_ID)
|
||||||
{
|
{
|
||||||
String sessionMediaURL = getMediaServerCache ().getMediaServer (
|
String sessionMediaURL = getMediaServerCache ().getMediaServer (
|
||||||
getCtx (), CM_WebProject_ID, null);
|
getCtx (), CM_WebProject_ID, null);
|
||||||
if (sessionMediaURL == null)
|
if (sessionMediaURL == null)
|
||||||
sessionMediaURL = getInternalMediaURL ();
|
sessionMediaURL = getInternalMediaURL ();
|
||||||
return internalMediaURL;
|
return internalMediaURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets internal Media URL
|
* Sets internal Media URL
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
public void setInternalMediaURL (HttpServletRequest request)
|
public void resetInternalMediaURL (HttpServletRequest request)
|
||||||
{
|
{
|
||||||
if (internalMediaURL == null)
|
internalMediaURL = request.getRequestURL ().toString ().substring (
|
||||||
{
|
0,
|
||||||
internalMediaURL = request.getRequestURL ().toString ().substring (
|
request.getRequestURL ().toString ().indexOf (
|
||||||
0,
|
request.getServerName ())
|
||||||
request.getRequestURL ().toString ().indexOf (
|
+ request.getServerName ().length ())
|
||||||
request.getServerName ())
|
+ request.getContextPath () + "/media/";
|
||||||
+ request.getServerName ().length ())
|
|
||||||
+ request.getContextPath () + "/media/";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Context of the current session. This is a very sensitive
|
* Returns the Context of the current session. This is a very sensitive
|
||||||
* function as we will take care of all parameters here!
|
* function as we will take care of all parameters here!
|
||||||
*
|
*
|
||||||
* @return Context
|
* @return Context
|
||||||
*/
|
*/
|
||||||
public Properties getCtx ()
|
public Properties getCtx ()
|
||||||
{
|
{
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current External Media URL for the Project
|
* Returns the current External Media URL for the Project
|
||||||
*
|
*
|
||||||
* @param CM_WebProject_ID
|
* @param CM_WebProject_ID
|
||||||
* WebProject
|
* WebProject
|
||||||
* @return ExternalMediaURL as String
|
* @return ExternalMediaURL as String
|
||||||
*/
|
*/
|
||||||
public String getExternalMediaURL (int CM_WebProject_ID)
|
public String getExternalMediaURL (int CM_WebProject_ID)
|
||||||
{
|
{
|
||||||
externalMediaURL = getMediaServerCache ().getMediaServer (getCtx (),
|
externalMediaURL = getMediaServerCache ().getMediaServer (getCtx (),
|
||||||
CM_WebProject_ID, null);
|
CM_WebProject_ID, null);
|
||||||
if (externalMediaURL != null
|
if (externalMediaURL != null
|
||||||
&& externalMediaURL.charAt (externalMediaURL.length () - 1) != '/')
|
&& externalMediaURL.charAt (externalMediaURL.length () - 1) != '/')
|
||||||
externalMediaURL = externalMediaURL + "/";
|
externalMediaURL = externalMediaURL + "/";
|
||||||
return externalMediaURL;
|
return externalMediaURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current External Media URL be carefull this Function needs to
|
* Returns the current External Media URL be carefull this Function needs to
|
||||||
* be called after the URL is set!
|
* be called after the URL is set!
|
||||||
*
|
*
|
||||||
* @return ExternalMediaURL as String
|
* @return ExternalMediaURL as String
|
||||||
*/
|
*/
|
||||||
public String getExternalMediaURL ()
|
public String getExternalMediaURL ()
|
||||||
{
|
{
|
||||||
return externalMediaURL;
|
return externalMediaURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setAD_Client_ID to update AD_Client as soon System has recognized the Client
|
* setAD_Client_ID to update AD_Client as soon System has recognized the Client
|
||||||
* @param newVal
|
* @param newVal
|
||||||
*/
|
*/
|
||||||
public void setAD_Client_ID(int newVal)
|
public void setAD_Client_ID(int newVal)
|
||||||
{
|
{
|
||||||
ctx.put ("#AD_Client_ID", (String) (""+newVal));
|
ctx.put ("#AD_Client_ID", (String) (""+newVal));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get Servlet Logger
|
* get Servlet Logger
|
||||||
* @return CLooger log
|
* @return CLooger log
|
||||||
*/
|
*/
|
||||||
public CLogger getLogger()
|
public CLogger getLogger()
|
||||||
{
|
{
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,124 +1,132 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Compiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import org.compiere.model.MImage;
|
import org.compiere.model.MImage;
|
||||||
import org.compiere.model.MMedia;
|
import org.compiere.model.MMedia;
|
||||||
import org.compiere.util.WebEnv;
|
import org.compiere.util.WebEnv;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast Servlet
|
* Broadcast Servlet
|
||||||
*
|
*
|
||||||
* @author $Author$
|
* @author $Author$
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class MediaBroadcast extends HttpServletCM
|
public class MediaBroadcast extends HttpServletCM
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Get request
|
* Process the HTTP Get request
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
// Create New Session
|
// Create New Session
|
||||||
HttpSession sess = request.getSession(true);
|
HttpSession sess = request.getSession(true);
|
||||||
sess.setMaxInactiveInterval(WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval(WebEnv.TIMEOUT);
|
||||||
|
|
||||||
if (configLoaded && !fatalError) {
|
if (configLoaded && !fatalError) {
|
||||||
String requestURL = request.getRequestURL().toString();
|
String requestURL = request.getRequestURL().toString();
|
||||||
String serverName = request.getServerName();
|
String serverName = request.getServerName();
|
||||||
String baseURL = requestURL.substring(0,requestURL.indexOf(serverName)+serverName.length()+6)+request.getContextPath();
|
String baseURL = requestURL.substring(0,requestURL.indexOf(serverName)+serverName.length()+6)+request.getContextPath();
|
||||||
String relativeURL = requestURL.substring(baseURL.length());
|
String relativeURL = requestURL.substring(baseURL.length());
|
||||||
// If the relativeURL still contains / we will simply strip them off...
|
// If the relativeURL still contains / we will simply strip them off...
|
||||||
if (relativeURL.indexOf("/")>=0)
|
if (relativeURL.indexOf("/")>=0)
|
||||||
relativeURL = relativeURL.substring(relativeURL.lastIndexOf("/")+1);
|
relativeURL = relativeURL.substring(relativeURL.lastIndexOf("/")+1);
|
||||||
|
|
||||||
// We should have only an ID before the first dot.
|
// We should have only an ID before the first dot.
|
||||||
Integer mediaID = null;
|
Integer mediaID = null;
|
||||||
try {
|
try {
|
||||||
if (relativeURL.indexOf(".")>=0) {
|
if (relativeURL.indexOf(".")>=0) {
|
||||||
mediaID = Integer.parseInt(relativeURL.substring(0,relativeURL.indexOf(".")));
|
mediaID = Integer.parseInt(relativeURL.substring(0,relativeURL.indexOf(".")));
|
||||||
} else {
|
} else {
|
||||||
mediaID = Integer.parseInt(relativeURL);
|
mediaID = Integer.parseInt(relativeURL);
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException ne) {
|
} catch (NumberFormatException ne) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaID!=null && mediaID.intValue()>0) {
|
if (mediaID!=null && mediaID.intValue()>0) {
|
||||||
|
|
||||||
MMedia thisMedia = new org.compiere.model.MMedia(webProjectCache.getCtx(),mediaID,null);
|
MMedia thisMedia = new org.compiere.model.MMedia(webProjectCache.getCtx(),mediaID,null);
|
||||||
if (thisMedia!=null && thisMedia.get_ID()>0) {
|
if (thisMedia!=null && thisMedia.get_ID()>0) {
|
||||||
if (thisMedia.getMediaType ().equals ("CSS")) {
|
if (thisMedia.getMediaType ().equals ("CSS")) {
|
||||||
response.setContentType("text/css");
|
response.setContentType("text/css");
|
||||||
// Text Content will get handled via direct Stream
|
// Text Content will get handled via direct Stream
|
||||||
response.setContentLength (thisMedia.getContentText ().length ());
|
response.setContentLength (thisMedia.getContentText ().length ());
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
out = response.getWriter ();
|
out = response.getWriter ();
|
||||||
out.print (thisMedia.getContentText ());
|
out.print (thisMedia.getContentText ());
|
||||||
out.close ();
|
out.close ();
|
||||||
} else {
|
} else {
|
||||||
response.setContentType(thisMedia.getMediaType());
|
response.setContentType(thisMedia.getMediaType());
|
||||||
// Binary / Image content will get handled here
|
// Binary / Image content will get handled here
|
||||||
MImage thisImage = thisMedia.getImage();
|
MImage thisImage = thisMedia.getImage();
|
||||||
response.setContentLength(thisImage.getData().length);
|
response.setContentLength(thisImage.getData().length);
|
||||||
|
|
||||||
// Open the file and output streams
|
// Open the file and output streams
|
||||||
byte[] buffer = thisImage.getData();
|
byte[] buffer = thisImage.getData();
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
|
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
|
||||||
OutputStream out = response.getOutputStream();
|
OutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
// Copy the contents of the file to the output stream
|
// Copy the contents of the file to the output stream
|
||||||
byte[] buf = new byte[1024];
|
byte[] buf = new byte[1024];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while ((count = in.read(buf)) >= 0) {
|
while ((count = in.read(buf)) >= 0) {
|
||||||
out.write(buf, 0, count);
|
out.write(buf, 0, count);
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response.sendError(404);
|
response.sendError(404);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
response.sendError(404);
|
response.sendError(404);
|
||||||
}
|
}
|
||||||
} else if (fatalError) {
|
} else if (fatalError) {
|
||||||
response.sendError(500, ErrorMessage);
|
response.sendError(500, ErrorMessage);
|
||||||
}
|
}
|
||||||
} // doGet
|
} // doGet
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Post request
|
* Process the HTTP Post request
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet(request, response);
|
doGet(request, response);
|
||||||
} // doPost
|
} // doPost
|
||||||
|
|
||||||
} // Broadcast
|
} // Broadcast
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* 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
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
* See the GNU General Public License for more details.
|
* See the GNU General Public License for more details.
|
||||||
* You should have received a copy of the GNU General Public License along
|
* 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.,
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||||
|
|
@ -15,78 +15,77 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.compiere.cm.request.Request;
|
import org.compiere.cm.request.Request;
|
||||||
import org.compiere.util.CLogger;
|
|
||||||
import org.compiere.util.WebEnv;
|
import org.compiere.util.WebEnv;
|
||||||
import org.compiere.util.WebSessionCtx;
|
import org.compiere.util.WebSessionCtx;
|
||||||
import org.compiere.util.WebUtil;
|
import org.compiere.util.WebUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request Servlet to handle Request create & Update etc.
|
* Request Servlet to handle Request create & Update etc.
|
||||||
*
|
*
|
||||||
* @author Kai Viiksaar
|
* @author Kai Viiksaar
|
||||||
* @version $Id: RequestServlet.java,v 1.1 2006/10/11 06:30:11 comdivision Exp $
|
* @version $Id: RequestServlet.java,v 1.1 2006/10/11 06:30:11 comdivision Exp $
|
||||||
*/
|
*/
|
||||||
public class RequestServlet extends HttpServletCM {
|
public class RequestServlet extends HttpServletCM {
|
||||||
/** Logging */
|
/** serialVersionUID */
|
||||||
private CLogger log = CLogger.getCLogger(getClass());
|
private static final long serialVersionUID = 6979583935052312291L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Get Request
|
* Process Get Request
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
String l_szRequestID = null;
|
String l_szRequestID = null;
|
||||||
HttpSession sess = request.getSession (true);
|
HttpSession sess = request.getSession (true);
|
||||||
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
||||||
|
|
||||||
Properties ctx = getCtx();
|
ctx = getCtx();
|
||||||
|
|
||||||
if (sess.getAttribute ("ctx")!=null)
|
if (sess.getAttribute ("ctx")!=null)
|
||||||
ctx = (Properties) sess.getAttribute ("ctx");
|
ctx = (Properties) sess.getAttribute ("ctx");
|
||||||
|
|
||||||
WebSessionCtx wsc = (WebSessionCtx)sess.getAttribute(WebSessionCtx.NAME);
|
WebSessionCtx wsc = (WebSessionCtx)sess.getAttribute(WebSessionCtx.NAME);
|
||||||
|
|
||||||
// Create New Request
|
// Create New Request
|
||||||
if (wsc != null) {
|
if (wsc != null) {
|
||||||
String mode = WebUtil.getParameter(request, "Mode");
|
String mode = WebUtil.getParameter(request, "Mode");
|
||||||
if (mode != null && mode.equals("RequestNew")) {
|
if (mode != null && mode.equals("RequestNew")) {
|
||||||
l_szRequestID = Request.createRequest(request, ctx);
|
l_szRequestID = Request.createRequest(request, ctx);
|
||||||
} else if (mode != null && mode.equals("RequestChange")) {
|
} else if (mode != null && mode.equals("RequestChange")) {
|
||||||
l_szRequestID = Request.changeRequest(request, ctx);
|
l_szRequestID = Request.changeRequest(request, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String url = request.getParameter("ForwardTo") + l_szRequestID;
|
String url = request.getParameter("ForwardTo") + l_szRequestID;
|
||||||
if (!url.startsWith("/"))
|
if (!url.startsWith("/"))
|
||||||
url = "/" + url;
|
url = "/" + url;
|
||||||
response.sendRedirect(url);
|
response.sendRedirect(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Post Request (handled by get)
|
* Process Post Request (handled by get)
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet (request, response);
|
doGet (request, response);
|
||||||
} // doPost
|
} // doPost
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,118 +3,118 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import org.compiere.Adempiere;
|
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
import org.compiere.model.*;
|
|
||||||
import org.compiere.cm.utils.*;
|
import org.compiere.cm.utils.*;
|
||||||
import org.compiere.cm.xml.*;
|
import org.compiere.cm.xml.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast Servlet
|
* Broadcast Servlet
|
||||||
*
|
*
|
||||||
* @author $Author$
|
* @author $Author$
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class StageBroadcast extends HttpServletCM
|
public class StageBroadcast extends HttpServletCM
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** serialVersionUID */
|
||||||
|
private static final long serialVersionUID = 7348394433516908807L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle Get Request
|
* Handle Get Request
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
// Create New Session
|
// Create New Session
|
||||||
HttpSession sess = request.getSession (true);
|
HttpSession sess = request.getSession (true);
|
||||||
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
||||||
StringBuffer output = new StringBuffer ();
|
StringBuffer output = new StringBuffer ();
|
||||||
if (configLoaded && !fatalError)
|
if (configLoaded && !fatalError)
|
||||||
{
|
{
|
||||||
String acceptLanguage = request.getHeader ("Accept-Language");
|
String acceptLanguage = request.getHeader ("Accept-Language");
|
||||||
String acceptCharset = request.getHeader ("Accept-Charset");
|
String acceptCharset = request.getHeader ("Accept-Charset");
|
||||||
LocaleHandler lhandler = new LocaleHandler (acceptLanguage,
|
LocaleHandler lhandler = new LocaleHandler (acceptLanguage,
|
||||||
acceptCharset);
|
acceptCharset);
|
||||||
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
||||||
true, "");
|
true, "");
|
||||||
if (thisRequest.getIsRedirect ())
|
if (thisRequest.getIsRedirect ())
|
||||||
{
|
{
|
||||||
// If we need to redirect as the URL is different do it beofre
|
// If we need to redirect as the URL is different do it beofre
|
||||||
// we transmit to client
|
// we transmit to client
|
||||||
response.sendRedirect (thisRequest.getRedirectURL ());
|
response.sendRedirect (thisRequest.getRedirectURL ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No need to redirect so we will display the content
|
// No need to redirect so we will display the content
|
||||||
// Generate the needed XMLCode
|
// Generate the needed XMLCode
|
||||||
Generator thisXMLGen = new Generator (this, request,
|
Generator thisXMLGen = new Generator (this, request,
|
||||||
thisRequest, new StringBuffer(""));
|
thisRequest, new StringBuffer(""));
|
||||||
// thisXMLGen.addPObject(thisRequest.getCM_Container());
|
// thisXMLGen.addPObject(thisRequest.getCM_Container());
|
||||||
String xmlCode = thisXMLGen.get ();
|
String xmlCode = thisXMLGen.get ();
|
||||||
// Get or generate Template needed
|
// Get or generate Template needed
|
||||||
String xslCode = templateCache.getCM_Template (
|
String xslCode = templateCache.getCM_Template (
|
||||||
thisRequest.getCM_Container ().getCM_Template_ID (),
|
thisRequest.getCM_Container ().getCM_Template_ID (),
|
||||||
thisRequest.getWebProject ().get_ID ())
|
thisRequest.getWebProject ().get_ID ())
|
||||||
.getTemplateXST ();
|
.getTemplateXST ();
|
||||||
// Put it all together
|
// Put it all together
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
output.append (XSLTProcessor.run (request, xslCode, xmlCode));
|
output.append (XSLTProcessor.run (request, xslCode, xmlCode));
|
||||||
}
|
}
|
||||||
catch (Exception E)
|
catch (Exception E)
|
||||||
{
|
{
|
||||||
response.sendError (500);
|
response.sendError (500);
|
||||||
}
|
}
|
||||||
response.setContentType ("text/html; charset="
|
response.setContentType ("text/html; charset="
|
||||||
+ lhandler.getCharset ());
|
+ lhandler.getCharset ());
|
||||||
response.setHeader ("CMBuild", buildDate);
|
response.setHeader ("CMBuild", buildDate);
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
out = response.getWriter ();
|
out = response.getWriter ();
|
||||||
out.print (output.toString ());
|
out.print (output.toString ());
|
||||||
out.close ();
|
out.close ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fatalError)
|
else if (fatalError)
|
||||||
{
|
{
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
out = response.getWriter ();
|
out = response.getWriter ();
|
||||||
out.print ("<H1>Fatal Error:" + ErrorMessage + "</H1>");
|
out.print ("<H1>Fatal Error:" + ErrorMessage + "</H1>");
|
||||||
out.close ();
|
out.close ();
|
||||||
}
|
}
|
||||||
} // doGet
|
} // doGet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Post Request - handled by Get
|
* Process Post Request - handled by Get
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
doGet (request, response);
|
doGet (request, response);
|
||||||
} // doPost
|
} // doPost
|
||||||
} // Broadcast
|
} // Broadcast
|
||||||
|
|
|
||||||
|
|
@ -3,64 +3,66 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.compiere.cm.utils.RequestAnalyzer;
|
import org.compiere.cm.utils.RequestAnalyzer;
|
||||||
import org.compiere.cm.xml.Generator;
|
import org.compiere.cm.xml.Generator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author YS
|
* @author YS
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class XMLBroadcast extends HttpServletCM
|
public class XMLBroadcast extends HttpServletCM
|
||||||
{
|
{
|
||||||
|
/** serialVersionUID */
|
||||||
|
private static final long serialVersionUID = -1280320974132533949L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get
|
* Get
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
||||||
false, "/xml");
|
false, "/xml");
|
||||||
// Even if we will only display the XML tree we are forced to build the Media URLs
|
// Even if we will only display the XML tree we are forced to build the Media URLs
|
||||||
if (getInternalMediaURL () == null)
|
resetInternalMediaURL (request);
|
||||||
setInternalMediaURL (request);
|
|
||||||
if (externalMediaURL == null) {
|
if (externalMediaURL == null) {
|
||||||
if (thisRequest.getWebProject()!=null)
|
if (thisRequest.getWebProject()!=null)
|
||||||
externalMediaURL = getExternalMediaURL (thisRequest
|
externalMediaURL = getExternalMediaURL (thisRequest
|
||||||
.getWebProject ().get_ID ());
|
.getWebProject ().get_ID ());
|
||||||
else
|
else
|
||||||
externalMediaURL = getInternalMediaURL();
|
externalMediaURL = getInternalMediaURL();
|
||||||
|
|
||||||
}
|
}
|
||||||
// Generate the needed XMLCode
|
// Generate the needed XMLCode
|
||||||
Generator thisXMLGen = new Generator (this, request, thisRequest, new StringBuffer(""));
|
Generator thisXMLGen = new Generator (this, request, thisRequest, new StringBuffer(""));
|
||||||
String xmlCode = thisXMLGen.get ();
|
String xmlCode = thisXMLGen.get ();
|
||||||
response.setContentType ("text/xml; charset=UTF8");
|
response.setContentType ("text/xml; charset=UTF8");
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
out = response.getWriter ();
|
out = response.getWriter ();
|
||||||
out.print (xmlCode);
|
out.print (xmlCode);
|
||||||
out.close ();
|
out.close ();
|
||||||
} // doGet
|
} // doGet
|
||||||
|
|
||||||
} // HttpServletCM
|
} // HttpServletCM
|
||||||
|
|
|
||||||
|
|
@ -3,130 +3,177 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm.cache;
|
package org.compiere.cm.cache;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.compiere.model.*;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CO CacheObject
|
* CO CacheObject
|
||||||
* we store parts of the content in caches on the webservers to reduce DB load and speed up page deployment
|
* we store parts of the content in caches on the webservers to reduce DB load and speed up page deployment
|
||||||
*
|
*
|
||||||
* @author Yves Sandfort
|
* @author Yves Sandfort
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class CO {
|
public class CO {
|
||||||
|
|
||||||
protected static int cacheSize = 100;
|
protected static int cacheSize = 100;
|
||||||
protected Hashtable cache = new Hashtable(cacheSize);
|
protected Hashtable cache = new Hashtable(cacheSize);
|
||||||
protected Hashtable cacheUsage = new Hashtable(cacheSize);
|
protected Hashtable cacheUsage = new Hashtable(cacheSize);
|
||||||
protected Properties ctx;
|
protected Properties ctx;
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected CLogger log = CLogger.getCLogger(this.getClass());
|
protected CLogger log = CLogger.getCLogger(this.getClass());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Object
|
||||||
|
*/
|
||||||
public CO () {
|
public CO () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set Context
|
||||||
|
* @param thisCtx
|
||||||
|
*/
|
||||||
public void setCtx(Properties thisCtx) {
|
public void setCtx(Properties thisCtx) {
|
||||||
ctx = thisCtx;
|
ctx = thisCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get Context
|
||||||
|
* @return Context
|
||||||
|
*/
|
||||||
public Properties getCtx() {
|
public Properties getCtx() {
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* put
|
||||||
|
* @param ID
|
||||||
|
* @param thisObject
|
||||||
|
*/
|
||||||
public void put(String ID, Object thisObject) {
|
public void put(String ID, Object thisObject) {
|
||||||
cache.put(ID,thisObject);
|
cache.put(ID,thisObject);
|
||||||
Long thisLong = new Long(new Date().getTime());
|
Long thisLong = new Long(new Date().getTime());
|
||||||
cacheUsage.put(ID, thisLong);
|
cacheUsage.put(ID, thisLong);
|
||||||
if (cacheUsage.size()>cacheSize-1) {
|
if (cacheUsage.size()>cacheSize-1) {
|
||||||
cleanUp();
|
cleanUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove
|
||||||
|
* @param ID
|
||||||
|
*/
|
||||||
public void remove(String ID) {
|
public void remove(String ID) {
|
||||||
cache.remove(ID);
|
cache.remove(ID);
|
||||||
cacheUsage.remove(ID);
|
cacheUsage.remove(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getSize of current cache
|
||||||
|
* @return number of cache entries
|
||||||
|
*/
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return cache.size();
|
return cache.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get key enumeration
|
||||||
|
* @return key enumeration
|
||||||
|
*/
|
||||||
public Enumeration getKeys() {
|
public Enumeration getKeys() {
|
||||||
return cache.keys();
|
return cache.keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cleanUp () {
|
private void cleanUp () {
|
||||||
Vector vecKeys = new Vector();
|
Vector vecKeys = new Vector();
|
||||||
//Gets keys from hashtable
|
//Gets keys from hashtable
|
||||||
|
|
||||||
Enumeration myEnum = cacheUsage.elements();
|
Enumeration myEnum = cacheUsage.elements();
|
||||||
|
|
||||||
while (myEnum.hasMoreElements())
|
while (myEnum.hasMoreElements())
|
||||||
{
|
{
|
||||||
vecKeys.add(myEnum.nextElement());
|
vecKeys.add(myEnum.nextElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sorts vector in Ascending order
|
//Sorts vector in Ascending order
|
||||||
Collections.sort(vecKeys);
|
Collections.sort(vecKeys);
|
||||||
Collections.reverse(vecKeys);
|
Collections.reverse(vecKeys);
|
||||||
|
|
||||||
//Displays values using Key
|
//Displays values using Key
|
||||||
for(int i=0;i<vecKeys.size();i++)
|
for(int i=0;i<vecKeys.size();i++)
|
||||||
{
|
{
|
||||||
String value = vecKeys.get(i).toString();
|
String value = vecKeys.get(i).toString();
|
||||||
String key = "";
|
String key = "";
|
||||||
Enumeration keys = cacheUsage.keys();
|
Enumeration keys = cacheUsage.keys();
|
||||||
while (keys.hasMoreElements() && key.equals("")) {
|
while (keys.hasMoreElements() && key.equals("")) {
|
||||||
String thisKey = keys.nextElement().toString();
|
String thisKey = keys.nextElement().toString();
|
||||||
String tempValue = cacheUsage.get(thisKey).toString();
|
String tempValue = cacheUsage.get(thisKey).toString();
|
||||||
if (tempValue.equals(value)) {
|
if (tempValue.equals(value)) {
|
||||||
key = thisKey;
|
key = thisKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Use Maxelements -1 since i starts with 0
|
// Use Maxelements -1 since i starts with 0
|
||||||
if (i>cacheSize-1) {
|
if (i>cacheSize-1) {
|
||||||
cache.remove(key);
|
cache.remove(key);
|
||||||
cacheUsage.remove(key);
|
cacheUsage.remove(key);
|
||||||
log.fine("Item: " + key + " from cache: " + this.getClass().getName() + " was removed.");
|
log.fine("Item: " + key + " from cache: " + this.getClass().getName() + " was removed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Usage value for cache optimization
|
||||||
|
* @param ID
|
||||||
|
*/
|
||||||
|
public void use(int ID) {
|
||||||
|
Long thisLong = new Long(new java.util.Date().getTime());
|
||||||
|
cacheUsage.put("" + ID, thisLong);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Usage value for cache optimization
|
||||||
|
* @param ID
|
||||||
|
*/
|
||||||
public void use(String ID) {
|
public void use(String ID) {
|
||||||
Long thisLong = new Long(new java.util.Date().getTime());
|
Long thisLong = new Long(new java.util.Date().getTime());
|
||||||
cacheUsage.put(ID, thisLong);
|
cacheUsage.put(ID, thisLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* empty complete Cache
|
||||||
|
*/
|
||||||
public void empty() {
|
public void empty() {
|
||||||
cache = new Hashtable(cacheSize);
|
cache = new Hashtable(cacheSize);
|
||||||
cacheUsage = new Hashtable(cacheSize);
|
cacheUsage = new Hashtable(cacheSize);
|
||||||
log.fine("Cache: " + this.getClass().getName() + " was cleared.");
|
log.fine("Cache: " + this.getClass().getName() + " was cleared.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show Cache Content
|
||||||
|
* @return XML String with CacheContent
|
||||||
|
*/
|
||||||
public String show() {
|
public String show() {
|
||||||
StringBuffer tStrHTML = new StringBuffer();
|
StringBuffer tStrHTML = new StringBuffer();
|
||||||
Enumeration thisEnum = null;
|
Enumeration thisEnum = null;
|
||||||
tStrHTML.append(" <size>" + this.getSize() + "</size>\n");
|
tStrHTML.append(" <size>" + this.getSize() + "</size>\n");
|
||||||
thisEnum = this.getKeys();
|
thisEnum = this.getKeys();
|
||||||
while (thisEnum.hasMoreElements()) {
|
while (thisEnum.hasMoreElements()) {
|
||||||
tStrHTML.append(" <item>" + thisEnum.nextElement() + "</item>\n");
|
tStrHTML.append(" <item>" + thisEnum.nextElement() + "</item>\n");
|
||||||
}
|
}
|
||||||
return tStrHTML.toString();
|
return tStrHTML.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,47 +3,63 @@
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 *
|
* 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 *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU General Public License for more details. *
|
* See the GNU General Public License for more details. *
|
||||||
* You should have received a copy of the GNU General Public License along *
|
* 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., *
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
* For the text or an alternative of this public license, you may reach us *
|
* For the text or an alternative of this public license, you may reach us *
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm.cache;
|
package org.compiere.cm.cache;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.compiere.model.X_CM_Chat;
|
import org.compiere.model.MChat;
|
||||||
|
|
||||||
public class Chat extends CO {
|
/**
|
||||||
|
* Chat Cache Object
|
||||||
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
*
|
||||||
|
* @author Yves Sandfort
|
||||||
public X_CM_Chat getCM_Chat(int ID) {
|
* @version $Id$
|
||||||
return getCM_Chat(""+ ID);
|
*/
|
||||||
}
|
public class Chat extends CO {
|
||||||
|
|
||||||
public X_CM_Chat getCM_Chat(String ID) {
|
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
||||||
if (cache.containsKey(ID)) {
|
|
||||||
use(ID);
|
/**
|
||||||
return (X_CM_Chat) cache.get(ID);
|
* getCM_Chat
|
||||||
} else {
|
* @param ID
|
||||||
int[] tableKeys = X_CM_Chat.getAllIDs("CM_Chat", "CM_Chat_ID=" + ID, "WebCM");
|
* @return Chat
|
||||||
if (tableKeys.length==0) {
|
*/
|
||||||
// No Chat entry
|
public MChat getCM_Chat(int ID) {
|
||||||
return null;
|
return getCM_Chat(""+ ID);
|
||||||
} else if (tableKeys.length==1) {
|
}
|
||||||
X_CM_Chat thisChat = new X_CM_Chat(ctx, tableKeys[0], "WebCM");
|
|
||||||
put ("" + thisChat.get_ID(),thisChat);
|
/**
|
||||||
return thisChat;
|
* getCM_Chat
|
||||||
} else {
|
* @param ID
|
||||||
// More than one result, this is funny, normally this is not possible :-/
|
* @return Chat
|
||||||
return null;
|
*/
|
||||||
}
|
public MChat getCM_Chat(String ID) {
|
||||||
}
|
if (cache.containsKey(ID)) {
|
||||||
}
|
use(ID);
|
||||||
}
|
return (MChat) cache.get(ID);
|
||||||
|
} else {
|
||||||
|
int[] tableKeys = MChat.getAllIDs("CM_Chat", "CM_Chat_ID=" + ID, "WebCM");
|
||||||
|
if (tableKeys.length==0) {
|
||||||
|
// No Chat entry
|
||||||
|
return null;
|
||||||
|
} else if (tableKeys.length==1) {
|
||||||
|
MChat thisChat = new MChat(ctx, tableKeys[0], "WebCM");
|
||||||
|
put ("" + thisChat.get_ID(),thisChat);
|
||||||
|
return thisChat;
|
||||||
|
} else {
|
||||||
|
// More than one result, this is funny, normally this is not possible :-/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ public class Container extends CO {
|
||||||
* @param CM_WebProject_ID Web Project
|
* @param CM_WebProject_ID Web Project
|
||||||
* @return Container
|
* @return Container
|
||||||
*/
|
*/
|
||||||
public MContainer getCM_Container(int ID, int CM_WebProject_ID) {
|
public MContainer getCM_Container(String ID, int CM_WebProject_ID) {
|
||||||
return getCM_Container(""+ ID, CM_WebProject_ID);
|
return getCM_Container(Integer.parseInt(ID), CM_WebProject_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -45,22 +45,21 @@ public class Container extends CO {
|
||||||
* @param CM_WebProject_ID Web Project
|
* @param CM_WebProject_ID Web Project
|
||||||
* @return Container
|
* @return Container
|
||||||
*/
|
*/
|
||||||
public MContainer getCM_Container(String ID, int CM_WebProject_ID) {
|
public MContainer getCM_Container(int ID, int CM_WebProject_ID) {
|
||||||
if (cache.containsKey(ID)) {
|
if (cache.containsKey(ID)) {
|
||||||
use(ID);
|
use(ID);
|
||||||
return (MContainer) cache.get(ID);
|
return (MContainer) cache.get(ID);
|
||||||
} else {
|
} else {
|
||||||
int[] tableKeys = MContainer.getAllIDs("CM_Container", "CM_Container_ID=" + ID + " AND CM_WebProject_ID=" + CM_WebProject_ID, "WebCM");
|
MContainer thisContainer = MContainer.get(ctx, ID, CM_WebProject_ID, "WebCM");
|
||||||
if (tableKeys.length==0) {
|
if (thisContainer==null)
|
||||||
return getCM_ContainerByURL("/error404.html", CM_WebProject_ID, true);
|
{
|
||||||
} else if (tableKeys.length==1) {
|
return getCM_ContainerByURL("/error404.html", CM_WebProject_ID, true);
|
||||||
MContainer thisContainer = new MContainer(ctx, tableKeys[0], "WebCM");
|
}
|
||||||
put ("" + thisContainer.getCM_Container_ID(),thisContainer);
|
else
|
||||||
cacheContainerURL.put (CM_WebProject_ID + "-" + thisContainer.getRelativeURL(),"" + thisContainer.getCM_Container_ID());
|
{
|
||||||
return thisContainer;
|
put ("" + thisContainer.getCM_Container_ID(),thisContainer);
|
||||||
} else {
|
cacheContainerURL.put (CM_WebProject_ID + "-" + thisContainer.getRelativeURL(),"" + thisContainer.getCM_Container_ID());
|
||||||
// More than one result, this is funny, normally this is not possible :-/
|
return thisContainer;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -69,6 +68,7 @@ public class Container extends CO {
|
||||||
* Get Container from cache by URL
|
* Get Container from cache by URL
|
||||||
* @param URL URL to look for
|
* @param URL URL to look for
|
||||||
* @param CM_WebProject_ID Web Project
|
* @param CM_WebProject_ID Web Project
|
||||||
|
* @param resolveURLErrors
|
||||||
* @return Container
|
* @return Container
|
||||||
*/
|
*/
|
||||||
public MContainer getCM_ContainerByURL(String URL, int CM_WebProject_ID, boolean resolveURLErrors) {
|
public MContainer getCM_ContainerByURL(String URL, int CM_WebProject_ID, boolean resolveURLErrors) {
|
||||||
|
|
@ -82,8 +82,8 @@ public class Container extends CO {
|
||||||
return thisContainer;
|
return thisContainer;
|
||||||
} else {
|
} else {
|
||||||
// Let's try to find the URL...
|
// Let's try to find the URL...
|
||||||
int[] tableKeys = MContainer.getAllIDs("CM_Container", "(RelativeURL LIKE '" + URL + "' OR RelativeURL LIKE '" + URL + "/') AND CM_WebProject_ID=" + CM_WebProject_ID, "WebCM");
|
MContainer thisContainer = MContainer.get (ctx, URL, CM_WebProject_ID, "WebCM");
|
||||||
if (tableKeys==null || tableKeys.length==0) {
|
if (thisContainer==null) {
|
||||||
if (resolveURLErrors) {
|
if (resolveURLErrors) {
|
||||||
if (URL.equals("/error404.html")) {
|
if (URL.equals("/error404.html")) {
|
||||||
// Okay we are already been requested as the error message, so we try the index.html
|
// Okay we are already been requested as the error message, so we try the index.html
|
||||||
|
|
@ -98,17 +98,13 @@ public class Container extends CO {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (tableKeys.length==1) {
|
} else {
|
||||||
// Found exactly one record, so we return it
|
// Found exactly one record, so we return it
|
||||||
MContainer thisContainer = getCM_Container("" + tableKeys[0], CM_WebProject_ID);
|
if (thisContainer.isSummary ()) {
|
||||||
if (thisContainer.isSummary ()) {
|
thisContainer = getCM_ContainerByURL(URL + "/index.html", CM_WebProject_ID, resolveURLErrors);
|
||||||
thisContainer = getCM_ContainerByURL(URL + "/index.html", CM_WebProject_ID, resolveURLErrors);
|
}
|
||||||
}
|
return thisContainer;
|
||||||
return thisContainer;
|
|
||||||
} else {
|
|
||||||
// More than one result, this is funny, normally this is not possible :-/
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,31 +16,45 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm.cache;
|
package org.compiere.cm.cache;
|
||||||
|
|
||||||
import org.compiere.model.X_CM_Container_Element;
|
import org.compiere.model.MContainerElement;
|
||||||
|
|
||||||
public class ContainerElement extends CO {
|
/**
|
||||||
public X_CM_Container_Element getCM_Container_Element(int ID, int CM_WebProject_ID) {
|
* Container Element Cache
|
||||||
return getCM_Container_Element(""+ ID, CM_WebProject_ID);
|
*
|
||||||
}
|
* @author Yves Sandfort
|
||||||
|
* @version $Id$
|
||||||
public X_CM_Container_Element getCM_Container_Element(String ID, int CM_WebProject_ID) {
|
*/
|
||||||
if (cache.containsKey(ID)) {
|
public class ContainerElement extends CO {
|
||||||
use(ID);
|
/**
|
||||||
return (X_CM_Container_Element) cache.get(ID);
|
* getCM_Container_Element
|
||||||
} else {
|
* @param ID
|
||||||
int[] tableKeys = X_CM_Container_Element.getAllIDs("CM_Container_Element", "CM_Container_Element_ID=" + ID, "WebCM");
|
* @param CM_WebProject_ID
|
||||||
if (tableKeys==null || tableKeys.length==0) {
|
* @return Container Element
|
||||||
// No Elements in DB found, needs to get handled
|
*/
|
||||||
return null;
|
public MContainerElement getCM_Container_Element(String ID, int CM_WebProject_ID) {
|
||||||
} else if (tableKeys.length==1) {
|
return getCM_Container_Element(Integer.parseInt(ID), CM_WebProject_ID);
|
||||||
X_CM_Container_Element thisContainerElement = new X_CM_Container_Element(ctx, tableKeys[0], "WebCM");
|
}
|
||||||
put ("" + thisContainerElement.get_ID(),thisContainerElement);
|
|
||||||
return thisContainerElement;
|
/**
|
||||||
} else {
|
* getCM_Container_Element
|
||||||
// More than one result, this is funny, normally this is not possible :-/
|
* @param ID
|
||||||
return null;
|
* @param CM_WebProject_ID
|
||||||
|
* @return Container Element
|
||||||
|
*/
|
||||||
|
public MContainerElement getCM_Container_Element(int ID, int CM_WebProject_ID) {
|
||||||
|
if (cache.containsKey(ID)) {
|
||||||
|
use(ID);
|
||||||
|
return (MContainerElement) cache.get(ID);
|
||||||
|
} else {
|
||||||
|
MContainerElement thisContainerElement = MContainerElement.get(ctx, ID, "WebCM");
|
||||||
|
if (thisContainerElement==null) {
|
||||||
|
// No Elements in DB found, needs to get handled
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
put ("" + thisContainerElement.get_ID(),thisContainerElement);
|
||||||
|
return thisContainerElement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,23 @@ import java.util.*;
|
||||||
import org.compiere.cm.utils.TreeXML;
|
import org.compiere.cm.utils.TreeXML;
|
||||||
import org.compiere.model.MWebProject;
|
import org.compiere.model.MWebProject;
|
||||||
|
|
||||||
public class ContainerTree extends CO {
|
/**
|
||||||
|
* Container Tree Cache
|
||||||
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
*
|
||||||
|
* @author Yves Sandfort
|
||||||
public StringBuffer getContainerTree(Properties ctx, int ID, String trxName) {
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ContainerTree extends CO {
|
||||||
|
|
||||||
|
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getContainerTree
|
||||||
|
* @param ID
|
||||||
|
* @param trxName
|
||||||
|
* @return XML StringBuffer
|
||||||
|
*/
|
||||||
|
public StringBuffer getContainerTree(int ID, String trxName) {
|
||||||
StringBuffer xmlCode = new StringBuffer();
|
StringBuffer xmlCode = new StringBuffer();
|
||||||
if (cache.containsKey("" + ID)) {
|
if (cache.containsKey("" + ID)) {
|
||||||
use("" + ID);
|
use("" + ID);
|
||||||
|
|
|
||||||
|
|
@ -38,47 +38,17 @@ public class Domain extends CO
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int[] tableKeys = MWebProjectDomain.getAllIDs (
|
MWebProjectDomain thisWebProjectDomain = MWebProjectDomain.get(ctx, serverName, "WebCM");
|
||||||
"CM_WebProject_Domain",
|
if (thisWebProjectDomain==null)
|
||||||
"lower(FQDN) LIKE '" + serverName + "'", "WebCM");
|
{
|
||||||
if (tableKeys==null || tableKeys.length == 0)
|
// HardCoded to deliver the GardenWorld Site as default
|
||||||
{
|
return null;
|
||||||
// HardCoded to deliver the GardenWorld Site as default
|
}
|
||||||
return null;
|
else
|
||||||
}
|
{
|
||||||
else if (tableKeys.length == 1)
|
put (thisWebProjectDomain.getFQDN (), thisWebProjectDomain);
|
||||||
{
|
return thisWebProjectDomain;
|
||||||
MWebProjectDomain thisDomain = new MWebProjectDomain (
|
}
|
||||||
ctx, tableKeys[0], "WebCM");
|
}
|
||||||
put (thisDomain.getFQDN (), thisDomain);
|
} // getWebProjectDomain
|
||||||
return thisDomain;
|
} // Domain
|
||||||
}
|
|
||||||
// We found more than one hit, this is bad, so we will try to use the first non system / gardenworld one
|
|
||||||
else if (tableKeys.length>1)
|
|
||||||
{
|
|
||||||
for (int i=0;i<tableKeys.length;i++) {
|
|
||||||
if (tableKeys[i]>=1000000) {
|
|
||||||
MWebProjectDomain thisDomain = new MWebProjectDomain (
|
|
||||||
ctx, tableKeys[i], "WebCM");
|
|
||||||
put (thisDomain.getFQDN (), thisDomain);
|
|
||||||
return thisDomain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// We can't find any non system/gardenworld hit, so we will try the first one
|
|
||||||
for (int i=0;i<tableKeys.length;i++) {
|
|
||||||
MWebProjectDomain thisDomain = new MWebProjectDomain (
|
|
||||||
ctx, tableKeys[0], "WebCM");
|
|
||||||
put (thisDomain.getFQDN (), thisDomain);
|
|
||||||
return thisDomain;
|
|
||||||
}
|
|
||||||
// As even this doesn't work we return null
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // getWebProjectDomain
|
|
||||||
|
|
||||||
} // Domain
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,24 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.compiere.cm.*;
|
import org.compiere.cm.*;
|
||||||
|
|
||||||
public class Service extends HttpServletCM {
|
/**
|
||||||
|
* Cache Object Service classes
|
||||||
|
*
|
||||||
|
* @author Yves Sandfort
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class Service extends HttpServletCM {
|
||||||
|
/** serialVersionUID */
|
||||||
|
private static final long serialVersionUID = 167843885331587478L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* doGet
|
||||||
|
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,9 @@ import java.sql.SQLException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
|
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.cm.HttpServletCM;
|
import org.compiere.cm.HttpServletCM;
|
||||||
|
|
@ -111,7 +107,7 @@ public class Generator
|
||||||
private void generateSystemHeader (HttpServletCM thisServlet)
|
private void generateSystemHeader (HttpServletCM thisServlet)
|
||||||
{
|
{
|
||||||
xmlCode.append ("<system>\n");
|
xmlCode.append ("<system>\n");
|
||||||
xmlCode.append ("<adempiere>\n");
|
xmlCode.append ("<compiere>\n");
|
||||||
xmlCode.append ("<mainversion>" + Adempiere.MAIN_VERSION
|
xmlCode.append ("<mainversion>" + Adempiere.MAIN_VERSION
|
||||||
+ "</mainversion>\n");
|
+ "</mainversion>\n");
|
||||||
xmlCode.append ("<dateversion>" + Adempiere.DATE_VERSION
|
xmlCode.append ("<dateversion>" + Adempiere.DATE_VERSION
|
||||||
|
|
@ -238,7 +234,7 @@ public class Generator
|
||||||
//genTable("AD_Role", "AD_Role.IsActive='Y' AND AD_Role.AD_Client_ID=" + l_nClientID + " ORDER BY AD_Role.AD_Role_ID", false, ctx, wi);
|
//genTable("AD_Role", "AD_Role.IsActive='Y' AND AD_Role.AD_Client_ID=" + l_nClientID + " ORDER BY AD_Role.AD_Role_ID", false, ctx, wi);
|
||||||
genTable("C_Activity", "C_Activity.IsActive='Y' AND C_Activity.AD_Client_ID=" + l_nClientID + " ORDER BY C_Activity.C_Activity_ID", false, ctx, wi);
|
genTable("C_Activity", "C_Activity.IsActive='Y' AND C_Activity.AD_Client_ID=" + l_nClientID + " ORDER BY C_Activity.C_Activity_ID", false, ctx, wi);
|
||||||
genTable("C_Campaign", "C_Campaign.IsActive='Y' AND C_Campaign.AD_Client_ID=" + l_nClientID + " ORDER BY C_Campaign.C_Campaign_ID", false, ctx, wi);
|
genTable("C_Campaign", "C_Campaign.IsActive='Y' AND C_Campaign.AD_Client_ID=" + l_nClientID + " ORDER BY C_Campaign.C_Campaign_ID", false, ctx, wi);
|
||||||
genTable("M_Product", "M_Product.IsActive='Y' AND M_Product.AD_Client_ID=" + l_nClientID + " ORDER BY M_Product.M_Product_ID", false, ctx, wi);
|
genTable("M_Product", "M_Product.IsActive='Y' AND M_Product.AD_Client_ID=" + l_nClientID + " AND M_Product.Value like 'cd_%' ORDER BY M_Product.M_Product_ID", false, ctx, wi);
|
||||||
genTable("M_RMA", "M_RMA.IsActive='Y' AND M_RMA.AD_Client_ID=" + l_nClientID + " ORDER BY M_RMA.M_RMA_ID", false, ctx, wi);
|
genTable("M_RMA", "M_RMA.IsActive='Y' AND M_RMA.AD_Client_ID=" + l_nClientID + " ORDER BY M_RMA.M_RMA_ID", false, ctx, wi);
|
||||||
genTable("R_Category", "R_Category.IsActive='Y' AND R_Category.AD_Client_ID=" + l_nClientID + " ORDER BY R_Category.R_Category_ID", false, ctx, wi);
|
genTable("R_Category", "R_Category.IsActive='Y' AND R_Category.AD_Client_ID=" + l_nClientID + " ORDER BY R_Category.R_Category_ID", false, ctx, wi);
|
||||||
genTable("R_Group", "R_Group.IsActive='Y' AND R_Group.AD_Client_ID=" + l_nClientID + " ORDER BY R_Group.R_Group_ID", false, ctx, wi);
|
genTable("R_Group", "R_Group.IsActive='Y' AND R_Group.AD_Client_ID=" + l_nClientID + " ORDER BY R_Group.R_Group_ID", false, ctx, wi);
|
||||||
|
|
@ -465,8 +461,10 @@ public class Generator
|
||||||
|
|
||||||
private void generateContainerTree (ContainerTree containerTreeCache)
|
private void generateContainerTree (ContainerTree containerTreeCache)
|
||||||
{
|
{
|
||||||
xmlCode.append (containerTreeCache.getContainerTree (containerTreeCache
|
/* xmlCode.append (containerTreeCache.getContainerTree (containerTreeCache
|
||||||
.getCtx (), thisRequest.getWebProject ().get_ID (), null));
|
.getCtx (), thisRequest.getWebProject ().get_ID (), null));*/
|
||||||
|
xmlCode.append (containerTreeCache.getContainerTree (
|
||||||
|
thisRequest.getWebProject ().get_ID (), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue