在 Geronimo 中管理 Apache Pluto
2010-03-30 00:00:00 来源:WEB开发网在将 ConfigService 组件打包到 Geronimo GBean 中并由内核装入和启动之后,JavaServer Page (JSP) 组件或 servlet 可以使用 GBean 来访问 ConfigService 组件所管理的信息。
清单 4 中的 JSP 示例演示了如何检索 ConfigService GBean 以及如何使用它获得和设定 ConfigService 组件所管理的信息。
清单 4. ConfigService GBean 的管理页面
<h3>Pluto Admin on Geronimo: Config Service</h3>
<%
try
{
com.devworks.pluto.gbeans.GBeanManager.loadAndStartGBean(
com.devworks.pluto.gbeans.ConfigServiceGBean.class,
com.devworks.pluto.gbeans.ConfigServiceGBean.GBEAN_INFO,
"config");
Object gbeanObj =
com.devworks.pluto.gbeans.GBeanManager.getGBean(
com.devworks.pluto.gbeans.ConfigServiceGBean.class);
if (gbeanObj != null)
{
com.devworks.pluto.gbeans.ConfigServiceGBean configServiceGBean =
(com.devworks.pluto.gbeans.ConfigServiceGBean)gbeanObj;
java.util.Enumeration reqParams = request.getParameterNames();
while (reqParams.hasMoreElements())
{
String paramName = (String)reqParams.nextElement();
String newParamValue = request.getParameter(paramName);
String oldParamValue = configServiceGBean.getString(paramName);
if (newParamValue.equalsIgnoreCase(oldParamValue) == false)
{
System.out.println("Setting param: " + paramName + " to value: "
+ newParamValue);
configServiceGBean.setString(paramName, newParamValue);
}
}
out.println("<form name='configForm' method='post' "
+ "action='ConfigServiceAdmin.jsp'><table>");
java.util.Iterator keys = configServiceGBean.paramKeys();
while (keys.hasNext())
{
String paramKey = keys.next().toString();
String paramValue = configServiceGBean.getString(paramKey);
out.println("<tr><td>Param " + paramKey + "</td>"
+ "<td><input type='text' name='" + paramKey
+ "' value='" + paramValue + "'/></td>"
+ "<td><input type='submit' value='submit'/></td></tr>");
}
out.println("</table>");
com.devworks.pluto.gbeans.GBeanManager.stopAndUnloadGBean(
com.devworks.pluto.gbeans.ConfigServiceGBean.class);
}
else
{
out.println("Unable to find ConfigServiceGBean<br/>");
}
}
catch(Exception e)
{
e.printStackTrace(System.out);
out.println("<br/>Exception: " + e);
}
%>
- ››apache设置域名绑定 以及绑定不起作用的排查
- ››apache rewrite将指定URL转向指定的几个服务器
- ››apache配置文件httpd.comf部分参数说明
- ››Apache+Mysql+PHP+phpMyAdmin+Mac OS X 10.7 Lion...
- ››管理/var/spool/clientmqueue/下的大文件
- ››apache+tomcat负载均衡_项目实例
- ››apache mysql php 源码编译使用
- ››Apache添加mod_aspdotnet.so支持ASP.NET配置指南
- ››Apache中改变php.ini的路径
- ››Apache2.2与Tomcat6整合及虚拟主机配置
- ››Apache+php+mysql在windows下的安装与配置图解
- ››Apache+Subversion完美结合,CentOS下实现版本控制...
更多精彩
赞助商链接