📄 savecontextaction.java
字号:
// Perform attribute updates as requested
String attribute = null;
try {
ObjectName coname = new ObjectName(cObjectName);
ObjectName loname = new ObjectName(lObjectName);
ObjectName moname = new ObjectName(mObjectName);
attribute = "debug";
int debug = 0;
try {
debug = Integer.parseInt(cform.getDebugLvl());
} catch (Throwable t) {
debug = 0;
}
mBServer.setAttribute(coname,
new Attribute("debug", new Integer(debug)));
attribute = "path";
String path = "";
try {
path = cform.getPath();
} catch (Throwable t) {
path = "";
}
mBServer.setAttribute(coname,
new Attribute("path", path));
attribute = "workDir";
String workDir = "";
workDir = cform.getWorkDir();
if ((workDir!=null) && (workDir.length()>=1)) {
mBServer.setAttribute(coname,
new Attribute("workDir", workDir));
}
attribute = "cookies";
String cookies = "false";
try {
cookies = cform.getCookies();
} catch (Throwable t) {
cookies = "false";
}
mBServer.setAttribute(coname,
new Attribute("cookies", new Boolean(cookies)));
attribute = "crossContext";
String crossContext = "false";
try {
crossContext = cform.getCrossContext();
} catch (Throwable t) {
crossContext = "false";
}
mBServer.setAttribute(coname,
new Attribute("crossContext", new Boolean(crossContext)));
attribute = "override";
String override = "false";
try {
override = cform.getOverride();
} catch (Throwable t) {
override = "false";
}
mBServer.setAttribute(coname,
new Attribute("override", new Boolean(override)));
attribute = "reloadable";
String reloadable = "false";
try {
reloadable = cform.getReloadable();
} catch (Throwable t) {
reloadable = "false";
}
mBServer.setAttribute(coname,
new Attribute("reloadable", new Boolean(reloadable)));
attribute = "swallowOutput";
String swallowOutput = "false";
try {
swallowOutput = cform.getSwallowOutput();
} catch (Throwable t) {
swallowOutput = "false";
}
mBServer.setAttribute(coname,
new Attribute("swallowOutput", new Boolean(swallowOutput)));
attribute = "useNaming";
String useNaming = "false";
try {
useNaming = cform.getUseNaming();
} catch (Throwable t) {
useNaming = "false";
}
mBServer.setAttribute(coname,
new Attribute("useNaming", new Boolean(useNaming)));
// Loader properties
attribute = "reloadable";
try {
reloadable = cform.getLdrReloadable();
} catch (Throwable t) {
reloadable = "false";
}
mBServer.setAttribute(loname,
new Attribute("reloadable", new Boolean(reloadable)));
attribute = "debug";
try {
debug = Integer.parseInt(cform.getLdrDebugLvl());
} catch (Throwable t) {
debug = 0;
}
mBServer.setAttribute(loname,
new Attribute("debug", new Integer(debug)));
//attribute = "checkInterval";
//int checkInterval = 15;
//try {
// checkInterval = Integer.parseInt(cform.getLdrCheckInterval());
//} catch (Throwable t) {
// checkInterval = 15;
//}
//mBServer.setAttribute(loname,
// new Attribute("checkInterval", new Integer(checkInterval)));
// Manager properties
attribute = "entropy";
String entropy = cform.getMgrSessionIDInit();
if ((entropy!=null) && (entropy.length()>=1)) {
mBServer.setAttribute(moname,
new Attribute("entropy",entropy));
}
attribute = "debug";
try {
debug = Integer.parseInt(cform.getMgrDebugLvl());
} catch (Throwable t) {
debug = 0;
}
mBServer.setAttribute(moname,
new Attribute("debug", new Integer(debug)));
//attribute = "checkInterval";
//try {
// checkInterval = Integer.parseInt(cform.getMgrCheckInterval());
//} catch (Throwable t) {
// checkInterval = 60;
//}
//mBServer.setAttribute(moname,
// new Attribute("checkInterval", new Integer(checkInterval)));
attribute = "maxActiveSessions";
int maxActiveSessions = -1;
try {
maxActiveSessions = Integer.parseInt(cform.getMgrMaxSessions());
} catch (Throwable t) {
maxActiveSessions = -1;
}
mBServer.setAttribute(moname,
new Attribute("maxActiveSessions", new Integer(maxActiveSessions)));
} catch (Exception e) {
getServlet().log
(resources.getMessage(locale, "users.error.attribute.set",
attribute), e);
response.sendError
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
resources.getMessage(locale, "users.error.attribute.set",
attribute));
return (null);
}
// Forward to the success reporting page
session.removeAttribute(mapping.getAttribute());
return (mapping.findForward("Save Successful"));
}
/**
* Append nodes for any define resources for the specified Context.
*
* @param containerNode Container node for the tree control
* @param containerName Object name of the parent container
* @param resources The MessageResources for our localized messages
* messages
*/
public void addToTreeControlNode(ObjectName oname, String containerName,
String parentName, MessageResources resources,
HttpSession session)
throws Exception {
String domain = oname.getDomain();
TreeControl control = (TreeControl) session.getAttribute("treeControlTest");
if (control != null) {
TreeControlNode parentNode = control.findNode(parentName);
if (parentNode != null) {
String type = "Context";
String path = "";
String host = "";
String name = oname.getKeyProperty("name");
if ((name != null) && (name.length() > 0)) {
name = name.substring(2);
int i = name.indexOf("/");
host = name.substring(0,i);
path = name.substring(i);
}
String nodeLabel = "Context (" + path + ")";
String encodedName = URLEncoder.encode(oname.toString());
TreeControlNode childNode =
new TreeControlNode(oname.toString(),
"Context.gif",
nodeLabel,
"EditContext.do?select=" +
encodedName,
"content",
true, domain);
parentNode.addChild(childNode);
// FIXME - force a redisplay
TreeControlNode subtree = new TreeControlNode
("Context Resource Administration " + containerName,
"folder_16_pad.gif",
resources.getMessage("resources.treeBuilder.subtreeNode"),
null,
"content",
true, domain);
childNode.addChild(subtree);
TreeControlNode datasources = new TreeControlNode
("Context Data Sources " + containerName,
"Datasource.gif",
resources.getMessage("resources.treeBuilder.datasources"),
"resources/listDataSources.do?resourcetype=" +
URLEncoder.encode(type) + "&path=" +
URLEncoder.encode(path) + "&host=" +
URLEncoder.encode(host) + "&forward=" +
URLEncoder.encode("DataSources List Setup"),
"content",
false, domain);
TreeControlNode mailsessions = new TreeControlNode
("Context Mail Sessions " + containerName,
"Mailsession.gif",
resources.getMessage("resources.treeBuilder.mailsessions"),
"resources/listMailSessions.do?resourcetype=" +
URLEncoder.encode(type) + "&path=" +
URLEncoder.encode(path) + "&host=" +
URLEncoder.encode(host) + "&forward=" +
URLEncoder.encode("MailSessions List Setup"),
"content",
false, domain);
TreeControlNode resourcelinks = new TreeControlNode
("Resource Links " + containerName,
"ResourceLink.gif",
resources.getMessage("resources.treeBuilder.resourcelinks"),
"resources/listResourceLinks.do?resourcetype=" +
URLEncoder.encode(type) + "&path=" +
URLEncoder.encode(path) + "&host=" +
URLEncoder.encode(host) + "&forward=" +
URLEncoder.encode("ResourceLinks List Setup"),
"content",
false, domain);
TreeControlNode envs = new TreeControlNode
("Context Environment Entries "+ containerName,
"EnvironmentEntries.gif",
resources.getMessage("resources.env.entries"),
"resources/listEnvEntries.do?resourcetype=" +
URLEncoder.encode(type) + "&path=" +
URLEncoder.encode(path) + "&host=" +
URLEncoder.encode(host) + "&forward=" +
URLEncoder.encode("EnvEntries List Setup"),
"content",
false, domain);
subtree.addChild(datasources);
subtree.addChild(mailsessions);
subtree.addChild(resourcelinks);
subtree.addChild(envs);
} else {
getServlet().log
("Cannot find parent node '" + parentName + "'");
}
}else {
getServlet().log("Cannot find TreeControlNode!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -