Search in sources :

Example 21 with ParamValueMetaData

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);
                }
            }
        }
    }
}
Also used : ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) JBossWebMetaData(org.jboss.metadata.web.jboss.JBossWebMetaData) JBossServletMetaData(org.jboss.metadata.web.jboss.JBossServletMetaData) WarMetaData(org.jboss.as.web.common.WarMetaData) WebSocketServlet(io.undertow.servlet.websockets.WebSocketServlet) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 22 with ParamValueMetaData

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);
            }
        }
    }
}
Also used : ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData)

Example 23 with ParamValueMetaData

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;
}
Also used : ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData)

Example 24 with ParamValueMetaData

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);
}
Also used : UnifiedInitParamMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedInitParamMetaData) ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData) QName(javax.xml.namespace.QName) LinkedList(java.util.LinkedList) UnifiedHandlerMetaData(org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData)

Aggregations

ParamValueMetaData (org.jboss.metadata.javaee.spec.ParamValueMetaData)24 WarMetaData (org.jboss.as.web.common.WarMetaData)7 JBossWebMetaData (org.jboss.metadata.web.jboss.JBossWebMetaData)6 ArrayList (java.util.ArrayList)5 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)5 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)5 JBossServletMetaData (org.jboss.metadata.web.jboss.JBossServletMetaData)5 HashSet (java.util.HashSet)4 ListenerMetaData (org.jboss.metadata.web.spec.ListenerMetaData)4 ServletMappingMetaData (org.jboss.metadata.web.spec.ServletMappingMetaData)4 FilterMappingMetaData (org.jboss.metadata.web.spec.FilterMappingMetaData)3 FilterMetaData (org.jboss.metadata.web.spec.FilterMetaData)3 SecurityConstraint (io.undertow.servlet.api.SecurityConstraint)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 TagLibraryInfo (org.apache.jasper.deploy.TagLibraryInfo)2 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)2 ServletMetaData (org.jboss.metadata.web.spec.ServletMetaData)2 StartException (org.jboss.msc.service.StartException)2 HttpServlet30Dispatcher (org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher)2