Package org.apache.geronimo.xbeans.javaee6

Examples of org.apache.geronimo.xbeans.javaee6.ServletMappingType


            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("service-ref", serviceRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isServiceRefInjectTargetsConfiguredInInitialWebXML(serviceRefName, mergeContext)) {
                    //Merge InjectTarget
                    ServiceRefType serviceRef = (ServiceRefType) mergeItem.getValue();
                    for (InjectionTargetType injectTarget : srcServiceRef.getInjectionTargetArray()) {
                        String serviceRefInjectTargetKey = createServiceRefInjectTargetKey(serviceRefName, injectTarget.getInjectionTargetClass().getStringValue(), injectTarget
                                .getInjectionTargetName().getStringValue());
                        if (!mergeContext.containsAttribute(serviceRefInjectTargetKey)) {
                            serviceRef.addNewInjectionTarget().set(injectTarget);
                            mergeContext.setAttribute(serviceRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                ServiceRefType targetServiceRef = (ServiceRefType) webApp.addNewServiceRef().set(srcServiceRef);
                mergeContext.setAttribute(serviceRefKey, new MergeItem(targetServiceRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTargetType injectionTarget : targetServiceRef.getInjectionTargetArray()) {
                    mergeContext.setAttribute(createServiceRefInjectTargetKey(serviceRefName, injectionTarget.getInjectionTargetClass().getStringValue(), injectionTarget.getInjectionTargetName()
                            .getStringValue()), Boolean.TRUE);
                }
            }
        }
View Full Code Here


                servlet.addNewServletName().setStringValue(service.getName());
                servlet.addNewServletClass().setStringValue(service.getName());

                // add new <servlet-mapping/> element
                String location = "/" + JAXWSUtils.getServiceName(service);
                ServletMappingType servletMapping = webApp.addNewServletMapping();
                servletMapping.addNewServletName().setStringValue(service.getName());
                servletMapping.addNewUrlPattern().setStringValue(location);

                // map service
                PortInfo portInfo = new PortInfo();
                portInfo.setLocation(contextRoot + location);
                map.put(service.getName(), portInfo);
View Full Code Here

                    String location = (String)portLocations.get(service.getName());
                    if (location == null) {
                        // add new <servlet-mapping/> element
                        location = "/" + JAXWSUtils.getServiceName(service);
                        ServletMappingType servletMapping = webApp.addNewServletMapping();
                        servletMapping.addNewServletName().setStringValue(service.getName());
                        servletMapping.addNewUrlPattern().setStringValue(location);
                    } else {
                        // weird, there was no servlet entry for this class but
                        // servlet-mapping exists
                        LOG.warn("Found <servlet-mapping> but corresponding <servlet> was not defined");
                    }
View Full Code Here

                ServletMergeHandler.addServlet(newServlet, mergeContext);
            }
            if (!ServletMappingMergeHandler.isServletMappingConfigured(servletName, mergeContext)) {
                //merge url-patterns, spec 8.1.n.vi. url-patterns, when specified in a descriptor for a given servlet name overrides the url patterns specified via the annotation.
                //FIXME To my understanding of the spec, once there are url-patterns configured in the descriptors, those configurations from the annotations are ignored
                ServletMappingType newServletMapping = webApp.addNewServletMapping();
                //create servlet-mapping element
                newServletMapping.addNewServletName().setStringValue(servletName);
                for (String urlPattern : urlPatterns) {
                    newServletMapping.addNewUrlPattern().setStringValue(urlPattern);
                }
                ServletMappingMergeHandler.addServletMapping(newServletMapping, mergeContext);
                //Set this tag, so that if any following web-fragment.xml has defined the url-patterns explicitly, it could drop the configurations from annotation
                mergeContext.setAttribute(ServletMappingMergeHandler.createServletMappingSourceKey(servletName), ElementSource.ANNOTATION);
            }
View Full Code Here

    @Override
    public void merge(WebFragmentType webFragment, WebAppType webApp, MergeContext mergeContext) throws DeploymentException {
        for (ServletMappingType srcServletMapping : webFragment.getServletMappingArray()) {
            String servletName = srcServletMapping.getServletName().getStringValue();
            ServletMappingType targetServletMapping = (ServletMappingType) mergeContext.getAttribute(createServletMappingKey(servletName));
            if (targetServletMapping == null) {
                targetServletMapping = (ServletMappingType) webApp.addNewServletMapping().set(srcServletMapping);
                mergeContext.setAttribute(createServletMappingKey(servletName), targetServletMapping);
                for (SubMergeHandler<ServletMappingType, ServletMappingType> subMergeHandler : subMergeHandlers) {
                    subMergeHandler.add(targetServletMapping, mergeContext);
                }
            } else {
                if (isServletMappingFromAnnotation(servletName, mergeContext) && srcServletMapping.getUrlPatternArray().length > 0) {
                    //If the current url-patterns configurations are from annotations, so let's drop them
                    targetServletMapping.setUrlPatternArray(new UrlPatternType[0]);
                    mergeContext.removeAttribute(createServletMappingSourceKey(servletName));
                }
                for (SubMergeHandler<ServletMappingType, ServletMappingType> subMergeHandler : subMergeHandlers) {
                    subMergeHandler.merge(srcServletMapping, targetServletMapping, mergeContext);
                }
View Full Code Here

                }

                LOG.debug("Discovered POJO Web Service: " + service.getName());

                // add new <servlet/> element
                ServletType servlet = webApp.addNewServlet();
                servlet.addNewServletName().setStringValue(service.getName());
                servlet.addNewServletClass().setStringValue(service.getName());

                // add new <servlet-mapping/> element
                String location = "/" + JAXWSUtils.getServiceName(service);
                ServletMappingType servletMapping = webApp.addNewServletMapping();
                servletMapping.addNewServletName().setStringValue(service.getName());
View Full Code Here

        // o.a.g.jetty8.JettyFilterMapping which provided the example
        // of how to do this.
        // http://issues.apache.org/jira/browse/GERONIMO-645
        AbstractName previousServlet = null;
        for (Object aLoadOrder : loadOrder) {
            ServletType servletType = (ServletType) aLoadOrder;
            previousServlet = addServlet(webModuleName, module, previousServlet, servletType, servletMappings, moduleContext);
        }
    }
View Full Code Here

                if (mappedServlets == null) {
                    // no <servlet/> entry, add one

                    LOG.debug("POJO Web Service class {} is not mapped to any servlet", service.getName());

                    ServletType servlet = webApp.addNewServlet();
                    servlet.addNewServletName().setStringValue(service.getName());
                    servlet.addNewServletClass().setStringValue(service.getName());

                    String location = (String)portLocations.get(service.getName());
                    if (location == null) {
                        // add new <servlet-mapping/> element
                        location = "/" + JAXWSUtils.getServiceName(service);
View Full Code Here

        //-------------------------------------------------
        // Ensure annotations are processed correctly
        //-------------------------------------------------
        URL srcXML = classLoader.getResource("annotation/empty-web-src.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
        WebAppType webApp = webAppDoc.getWebApp();
        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        EJBAnnotationHelper.processAnnotations(annotatedWebApp, classFinder);
        URL expectedXML = classLoader.getResource("annotation/ejb-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
        log.debug("[@EJB Source XML] " + '\n' + webApp.toString() + '\n');
View Full Code Here

        //-------------------------------------------------
        // Ensure annotations are processed correctly
        //-------------------------------------------------
        URL srcXML = classLoader.getResource("annotation/handler-chain-src.xml");
        XmlObject xmlObject = XmlObject.Factory.parse(srcXML, options);
        WebAppDocument webAppDoc = (WebAppDocument) xmlObject.changeType(WebAppDocument.type);
        WebAppType webApp = webAppDoc.getWebApp();
        AnnotatedWebApp annotatedWebApp = new AnnotatedWebApp(webApp);
        HandlerChainAnnotationHelper.processAnnotations(annotatedWebApp, classFinder);
        URL expectedXML = classLoader.getResource("annotation/handler-chain-expected.xml");
        XmlObject expected = XmlObject.Factory.parse(expectedXML);
        log.debug("[@HandlerChain Source XML] " + '\n' + webApp.toString() + '\n');
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xbeans.javaee6.ServletMappingType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.