Search in sources :

Example 6 with Endpoint

use of org.jboss.wsf.spi.deployment.Endpoint in project wildfly by wildfly.

the class ModelDeploymentAspect method start.

@Override
public void start(final Deployment dep) {
    final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
    if (unit instanceof WSEndpointDeploymentUnit)
        return;
    final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
    for (final Endpoint endpoint : dep.getService().getEndpoints()) {
        final ModelNode endpointModel;
        try {
            endpointModel = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8")));
        } catch (final UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        endpointModel.get(ENDPOINT_NAME).set(getName(endpoint));
        endpointModel.get(ENDPOINT_CONTEXT).set(getContext(endpoint));
        endpointModel.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName());
        endpointModel.get(ENDPOINT_TYPE).set(endpoint.getType().toString());
        endpointModel.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl");
    }
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) WSEndpointDeploymentUnit(org.jboss.as.webservices.publish.WSEndpointDeploymentUnit) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ModelNode(org.jboss.dmr.ModelNode) WSEndpointDeploymentUnit(org.jboss.as.webservices.publish.WSEndpointDeploymentUnit) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 7 with Endpoint

use of org.jboss.wsf.spi.deployment.Endpoint in project wildfly by wildfly.

the class WSEndpointMetrics method getEndpointMetricsFragment.

@SuppressWarnings("unchecked")
private ModelNode getEndpointMetricsFragment(final ModelNode operation, final ServiceRegistry registry) throws OperationFailedException {
    final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
    String endpointId;
    try {
        endpointId = URLDecoder.decode(address.getLastElement().getValue(), "UTF-8");
    } catch (final UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
    final String metricName = operation.require(NAME).asString();
    final String webContext = endpointId.substring(0, endpointId.indexOf(":"));
    final String endpointName = endpointId.substring(endpointId.indexOf(":") + 1);
    ServiceName endpointServiceName = WSServices.ENDPOINT_SERVICE.append("context=" + webContext).append(endpointName);
    ServiceController<Endpoint> service = (ServiceController<Endpoint>) currentServiceContainer().getService(endpointServiceName);
    Endpoint endpoint = service.getValue();
    if (endpoint == null) {
        throw new OperationFailedException(WSLogger.ROOT_LOGGER.noMetricsAvailable());
    }
    final ModelNode result = new ModelNode();
    final EndpointMetrics endpointMetrics = endpoint.getEndpointMetrics();
    if (MIN_PROCESSING_TIME.getName().equals(metricName)) {
        result.set(endpointMetrics.getMinProcessingTime());
    } else if (MAX_PROCESSING_TIME.getName().equals(metricName)) {
        result.set(endpointMetrics.getMaxProcessingTime());
    } else if (AVERAGE_PROCESSING_TIME.getName().equals(metricName)) {
        result.set(endpointMetrics.getAverageProcessingTime());
    } else if (TOTAL_PROCESSING_TIME.getName().equals(metricName)) {
        result.set(endpointMetrics.getTotalProcessingTime());
    } else if (REQUEST_COUNT.getName().equals(metricName)) {
        result.set(endpointMetrics.getRequestCount());
    } else if (RESPONSE_COUNT.getName().equals(metricName)) {
        result.set(endpointMetrics.getResponseCount());
    } else if (FAULT_COUNT.getName().equals(metricName)) {
        result.set(endpointMetrics.getFaultCount());
    }
    return result;
}
Also used : Endpoint(org.jboss.wsf.spi.deployment.Endpoint) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) OperationFailedException(org.jboss.as.controller.OperationFailedException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ServiceController(org.jboss.msc.service.ServiceController) ModelNode(org.jboss.dmr.ModelNode) EndpointMetrics(org.jboss.wsf.spi.management.EndpointMetrics)

Example 8 with Endpoint

use of org.jboss.wsf.spi.deployment.Endpoint in project wildfly by wildfly.

the class WebMetaDataModifier method configureEndpoints.

/**
     * Configures transport servlet class for every found webservice endpoint.
     *
     * @param dep webservice deployment
     * @param jbossWebMD web meta data
     */
private void configureEndpoints(final Deployment dep, final JBossWebMetaData jbossWebMD) {
    final String transportClassName = this.getTransportClassName(dep);
    WSLogger.ROOT_LOGGER.trace("Modifying servlets");
    // get a list of the endpoint bean class names
    final Set<String> epNames = new HashSet<String>();
    for (Endpoint ep : dep.getService().getEndpoints()) {
        epNames.add(ep.getTargetBeanName());
    }
    // fix servlet class names for endpoints
    for (final ServletMetaData servletMD : jbossWebMD.getServlets()) {
        final String endpointClassName = ASHelper.getEndpointClassName(servletMD);
        if (endpointClassName != null && endpointClassName.length() > 0) {
            // exclude JSP
            if (epNames.contains(endpointClassName)) {
                // set transport servlet
                servletMD.setServletClass(WSFServlet.class.getName());
                WSLogger.ROOT_LOGGER.tracef("Setting transport class: %s for endpoint: %s", transportClassName, endpointClassName);
                final List<ParamValueMetaData> initParams = WebMetaDataHelper.getServletInitParams(servletMD);
                // configure transport class name
                WebMetaDataHelper.newParamValue(WSFServlet.STACK_SERVLET_DELEGATE_CLASS, transportClassName, initParams);
                // configure webservice endpoint
                WebMetaDataHelper.newParamValue(Endpoint.SEPID_DOMAIN_ENDPOINT, endpointClassName, initParams);
            } else if (endpointClassName.startsWith("org.apache.cxf")) {
                throw WSLogger.ROOT_LOGGER.invalidWSServlet(endpointClassName);
            }
        }
    }
}
Also used : ParamValueMetaData(org.jboss.metadata.javaee.spec.ParamValueMetaData) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) ServletMetaData(org.jboss.metadata.web.spec.ServletMetaData) HashSet(java.util.HashSet) WSFServlet(org.jboss.wsf.spi.deployment.WSFServlet)

