Revision: 4119
Author: seba.wagner
Date: Sun Aug 28 02:16:36 2011
Log: Some workaround for the Servlet initialization problem
http://code.google.com/p/openmeetings/source/detail?r=4119
Added:
/branches/dev/injection/src/templates/booting.vm
Modified:
/branches/dev/injection/WebContent/WEB-INF/root-web.xml
/branches/dev/injection/src/app/org/openmeetings/servlet/outputhandler/DefaultIndex.java
=======================================
--- /dev/null
+++ /branches/dev/injection/src/templates/booting.vm Sun Aug 28 02:16:36
2011
@@ -0,0 +1,14 @@
+## OpenMeetings
+## author swagner
+## 16.05.2007
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0
Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
+<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='de' lang='de'>
+<head>
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+</head>
+<body>
+<b>OpenMeetings - Loading ...</b><br />
+The server is not yet completely initialized. Please try again in a couple
of seconds.<br/>
+If this message persists for several minutes contact your
Sys-Administration.
+</body>
+</html>
=======================================
--- /branches/dev/injection/WebContent/WEB-INF/root-web.xml Thu Jun 9
07:06:59 2011
+++ /branches/dev/injection/WebContent/WEB-INF/root-web.xml Sun Aug 28
02:16:36 2011
@@ -12,7 +12,7 @@
<bean id="web.scope" class="org.red5.server.WebScope"
init-method="register">
<property name="server" ref="red5.server" />
- <property name="parent" ref="global.scope" />
+ <property name="parent" ref="global.scope" />
<property name="context" ref="web.context" />
<property name="handler" ref="global.handler" />
<property name="contextPath" value="/" />
=======================================
---
/branches/dev/injection/src/app/org/openmeetings/servlet/outputhandler/DefaultIndex.java
Sat Aug 13 22:42:00 2011
+++
/branches/dev/injection/src/app/org/openmeetings/servlet/outputhandler/DefaultIndex.java
Sun Aug 28 02:16:36 2011
@@ -4,7 +4,6 @@
import java.util.HashMap;
import java.util.Iterator;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -17,148 +16,187 @@
import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
public class DefaultIndex extends VelocityViewServlet {
private static final long serialVersionUID = 3043617619650666432L;
- private static final Logger log =
Red5LoggerFactory.getLogger(DefaultIndex.class,
ScopeApplicationAdapter.webAppRootKey);
-
- private Configurationmanagement cfgManagement;
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- cfgManagement =
(Configurationmanagement)config.getServletContext().getAttribute("cfgManagement");
- log.error("in init: cfgManagement is null ? " + (null == cfgManagement)
+ " ; " + cfgManagement);
- }
-
+ private static final Logger log = Red5LoggerFactory.getLogger(
+ DefaultIndex.class,
ScopeApplicationAdapter.webAppRootKey);
+
+ // // private Configurationmanagement cfgManagement;
+ //
+ // @Override
+ // public void init(ServletConfig config) throws ServletException {
+ // super.init(config);
+ // // cfgManagement = (Configurationmanagement)
config.getServletContext()
+ // // .getAttribute("getConfigurationmanagement()");
+ // // log.error("in init: cfgManagement is null ? " + (null ==
+ // // cfgManagement)
+ // // + " ; " + cfgManagement);
+ // }
+
+ private Configurationmanagement getConfigurationmanagement() {
+ try {
+ ApplicationContext context = WebApplicationContextUtils
+
.getWebApplicationContext(getServletContext());
+ return (Configurationmanagement)
context.getBean("cfgManagement");
+ } catch (Exception err) {
+ log.error("[getConfigurationmanagement]", err);
+ }
+ return null;
+ }
+
@Override
public Template handleRequest(HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse, Context ctx) throws
ServletException,
- IOException {
+ HttpServletResponse httpServletResponse, Context ctx)
+ throws ServletException, IOException {
try {
-
+
+ if (getConfigurationmanagement() == null) {
+ return
getVelocityEngine().getTemplate("booting.vm");
+ }
+
String template = "sip_template.vm";
-
- //Enable SIP Template or not
- Configuration SIP_ENABLE = cfgManagement.getConfKey(3L,
"sip.enable");
-
- //SIP_REALM
- Configuration application_name =
cfgManagement.getConfKey(3L, "application.name");
+
+ // Enable SIP Template or not
+ Configuration SIP_ENABLE =
getConfigurationmanagement().getConfKey(
+ 3L, "sip.enable");
+
+ // SIP_REALM
+ Configuration application_name =
getConfigurationmanagement()
+ .getConfKey(3L, "application.name");
if (application_name == null) {
- ctx.put("APPLICATION_NAME",
getServletContext().getServletContextName());
+ ctx.put("APPLICATION_NAME", getServletContext()
+ .getServletContextName());
} else {
ctx.put("APPLICATION_NAME",
application_name.getConf_value());
}
-
+
if (SIP_ENABLE == null ||
!SIP_ENABLE.getConf_value().equals("yes")) {
-
+
template = "usual_template.vm";
-
+
} else {
-
- //Set all the Params for the Applet
Configuration
-
- //SIP_REALM
- Configuration SIP_REALM = cfgManagement.getConfKey(3L,
"sip.realm");
+
+ // Set all the Params for the Applet
Configuration
+
+ // SIP_REALM
+ Configuration SIP_REALM =
getConfigurationmanagement()
+ .getConfKey(3L, "sip.realm");
if (SIP_REALM == null) {
ctx.put("SIP_REALM", "");
} else {
ctx.put("SIP_REALM",
SIP_REALM.getConf_value());
}
-
- //SIP_PORT
- Configuration SIP_PORT = cfgManagement.getConfKey(3L,
"sip.port");
+
+ // SIP_PORT
+ Configuration SIP_PORT =
getConfigurationmanagement()
+ .getConfKey(3L, "sip.port");
if (SIP_PORT == null) {
ctx.put("SIP_PORT", "");
} else {
ctx.put("SIP_PORT",
SIP_PORT.getConf_value());
}
-
- //SIP_PROXYNAME
- Configuration SIP_PROXYNAME =
cfgManagement.getConfKey(3L, "sip.proxyname");
+
+ // SIP_PROXYNAME
+ Configuration SIP_PROXYNAME =
getConfigurationmanagement()
+ .getConfKey(3L,
"sip.proxyname");
if (SIP_PROXYNAME == null) {
ctx.put("SIP_PROXYNAME", "");
} else {
ctx.put("SIP_PROXYNAME",
SIP_PROXYNAME.getConf_value());
}
-
- //SIP_TUNNEL
- Configuration SIP_TUNNEL = cfgManagement.getConfKey(3L,
"sip.tunnel");
+
+ // SIP_TUNNEL
+ Configuration SIP_TUNNEL =
getConfigurationmanagement()
+ .getConfKey(3L, "sip.tunnel");
if (SIP_TUNNEL == null) {
ctx.put("SIP_TUNNEL", "");
} else {
ctx.put("SIP_TUNNEL",
SIP_TUNNEL.getConf_value());
}
-
- //SIP_CODEBASE
- Configuration SIP_CODEBASE =
cfgManagement.getConfKey(3L, "sip.codebase");
+
+ // SIP_CODEBASE
+ Configuration SIP_CODEBASE =
getConfigurationmanagement()
+ .getConfKey(3L, "sip.codebase");
if (SIP_CODEBASE == null) {
ctx.put("SIP_CODEBASE", "");
} else {
ctx.put("SIP_CODEBASE",
SIP_CODEBASE.getConf_value());
}
-
- //SIP_FORCETUNNEL
- Configuration SIP_FORCETUNNEL =
cfgManagement.getConfKey(3L, "sip.forcetunnel");
+
+ // SIP_FORCETUNNEL
+ Configuration SIP_FORCETUNNEL =
getConfigurationmanagement()
+ .getConfKey(3L,
"sip.forcetunnel");
if (SIP_FORCETUNNEL == null) {
ctx.put("SIP_FORCETUNNEL", "");
} else {
ctx.put("SIP_FORCETUNNEL",
SIP_FORCETUNNEL.getConf_value());
}
}
-
- //Parse the Param for the SWF URL
+
+ // Parse the Param for the SWF URL
String swf = httpServletRequest.getParameter("swf");
if (swf == null) {
ctx.put("SWF_URL", "main.swf8.swf");
} else {
ctx.put("SWF_URL", swf);
}
-
+
String SWF_PARAMS = "";
String SWF_FLASHVARS = "";
-
- //Load params from URL and set into wrapper code
+
+ // Load params from URL and set into wrapper code
if (httpServletRequest.getParameterMap() != null) {
- for (Iterator<String> iter =
httpServletRequest.getParameterMap().keySet().iterator();iter.hasNext();) {
+ for (Iterator<String> iter = httpServletRequest
+
.getParameterMap().keySet().iterator(); iter.hasNext();) {
String paramKey = iter.next();
- SWF_FLASHVARS +=
paramKey+"="+httpServletRequest.getParameterMap().get(paramKey)+"&";
- SWF_PARAMS +=
paramKey+"="+httpServletRequest.getParameterMap().get(paramKey)+"&";
+ SWF_FLASHVARS += paramKey
+ + "="
+ +
httpServletRequest.getParameterMap()
+ .get(paramKey) +
"&";
+ SWF_PARAMS += paramKey
+ + "="
+ +
httpServletRequest.getParameterMap()
+ .get(paramKey) +
"&";
}
}
-
- HashMap<String,String> defaultValuesMap = new
HashMap<String,String>();
-
- defaultValuesMap.put("lzt","swf");
- defaultValuesMap.put("lzproxied","solo");
- defaultValuesMap.put("lzr","swf8");
- defaultValuesMap.put("bgcolor","%23ffffff");
- defaultValuesMap.put("width","100%25");
- defaultValuesMap.put("height","100%25");
-
//defaultValuesMap.put("__lzurl","main.lzx%3Flzt%3Dswf%26lzproxied%3Dsolo%26lzr%3Dswf8");
- defaultValuesMap.put("__lzminimumversion","8");
- defaultValuesMap.put("id","lzapp");
-
- for (Iterator<String> iter =
defaultValuesMap.keySet().iterator();iter.hasNext();) {
+
+ HashMap<String, String> defaultValuesMap = new HashMap<String,
String>();
+
+ defaultValuesMap.put("lzt", "swf");
+ defaultValuesMap.put("lzproxied", "solo");
+ defaultValuesMap.put("lzr", "swf8");
+ defaultValuesMap.put("bgcolor", "%23ffffff");
+ defaultValuesMap.put("width", "100%25");
+ defaultValuesMap.put("height", "100%25");
+ //
defaultValuesMap.put("__lzurl","main.lzx%3Flzt%3Dswf%26lzproxied%3Dsolo%26lzr%3Dswf8");
+ defaultValuesMap.put("__lzminimumversion", "8");
+ defaultValuesMap.put("id", "lzapp");
+
+ for (Iterator<String> iter =
defaultValuesMap.keySet().iterator(); iter
+ .hasNext();) {
String paramKey = iter.next();
- SWF_PARAMS +=
paramKey+"="+defaultValuesMap.get(paramKey);
- SWF_FLASHVARS +=
paramKey+"="+defaultValuesMap.get(paramKey);
+ SWF_PARAMS += paramKey + "=" +
defaultValuesMap.get(paramKey);
+ SWF_FLASHVARS += paramKey + "="
+ +
defaultValuesMap.get(paramKey);
if (iter.hasNext()) {
SWF_PARAMS += "&";
SWF_FLASHVARS += "&";
}
}
-
+
ctx.put("SWF_PARAMS", SWF_PARAMS);
ctx.put("SWF_FLASHVARS", SWF_FLASHVARS);
-
+
return getVelocityEngine().getTemplate(template);
-
+
} catch (Exception er) {
System.out.println("Error downloading: " + er);
er.printStackTrace();
- log.error("[Calendar :: service]",er);
+ log.error("[Calendar :: service]", er);
}
return null;
}
--
You received this message because you are subscribed to the Google Groups
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/openmeetings-dev?hl=en.