雇员工作空间系列: 配置和开发 DB2 Content Manager 8.2 的单点登录 portlet
2008-10-15 16:33:07 来源:WEB开发网CMBConnection 的方法 connectWithCredential() 接受三个参数:服务器名(server name)、凭证对象(credential object)和连接字符串(connect string)。为了在连接 Content Manager 服务器时启用 LTPA 令牌作为凭证,需要添加下列代码,将 Content Manager 服务器连接到 TConnect.java:
/**
* Connects to a given server using LTPA token.
* @param connection an instance of CMBConnection bean
* @param dstype the datastore type.
* @param server the server name. A connection string can
* also be specified following the name, in parenthesis
* @param ltpaToken the ltpaToken.
*/
public static void connect(CMBConnection connection, String dstype,
String server, String ltpaToken)
throws Exception {
// If the server name is followed by a parenthesized string,
// use that string for the connect string.
if (server.indexOf("(") > 0) {
String connectString = server.substring(server.indexOf("(")+1);
server = server.substring(0, server.indexOf("("));
if (connectString.endsWith(")")) {
connectString = connectString.substring(0,
connectString.length() - 1);
}
connection.setConnectString(connectString);
}
// Set properties on connection bean
connection.setDsType(dstype);
// Use the connect method to connect. This will
// create the correct type of DKDatastore object (see Java API)
// and call its connect method.
System.out.println("Connecting to server");
connection.connectWithCredential(server, ltpaToken, "");
System.out.println("OK, Connected");
// Enable display names support. This will cause
// CMBSchemaManagement, CMBEntity, CMBAttribute, CMBItem to use
// display names when working with CMv8 (default is to use
// non-display names).
connection.setDisplayNamesEnabled(true);
}
- ››工作中的C++:基本原理,重点推荐和结束语
- ››工作流编程循序渐进(5:状态机工作流)
- ››工作流编程循序渐进(1:代码活动与时间延迟活动)...
- ››工作流编程循序渐进(2:IfElseActivity活动)
- ››工作流编程循序渐进(3:While活动)
- ››工作流编程循序渐进(4:InvokeWorkflowActivity活...
- ››工作组环境下WPAD部署的另类解决--WINS解析
- ››空间商限制功能阻止SEO优化
- ››雇员工作空间系列: 配置和开发DB2 Content Manage...
- ››工作负载分区(WPAR)中的资源控制
- ››工作娱乐两不误 听歌就用E音乐盒
- ››工作中常用的高效的CSS代码
更多精彩
赞助商链接