本文整理汇总了Java中org.apache.axis2.context.ConfigurationContext.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContext.setProperty方法的具体用法?Java ConfigurationContext.setProperty怎么用?Java ConfigurationContext.setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.context.ConfigurationContext
的用法示例。
在下文中一共展示了ConfigurationContext.setProperty方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStubs
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
private Stubs getStubs(String serverUrl) throws Exception
{
final ConfigurationContext ctx = getConfiguration();
final HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.ProxyProperties();
final ProxyDetails proxy = configService.getProxyDetails();
if( proxy.isConfigured() && !proxy.isHostExcepted(new URL(serverUrl).getHost()) )
{
proxyProperties.setProxyName(proxy.getHost());
proxyProperties.setProxyPort(proxy.getPort());
ctx.setProperty(HTTPConstants.PROXY, proxyProperties);
}
ctx.setProperty(HTTPConstants.SO_TIMEOUT, 120000);
ctx.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 120000);
return new Stubs(ctx, serverUrl);
}
示例2: verifyCertExistence
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
/**
* Check whether the certificate is available in the file system
*
* @param fileName file name
* @param configurationContext configuration context of the current message
*/
private static boolean verifyCertExistence(String fileName, ConfigurationContext configurationContext) {
String workDir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR);
String filePath = workDir + File.separator + "pub_certs" + File.separator + fileName;
File pubCert = new File(workDir + File.separator + "pub_certs" + File.separator + fileName);
//if cert is still available then exit
if (pubCert.exists()) {
Map fileResourcesMap = (Map) configurationContext.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
if (fileResourcesMap == null) {
fileResourcesMap = new Hashtable();
configurationContext.setProperty(WSO2Constants.FILE_RESOURCE_MAP, fileResourcesMap);
}
if (fileResourcesMap.get(fileName) == null) {
fileResourcesMap.put(fileName, filePath);
}
return true;
}
return false;
}
示例3: appendMessage
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
/**
* Appends SOAP message metadata to a message buffer
*
* @param configCtx The server ConfigurationContext
* @param serviceName The service name
* @param operationName The operation name
* @param msgSeq The message sequence. Use -1 if unknown.
*/
protected void appendMessage(ConfigurationContext configCtx,
String serviceName,
String operationName,
Long msgSeq) {
CircularBuffer<MessageInfo> buffer =
(CircularBuffer<MessageInfo>) configCtx.getProperty(TracerConstants.MSG_SEQ_BUFFER);
if (buffer == null){
buffer = new CircularBuffer<MessageInfo>(TracerConstants.MSG_BUFFER_SZ);
configCtx.setProperty(TracerConstants.MSG_SEQ_BUFFER, buffer);
}
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(new Date());
MessageInfo messageInfo = new MessageInfo();
messageInfo.setMessageSequence(msgSeq);
messageInfo.setOperationName(operationName);
messageInfo.setServiceId(serviceName);
messageInfo.setTimestamp(cal);
buffer.append(messageInfo);
}
示例4: Stubs
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
public Stubs(ConfigurationContext ctx, String bbUrl) throws AxisFault
{
this.ctx = ctx;
this.bbUrl = bbUrl;
/*
* Must use deprecated class of setting up security because the SOAP
* response doesn't include a security header. Using the deprecated
* OutflowConfiguration class we can specify that the security
* header is only for the outgoing SOAP message.
*/
ofc = new OutflowConfiguration();
ofc.setActionItems("UsernameToken Timestamp");
ofc.setUser("session");
ofc.setPasswordType("PasswordText");
final MultiThreadedHttpConnectionManager conMan = new MultiThreadedHttpConnectionManager();
final HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setMaxTotalConnections(1000);
params.setDefaultMaxConnectionsPerHost(100);
params.setSoTimeout(60000);
params.setConnectionTimeout(30000);
conMan.setParams(params);
httpClient = new HttpClient(conMan);
final HttpClientParams clientParams = httpClient.getParams();
clientParams.setAuthenticationPreemptive(false);
clientParams.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
contextWebservice = new ContextWSStub(ctx, PathUtils.filePath(bbUrl, "webapps/ws/services/Context.WS"));
initStub(contextWebservice);
}
示例5: dumpCert
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
/**
* Dumping the generated pub. cert to a file
*
* @param configurationContext
* @param cert content of the certificate
* @param fileName file name
* @return file system location of the pub. cert
*/
public static String dumpCert(ConfigurationContext configurationContext, byte[] cert,
String fileName) {
if (!verifyCertExistence(fileName, configurationContext)) {
String workDir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR);
File pubCert = new File(workDir + File.separator + "pub_certs");
if (fileName == null) {
fileName = String.valueOf(System.currentTimeMillis() + new SecureRandom().nextDouble()) + ".cert";
}
if (!pubCert.exists()) {
pubCert.mkdirs();
}
String filePath = workDir + File.separator + "pub_certs" + File.separator + fileName;
OutputStream outStream = null;
try {
outStream = new FileOutputStream(filePath);
outStream.write(cert);
} catch (Exception e) {
String msg = "Error when writing the public certificate to a file";
log.error(msg);
throw new SecurityException("msg", e);
} finally {
IdentityIOStreamUtils.flushOutputStream(outStream);
IdentityIOStreamUtils.closeOutputStream(outStream);
}
Map fileResourcesMap = (Map) configurationContext.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
if (fileResourcesMap == null) {
fileResourcesMap = new Hashtable();
configurationContext.setProperty(WSO2Constants.FILE_RESOURCE_MAP, fileResourcesMap);
}
fileResourcesMap.put(fileName, filePath);
}
return WSO2Constants.ContextPaths.DOWNLOAD_PATH + "?id=" + fileName;
}
示例6: dumpCert
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
/**
* Dumping the generated pub. cert to a file
*
* @param configurationContext
* @param cert content of the certificate
* @param fileName file name
* @return file system location of the pub. cert
*/
public static String dumpCert(ConfigurationContext configurationContext, byte[] cert,
String fileName) {
if (!verifyCertExistence(fileName, configurationContext)) {
String workDir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR);
File pubCert = new File(workDir + File.separator + "pub_certs");
if (fileName == null) {
fileName = String.valueOf(System.currentTimeMillis() + Math.random()) + ".cert";
}
if (!pubCert.exists()) {
pubCert.mkdirs();
}
String filePath = workDir + File.separator + "pub_certs" + File.separator + fileName;
OutputStream outStream = null;
try {
outStream = new FileOutputStream(filePath);
outStream.write(cert);
} catch (Exception e) {
String msg = "Error when writing the public certificate to a file";
log.error(msg);
throw new SecurityException("msg", e);
} finally {
IdentityIOStreamUtils.flushOutputStream(outStream);
IdentityIOStreamUtils.closeOutputStream(outStream);
}
Map fileResourcesMap = (Map) configurationContext.getProperty(WSO2Constants.FILE_RESOURCE_MAP);
if (fileResourcesMap == null) {
fileResourcesMap = new Hashtable();
configurationContext.setProperty(WSO2Constants.FILE_RESOURCE_MAP, fileResourcesMap);
}
fileResourcesMap.put(fileName, filePath);
}
return WSO2Constants.ContextPaths.DOWNLOAD_PATH + "?id=" + fileName;
}
示例7: addApplicationContextMigrator
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
/**
* Register a new ContextPropertyMigrator.
*
* @param configurationContext
* @param contextMigratorListID The name of the property in the ConfigurationContext that
* contains the list of migrators.
* @param migrator
*/
public static void addApplicationContextMigrator(ConfigurationContext configurationContext,
String contextMigratorListID,
ApplicationContextMigrator migrator) {
List<ApplicationContextMigrator> migratorList =
(List<ApplicationContextMigrator>)configurationContext
.getProperty(contextMigratorListID);
if (migratorList == null) {
migratorList = new LinkedList<ApplicationContextMigrator>();
configurationContext.setProperty(contextMigratorListID, migratorList);
}
synchronized (migratorList) {
// Check to make sure we haven't already added this migrator to the
// list.
ListIterator<ApplicationContextMigrator> itr = migratorList.listIterator();
while (itr.hasNext()) {
ApplicationContextMigrator m = itr.next();
if (m.getClass().equals(migrator.getClass())) {
return;
}
}
if (log.isDebugEnabled()) {
log.debug("Adding ApplicationContextMigrator: " + migrator.getClass().getName());
}
migratorList.add(migrator);
}
}
示例8: initConfigContext
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
/**
* Initialize the Axis configuration context
*
* @param config Servlet configuration
* @return ConfigurationContext
* @throws ServletException
*/
protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException {
try {
ConfigurationContext configContext =
ConfigurationContextFactory
.createConfigurationContext(new WarBasedAxisConfigurator(config));
configContext.setProperty(Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE);
return configContext;
} catch (Exception e) {
log.info(e);
throw new ServletException(e);
}
}
示例9: setConfigContext
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
public void setConfigContext(ConfigurationContext configContext) {
// setting ServletContext into configctx
configContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT,
config.getServletContext());
Parameter servletConfigParam = new Parameter();
servletConfigParam.setName(HTTPConstants.HTTP_SERVLETCONFIG);
servletConfigParam.setValue(config);
try {
configContext.getAxisConfiguration().addParameter(servletConfigParam);
} catch (AxisFault axisFault) {
log.error(axisFault.getMessage(), axisFault);
}
super.setConfigContext(configContext);
}
示例10: AutoscalerCloudControllerClient
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
private AutoscalerCloudControllerClient() {
MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new
MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setDefaultMaxConnectionsPerHost(AS_CC_CLIENT_MAX_CONNECTIONS_PER_HOST);
params.setMaxTotalConnections(AS_CC_CLIENT_MAX_TOTAL_CONNECTIONS);
multiThreadedHttpConnectionManager.setParams(params);
HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager);
try {
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
XMLConfiguration conf = ConfUtil.getInstance(null).getConfiguration();
int port = conf.getInt("autoscaler.cloudController.port", AutoscalerConstants
.CLOUD_CONTROLLER_DEFAULT_PORT);
String hostname = conf.getString("autoscaler.cloudController.hostname", "localhost");
String epr = "https://" + hostname + ":" + port + "/" + AutoscalerConstants.CLOUD_CONTROLLER_SERVICE_SFX;
int cloudControllerClientTimeout = conf.getInt("autoscaler.cloudController.clientTimeout", 180000);
stub = new CloudControllerServiceStub(ctx, epr);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, cloudControllerClientTimeout);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,
cloudControllerClientTimeout);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean
.TRUE);
} catch (Exception e) {
log.error("Could not initialize cloud controller client", e);
}
}
示例11: CloudControllerServiceClient
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
private CloudControllerServiceClient(String epr) throws AxisFault {
MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new
MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setDefaultMaxConnectionsPerHost(StratosConstants.CLOUD_CONTROLLER_CLIENT_MAX_CONNECTIONS_PER_HOST);
params.setMaxTotalConnections(StratosConstants.CLOUD_CONTROLLER_CLIENT_MAX_TOTAL_CONNECTIONS);
multiThreadedHttpConnectionManager.setParams(params);
HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager);
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
String ccSocketTimeout = System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT) == null ?
StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT :
System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT);
String ccConnectionTimeout =
System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT) == null ?
StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT :
System.getProperty(StratosConstants.CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT);
try {
stub = new CloudControllerServiceStub(ctx, epr);
stub._getServiceClient().getOptions()
.setProperty(HTTPConstants.SO_TIMEOUT, Integer.valueOf(ccSocketTimeout));
stub._getServiceClient().getOptions()
.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(ccConnectionTimeout));
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean
.TRUE);
} catch (AxisFault axisFault) {
String msg = "Could not initialize cloud controller service client";
log.error(msg, axisFault);
throw new AxisFault(msg, axisFault);
}
}
示例12: AutoscalerServiceClient
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
private AutoscalerServiceClient(String epr) throws AxisFault {
MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new
MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setDefaultMaxConnectionsPerHost(StratosConstants.AUTOSCALER_CLIENT_MAX_CONNECTIONS_PER_HOST);
params.setMaxTotalConnections(StratosConstants.AUTOSCALER_CLIENT_MAX_TOTAL_CONNECTIONS);
multiThreadedHttpConnectionManager.setParams(params);
HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager);
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
String autosclaerSocketTimeout = System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT) == null ?
StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT :
System.getProperty(StratosConstants.AUTOSCALER_CLIENT_SOCKET_TIMEOUT);
String autosclaerConnectionTimeout = System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT)
== null ? StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT :
System.getProperty(StratosConstants.AUTOSCALER_CLIENT_CONNECTION_TIMEOUT);
try {
stub = new AutoscalerServiceStub(ctx, epr);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,
Integer.valueOf(autosclaerSocketTimeout));
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,
Integer.valueOf(autosclaerConnectionTimeout));
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean
.TRUE);
} catch (AxisFault axisFault) {
String msg = "Could not initialize autoscaler service client";
log.error(msg, axisFault);
throw new AxisFault(msg, axisFault);
}
}
示例13: StratosManagerServiceClient
import org.apache.axis2.context.ConfigurationContext; //导入方法依赖的package包/类
private StratosManagerServiceClient(String epr) throws AxisFault {
MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = new
MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setDefaultMaxConnectionsPerHost(StratosConstants.STRATOS_MANAGER_CLIENT_MAX_CONNECTIONS_PER_HOST);
params.setMaxTotalConnections(StratosConstants.STRATOS_MANAGER_CLIENT_MAX_TOTAL_CONNECTIONS);
multiThreadedHttpConnectionManager.setParams(params);
HttpClient httpClient = new HttpClient(multiThreadedHttpConnectionManager);
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
String ccSocketTimeout = System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_SOCKET_TIMEOUT) == null ?
StratosConstants.DEFAULT_CLIENT_SOCKET_TIMEOUT :
System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_SOCKET_TIMEOUT);
String ccConnectionTimeout = System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_CONNECTION_TIMEOUT)
== null ?
StratosConstants.DEFAULT_CLIENT_CONNECTION_TIMEOUT :
System.getProperty(StratosConstants.STRATOS_MANAGER_CLIENT_CONNECTION_TIMEOUT);
try {
stub = new StratosManagerServiceStub(ctx, epr);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, Integer.valueOf
(ccSocketTimeout));
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, Integer.valueOf
(ccConnectionTimeout));
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean
.TRUE);
} catch (AxisFault axisFault) {
String msg = "Could not initialize stratos manager service client";
log.error(msg, axisFault);
throw new AxisFault(msg, axisFault);
}
}