Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.ServletMapping


            try {
                Class<?> clazz = webModule.getClassLoader().loadClass(className);
                if (JaxWsUtils.isWebService(clazz)) {
                    // add servlet mapping if not already declared
                    ServletMapping servletMapping = servletMappings.get(servlet.getServletName());
                    String serviceName = JaxWsUtils.getServiceName(clazz);
                    if (servletMapping == null) {
                        servletMapping = new ServletMapping();
                        servletMapping.setServletName(servlet.getServletName());

                        String location = "/" + serviceName;
                        servletMapping.getUrlPattern().add(location);
                        webApp.getServletMapping().add(servletMapping);
                    }

                    // if we don't have a webservices document yet, we're gonna need one now
                    if (webservices == null) {
View Full Code Here


                else {
                    mapping = mapping + "/*";
                }
            }

            ServletMapping restServletMapping = new ServletMapping();
            restServletMapping.setServletName(REST_SERVLET_NAME);
            restServletMapping.getUrlPattern().add(mapping);
            webApp.getServletMapping().add(restServletMapping);

        }

        webApp.getServlet().add(restServletInfo);
View Full Code Here

                    String location = portLocations.get(service.getName());
                    if (location == null) {
                        // add new <servlet-mapping/> element
                        location = "/" + JAXWSUtils.getServiceName(service);
                        ServletMapping servletMapping = new ServletMapping();
                        servletMapping.setServletName(service.getName());
                        servletMapping.getUrlPattern().add(location);
                        webApp.getServletMapping().add(servletMapping);
                    } 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", location, service.getName());
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
                ServletMapping newServletMapping = new ServletMapping();
                //create servlet-mapping element
                newServletMapping.setServletName(servletName);
                for (String urlPattern : urlPatterns) {
                    newServletMapping.getUrlPattern().add(urlPattern);
                }
                webApp.getServletMapping().add(newServletMapping);
                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

                servlet.setServletName(service.getName());
                servlet.setServletClass(service.getName());
                webApp.getServlet().add(servlet);
                // add new <servlet-mapping/> element
                String location = "/" + JAXWSUtils.getServiceName(service);
                ServletMapping servletMapping = new ServletMapping();
                servletMapping.setServletName(service.getName());
                servletMapping.getUrlPattern().add(location);

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

    @Override
    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (ServletMapping srcServletMapping : webFragment.getServletMapping()) {
            String servletName = srcServletMapping.getServletName();
            ServletMapping targetServletMapping = (ServletMapping) mergeContext.getAttribute(createServletMappingKey(servletName));
            if (targetServletMapping == null) {
                webApp.getServletMapping().add(srcServletMapping);
                mergeContext.setAttribute(createServletMappingKey(servletName), srcServletMapping);
                for (SubMergeHandler<ServletMapping, ServletMapping> subMergeHandler : subMergeHandlers) {
                    subMergeHandler.add(srcServletMapping, mergeContext);
                }
            } else {
                //If the servlet-mapping is configured in the central web.xml file, all the configurations from the fragment xml and annotations are ignored
                if(isServletMappingFromWebXml(servletName, mergeContext)) {
                    continue;
                }
                if (isServletMappingFromAnnotation(servletName, mergeContext) && !srcServletMapping.getUrlPattern().isEmpty()) {
                    //If the current url-patterns configurations are from annotations, so let's drop them
                    targetServletMapping.getUrlPattern().clear();
                    mergeContext.removeAttribute(createServletMappingSourceKey(servletName));
                }
                for (SubMergeHandler<ServletMapping, ServletMapping> subMergeHandler : subMergeHandlers) {
                    subMergeHandler.merge(srcServletMapping, targetServletMapping, mergeContext);
                }
View Full Code Here

            try {
                Class<?> clazz = webModule.getClassLoader().loadClass(className);
                if (JaxWsUtils.isWebService(clazz)) {
                    // add servlet mapping if not already declared
                    ServletMapping servletMapping = servletMappings.get(servlet.getServletName());
                    String serviceName = JaxWsUtils.getServiceName(clazz);
                    if (servletMapping == null) {
                        servletMapping = new ServletMapping();
                        servletMapping.setServletName(servlet.getServletName());

                        String location = "/" + serviceName;
                        servletMapping.getUrlPattern().add(location);
                        webApp.getServletMapping().add(servletMapping);
                    }

                    // if we don't have a webservices document yet, we're gonna need one now
                    if (webservices == null) {
View Full Code Here

                else {
                    mapping = mapping + "/*";
                }
            }

            ServletMapping restServletMapping = new ServletMapping();
            restServletMapping.setServletName(REST_SERVLET_NAME);
            restServletMapping.getUrlPattern().add(mapping);
            webApp.getServletMapping().add(restServletMapping);

        }

        webApp.getServlet().add(restServletInfo);
View Full Code Here

            try {
                Class<?> clazz = webModule.getClassLoader().loadClass(className);
                if (JaxWsUtils.isWebService(clazz)) {
                    // add servlet mapping if not already declared
                    ServletMapping servletMapping = servletMappings.get(servlet.getServletName());
                    String serviceName = JaxWsUtils.getServiceName(clazz);
                    if (servletMapping == null) {
                        servletMapping = new ServletMapping();
                        servletMapping.setServletName(servlet.getServletName());

                        String location = "/" + serviceName;
                        servletMapping.getUrlPattern().add(location);
                        webApp.getServletMapping().add(servletMapping);
                    }

                    // if we don't have a webservices document yet, we're gonna need one now
                    if (webservices == null) {
View Full Code Here

            try {
                final Class<?> clazz = webModule.getClassLoader().loadClass(className);
                if (JaxWsUtils.isWebService(clazz)) {
                    // add servlet mapping if not already declared
                    ServletMapping servletMapping = servletMappings.get(servlet.getServletName());
                    final String serviceName = JaxWsUtils.getServiceName(clazz);
                    if (servletMapping == null) {
                        servletMapping = new ServletMapping();
                        servletMapping.setServletName(servlet.getServletName());

                        final String location = "/" + serviceName;
                        servletMapping.getUrlPattern().add(location);
                        webApp.getServletMapping().add(servletMapping);
                    }

                    // if we don't have a webservices document yet, we're gonna need one now
                    if (webservices == null) {
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.ServletMapping

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.