Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.Servlet


                    webApp = new WebApp();
                    webModule.setWebApp(webApp);
                }

                // add new <servlet/> element
                Servlet servlet = new Servlet();
                servlet.setServletName(webServiceClass.getName());
                servlet.setServletClass(webServiceClass.getName());
                webApp.getServlet().add(servlet);
            }

            return webModule;
        }
View Full Code Here


                if (existingServlets.contains(webServiceClass.getName())) continue;

                // create webApp and webservices objects if they don't exist already

                // add new <servlet/> element
                Servlet servlet = new Servlet();
                servlet.setServletName(webServiceClass.getName());
                servlet.setServletClass(webServiceClass.getName());
                webApp.getServlet().add(servlet);
            }

           /*
            * REST
 
View Full Code Here

         * TODO It is an error for more than one application to be deployed at the same effective servlet mapping
         */

        applicationClass = applicationClasses.iterator().next();

        Servlet restServletInfo = new Servlet();
        restServletInfo.setServletClass(REST_SERVLET_NAME);
        restServletInfo.setServletName(REST_SERVLET_NAME);

        ParamValue paramApplication = new ParamValue();
        paramApplication.setParamName("javax.ws.rs.Application");
        paramApplication.setParamValue(applicationClass.getName());
        restServletInfo.getInitParam().add(paramApplication);

        ParamValue paramDeploymentConfig = new ParamValue();
        paramDeploymentConfig.setParamName("deploymentConfiguration");
        paramDeploymentConfig.setParamValue(GeronimoWinkDeloymentConfiguration.class.getName());

        restServletInfo.getInitParam().add(paramDeploymentConfig);

        if (applicationClass.isAnnotationPresent(ApplicationPath.class)) {

            ApplicationPath ap = applicationClass.getAnnotation(ApplicationPath.class);

View Full Code Here

                if (mappedServlets == null) {
                    // no <servlet/> entry, add one
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("POJO Web Service class {} is not mapped to any servlet", service.getName());
                    }
                    Servlet servlet = new Servlet();
                    servlet.setServletName(service.getName());
                    servlet.setServletClass(service.getName());
                    webApp.getServlet().add(servlet);

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

                throw new DeploymentException("At least one of value and urlPatterns attribute should be configured on the WebServlet annotation in the class " + cls.getName());
            }
            String servletName = webServlet.name().length() == 0 ? cls.getName() : webServlet.name();
            String[] urlPatterns = valueAttributeConfigured ? webServlet.value() : webServlet.urlPatterns();
            if (ServletMergeHandler.isServletConfigured(servletName, mergeContext)) {
                Servlet targetServlet = ServletMergeHandler.getServlet(servletName, mergeContext);
                //merge init-params, we only merge those init-param that are not explicitly configured in the web.xml or web-fragment.xml
                for (WebInitParam webInitParam : webServlet.initParams()) {
                    String paramName = webInitParam.name();
                    if (ServletInitParamMergeHandler.isServletInitParamConfigured(servletName, paramName, mergeContext)) {
                        continue;
                    }
                    ParamValue newParamValue = WebFilterAnnotationMergeHandler.newParamValue(webInitParam);
                    targetServlet.getInitParam().add(newParamValue);
                    ServletInitParamMergeHandler.addServletInitParam(servletName, newParamValue, ElementSource.ANNOTATION, mergeContext.getCurrentJarUrl(), mergeContext);
                }
            } else {
                //Add a new Servlet
                //create servlet element
                Servlet newServlet = new Servlet();
                if (!webServlet.displayName().isEmpty()) {
                    newServlet.addDisplayName(new Text(null, webServlet.displayName()));
                }
                newServlet.setServletClass(cls.getName());
                newServlet.setServletName(servletName);
                newServlet.setAsyncSupported(webServlet.asyncSupported());
                if (!webServlet.description().isEmpty()) {
                    newServlet.addDescription(new Text(null, webServlet.description()));
                }
                if (webServlet.loadOnStartup() != -1) {
                    newServlet.setLoadOnStartup(webServlet.loadOnStartup());
                }
                for (WebInitParam webInitParam : webServlet.initParams()) {
                    newServlet.getInitParam().add(WebFilterAnnotationMergeHandler.newParamValue(webInitParam));
                }
                if (!webServlet.smallIcon().isEmpty() || !webServlet.largeIcon().isEmpty()) {
                    Icon icon = new Icon();
                    if (!webServlet.smallIcon().isEmpty()) {
                        icon.setSmallIcon(webServlet.smallIcon());
                    }
                    if (!webServlet.largeIcon().isEmpty()) {
                        icon.setLargeIcon(webServlet.largeIcon());
                    }
                    newServlet.getIconMap().put(null, icon);
                }
                MultipartConfig multipartConfig = cls.getAnnotation(MultipartConfig.class);
                if (multipartConfig != null) {
                    org.apache.openejb.jee.MultipartConfig mpc = new org.apache.openejb.jee.MultipartConfig();
                    mpc.setFileSizeThreshold(multipartConfig.fileSizeThreshold());
                    mpc.setLocation(multipartConfig.location());
                    mpc.setMaxFileSize(multipartConfig.maxFileSize());
                    mpc.setMaxRequestSize(multipartConfig.maxRequestSize());
                    newServlet.setMultipartConfig(mpc);
                }
                webApp.getServlet().add(newServlet);
                ServletMergeHandler.addServlet(newServlet, mergeContext);
            }
            if (!ServletMappingMergeHandler.isServletMappingConfigured(servletName, mergeContext)) {
View Full Code Here

                if (LOG.isDebugEnabled()) {
                    LOG.debug("Discovered POJO Web Service: " + service.getName());
                }
                // add new <servlet/> element
                Servlet servlet = new Servlet();
                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());