Example 9 with Endpoint

use of org.jboss.wsf.spi.deployment.Endpoint in project wildfly by wildfly.

the class WebMetaDataCreator method getRealmName.

private String getRealmName(final Deployment dep) {
    for (final Endpoint ejbEndpoint : dep.getService().getEndpoints()) {
        final String realmName = ejb3SecurityAccessor.getRealmName(ejbEndpoint);
        final boolean hasRealmName = realmName != null;
        if (hasRealmName) {
            return realmName;
        }
    }
    return null;
}
Also used : HttpEndpoint(org.jboss.wsf.spi.deployment.HttpEndpoint) Endpoint(org.jboss.wsf.spi.deployment.Endpoint)

Example 10 with Endpoint

use of org.jboss.wsf.spi.deployment.Endpoint in project wildfly by wildfly.

the class WebMetaDataCreator method createSecurityConstraints.

/**
     * Creates security constraints part of web.xml descriptor.
     * <p/>
     * <pre>
     * &lt;security-constraint&gt;
     *   &lt;web-resource-collection&gt;
     *     &lt;web-resource-name&gt;EJBEndpointShortName&lt;/web-resource-name&gt;
     *     &lt;url-pattern&gt;EJBEndpointURLPattern&lt;/url-pattern&gt;
     *     &lt;http-method&gt;GET&lt;/http-method&gt;
     *     &lt;http-method&gt;POST&lt;/http-method&gt;
     *   &lt;/web-resource-collection&gt;
     *   &lt;auth-constraint&gt;
     *     &lt;role-name&gt;*&lt;/role-name&gt;
     *   &lt;/auth-constraint&gt;
     *   &lt;user-data-constraint&gt;
     *     &lt;transport-guarantee&gt;EjbTransportGuarantee&lt;/transport-guarantee&gt;
     *   &lt;/user-data-constraint&gt;
     * &lt;/security-constraint&gt;
     * </pre>
     *
     * @param dep        webservice deployment
     * @param jbossWebMD jboss web meta data
     */
