use of org.jboss.metadata.javaee.spec.ParamValueMetaData in project wildfly by wildfly.
the class UndertowNativeWebSocketDeploymentProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
WarMetaData metaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
if (metaData == null) {
return;
}
JBossWebMetaData mergedMetaData = metaData.getMergedJBossWebMetaData();
if (!mergedMetaData.isEnableWebSockets()) {
return;
}
if (mergedMetaData.getServlets() != null) {
for (final JBossServletMetaData servlet : mergedMetaData.getServlets()) {
if (servlet.getServletClass() != null) {
try {
Class<?> clazz = ClassLoadingUtils.loadClass(servlet.getServletClass(), deploymentUnit);
if (WebSocketConnectionCallback.class.isAssignableFrom(clazz)) {
servlet.setServletClass(WebSocketServlet.class.getName());
if (servlet.getInitParam() == null) {
servlet.setInitParam(new ArrayList<ParamValueMetaData>());
}
final ParamValueMetaData param = new ParamValueMetaData();
param.setParamName(WebSocketServlet.SESSION_HANDLER);
param.setParamValue(clazz.getName());
servlet.getInitParam().add(param);
}
} catch (ClassNotFoundException e) {
throw new DeploymentUnitProcessingException(e);
}
}
}
}
}
use of org.jboss.metadata.javaee.spec.ParamValueMetaData in project wildfly by wildfly.
the class AbstractMetaDataBuilderPOJO method setConfigNameAndFile.
/**
* Sets config name and config file.
*
* @param builder universal JSE meta data model builder
* @param jbossWebMD jboss web meta data
*/
private void setConfigNameAndFile(final JSEArchiveMetaData.Builder builder, final JBossWebMetaData jbossWebMD, final JBossWebservicesMetaData jbossWebservicesMD) {
if (jbossWebservicesMD != null) {
if (jbossWebservicesMD.getConfigName() != null) {
final String configName = jbossWebservicesMD.getConfigName();
builder.setConfigName(configName);
WSLogger.ROOT_LOGGER.tracef("Setting config name: %s", configName);
final String configFile = jbossWebservicesMD.getConfigFile();
builder.setConfigFile(configFile);
WSLogger.ROOT_LOGGER.tracef("Setting config file: %s", configFile);
// ensure higher priority against web.xml context parameters
return;
}
}
final List<ParamValueMetaData> contextParams = jbossWebMD.getContextParams();
if (contextParams != null) {
for (final ParamValueMetaData contextParam : contextParams) {
if (WSConstants.JBOSSWS_CONFIG_NAME.equals(contextParam.getParamName())) {
final String configName = contextParam.getParamValue();
builder.setConfigName(configName);
WSLogger.ROOT_LOGGER.tracef("Setting config name: %s", configName);
}
if (WSConstants.JBOSSWS_CONFIG_FILE.equals(contextParam.getParamName())) {
final String configFile = contextParam.getParamValue();
builder.setConfigFile(configFile);
WSLogger.ROOT_LOGGER.tracef("Setting config file: %s", configFile);
}
}
}
}
use of org.jboss.metadata.javaee.spec.ParamValueMetaData in project wildfly by wildfly.
the class WebMetaDataHelper method newParamValue.
/**
* Creates new parameter with specified key and value.
*
* @param key the key
* @param value the value
* @return new parameter
*/
private static ParamValueMetaData newParamValue(final String key, final String value) {
final ParamValueMetaData paramMD = new ParamValueMetaData();
paramMD.setParamName(key);
paramMD.setParamValue(value);
return paramMD;
}
use of org.jboss.metadata.javaee.spec.ParamValueMetaData in project wildfly by wildfly.
the class WSRefUtils method getUnifiedHandlerMetaData.
private static UnifiedHandlerMetaData getUnifiedHandlerMetaData(ServiceReferenceHandlerMetaData srhmd) {
List<UnifiedInitParamMetaData> unifiedInitParamMDs = new LinkedList<UnifiedInitParamMetaData>();
List<ParamValueMetaData> initParams = srhmd.getInitParam();
if (initParams != null) {
for (ParamValueMetaData initParam : initParams) {
unifiedInitParamMDs.add(new UnifiedInitParamMetaData(initParam.getParamName(), initParam.getParamValue()));
}
}
List<QName> soapHeaders = srhmd.getSoapHeader();
Set<QName> soapHeaderList = soapHeaders != null ? new HashSet<QName>(soapHeaders) : null;
List<String> soapRoles = srhmd.getSoapRole();
Set<String> soapRolesList = soapRoles != null ? new HashSet<String>(soapRoles) : null;
List<String> portNames = srhmd.getPortName();
Set<String> portNameList = portNames != null ? new HashSet<String>(portNames) : null;
return new UnifiedHandlerMetaData(srhmd.getHandlerClass(), srhmd.getHandlerName(), unifiedInitParamMDs, soapHeaderList, soapRolesList, portNameList);
}
Aggregations