View Full Code Here

    @Override
    public void merge(WebFragment webFragment, WebApp webApp, MergeContext mergeContext) throws DeploymentException {
        for (Servlet srcServlet : webFragment.getServlet()) {
            String servletName = srcServlet.getServletName();
            Servlet targetServlet = (Servlet) mergeContext.getAttribute(createServletKey(servletName));
            if (targetServlet == null) {
                webApp.getServlet().add(srcServlet);
                mergeContext.setAttribute(createServletKey(servletName), srcServlet);
                for (SubMergeHandler<Servlet, Servlet> subMergeHandler : subMergeHandlers) {
                    subMergeHandler.add(srcServlet, mergeContext);
View Full Code Here

                if (existingServlets.contains(webServiceClass.getName())) continue;

                // create webApp and webservices objects if they don't exist already

                // add new <servlet/> element
                Servlet servlet = new Servlet();
                servlet.setServletName(webServiceClass.getName());
                servlet.setServletClass(webServiceClass.getName());
                webApp.getServlet().add(servlet);
            }

            return webModule;
        }
View Full Code Here

                if (existingServlets.contains(webServiceClass.getName())) continue;

                // create webApp and webservices objects if they don't exist already

                // add new <servlet/> element
                Servlet servlet = new Servlet();
                servlet.setServletName(webServiceClass.getName());
                servlet.setServletClass(webServiceClass.getName());
                webApp.getServlet().add(servlet);
            }

            /*
             * REST
 
View Full Code Here

         * TODO It is an error for more than one application to be deployed at the same effective servlet mapping
         */

        applicationClass = applicationClasses.iterator().next();

        Servlet restServletInfo = new Servlet();
        restServletInfo.setServletClass(REST_SERVLET_NAME);
        restServletInfo.setServletName(REST_SERVLET_NAME);

        ParamValue paramApplication = new ParamValue();
        paramApplication.setParamName("javax.ws.rs.Application");
        paramApplication.setParamValue(applicationClass.getName());
        restServletInfo.getInitParam().add(paramApplication);

        ParamValue paramDeploymentConfig = new ParamValue();
        paramDeploymentConfig.setParamName("deploymentConfiguration");
        paramDeploymentConfig.setParamValue(GeronimoWinkDeloymentConfiguration.class.getName());

        restServletInfo.getInitParam().add(paramDeploymentConfig);

        if (applicationClass.isAnnotationPresent(ApplicationPath.class)) {

            ApplicationPath ap = applicationClass.getAnnotation(ApplicationPath.class);

View Full Code Here

TOP

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

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.