private void createSecurityConstraints(final Deployment dep, final JBossWebMetaData jbossWebMD) {
    WSLogger.ROOT_LOGGER.trace("Creating security constraints");
    for (final Endpoint ejbEndpoint : dep.getService().getEndpoints()) {
        final boolean secureWsdlAccess = ejb3SecurityAccessor.isSecureWsdlAccess(ejbEndpoint);
        final String transportGuarantee = ejb3SecurityAccessor.getTransportGuarantee(ejbEndpoint);
        final boolean hasTransportGuarantee = transportGuarantee != null;
        final String authMethod = ejb3SecurityAccessor.getAuthMethod(ejbEndpoint);
        final boolean hasAuthMethod = authMethod != null;
        if (ejbEndpoint instanceof HttpEndpoint && (hasAuthMethod || hasTransportGuarantee)) {
            final List<SecurityConstraintMetaData> securityConstraints = WebMetaDataHelper.getSecurityConstraints(jbossWebMD);
            // security-constraint
            final SecurityConstraintMetaData securityConstraint = WebMetaDataHelper.newSecurityConstraint(securityConstraints);
            // web-resource-collection
            final WebResourceCollectionsMetaData webResourceCollections = WebMetaDataHelper.getWebResourceCollections(securityConstraint);
            final String endpointName = ejbEndpoint.getShortName();
            final String urlPattern = ((HttpEndpoint) ejbEndpoint).getURLPattern();
            WSLogger.ROOT_LOGGER.tracef("Creating web resource collection for endpoint: %s, URL pattern: %s", endpointName, urlPattern);
            WebMetaDataHelper.newWebResourceCollection(endpointName, urlPattern, secureWsdlAccess, webResourceCollections);
            // auth-constraint
            if (hasAuthMethod) {
                WSLogger.ROOT_LOGGER.tracef("Creating auth constraint for endpoint: %s", endpointName);
                WebMetaDataHelper.newAuthConstraint(WebMetaDataHelper.getAllRoles(), securityConstraint);
            }
            // user-data-constraint
            if (hasTransportGuarantee) {
                WSLogger.ROOT_LOGGER.tracef("Creating new user data constraint for endpoint: %s, transport guarantee: %s", endpointName, transportGuarantee);
                WebMetaDataHelper.newUserDataConstraint(transportGuarantee, securityConstraint);
            }
        }
    }
}
Also used : WebResourceCollectionsMetaData(org.jboss.metadata.web.spec.WebResourceCollectionsMetaData) HttpEndpoint(org.jboss.wsf.spi.deployment.HttpEndpoint) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) HttpEndpoint(org.jboss.wsf.spi.deployment.HttpEndpoint) SecurityConstraintMetaData(org.jboss.metadata.web.spec.SecurityConstraintMetaData)

Aggregations

Endpoint (org.jboss.wsf.spi.deployment.Endpoint)19 ServiceName (org.jboss.msc.service.ServiceName)6 HttpEndpoint (org.jboss.wsf.spi.deployment.HttpEndpoint)5 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)3 EJBEndpoint (org.jboss.as.webservices.metadata.model.EJBEndpoint)3 Deployment (org.jboss.wsf.spi.deployment.Deployment)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 WSEndpointConfigMapping (org.jboss.as.webservices.deployers.WSEndpointConfigMapping)2 ModelNode (org.jboss.dmr.ModelNode)2 ManagedEndpoint (org.jboss.ws.common.management.ManagedEndpoint)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Vector (java.util.Vector)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 PathAddress (org.jboss.as.controller.PathAddress)1 ApplicationSecurityDomainService (org.jboss.as.ejb3.subsystem.ApplicationSecurityDomainService)1 DeploymentResourceSupport (org.jboss.as.server.deployment.DeploymentResourceSupport)1 POJOEndpoint (org.jboss.as.webservices.metadata.model.POJOEndpoint)1 WSEndpointDeploymentUnit (org.jboss.as.webservices.publish.WSEndpointDeploymentUnit)1 ParamValueMetaData (org.jboss.metadata.javaee.spec.ParamValueMetaData)1