Package org.apache.pluto.descriptors.servlet

Examples of org.apache.pluto.descriptors.servlet.WebAppDD


        in = null;
    }

    public void testRead() throws Exception
    {
        WebAppDD webappdd = underTest.read(in);
        assertNotNull(webappdd);
        assertEquals("2.3", webappdd.getServletVersion());       
    }
View Full Code Here


    public void testWrite() throws Exception
    {
        File outputFile = File.createTempFile( "webapp-2.3-descriptor-test", ".xml" );
        OutputStream out = new FileOutputStream( outputFile );       
        WebAppDD webappdd = underTest.read(in);
        underTest.write(webappdd, out);       
        // now round-trip it
        WebAppDD webappdd2 = underTest.read(new FileInputStream(outputFile));
        assertNotNull(webappdd2);
        assertEquals("2.3", webappdd2.getServletVersion());
    }
View Full Code Here

        underTest = null;
    }

    public void testRead() throws Exception
    {
        WebAppDD webapp = underTest.read(in);
        assertNotNull(webapp);
        assertEquals("2.4", webapp.getServletVersion());
    }
View Full Code Here

        assertEquals("2.4", webapp.getServletVersion());
    }

    public void testWrite() throws Exception
    {
        WebAppDD webapp = underTest.read(in);
        File outputFile = File.createTempFile("webapp-2.4-descriptor-test", ".xml");
        FileOutputStream out = new FileOutputStream(outputFile);
        underTest.write(webapp, out);
        // roundtrip it.
        WebAppDD webapp2 = underTest.read(new FileInputStream(outputFile));
        assertNotNull(webapp2);
        assertEquals("2.4", webapp2.getServletVersion());
    }
View Full Code Here

            dispatchServletClass.trim().length() == 0) {
            dispatchServletClass = DISPATCH_SERVLET_CLASS;
        }
       
        WebAppDescriptorService descriptorSvc = new WebAppDescriptorServiceImpl();
        WebAppDD webAppDDIn = descriptorSvc.read(webXmlIn);

        PortletAppDescriptorService portletAppDescriptorService =
                new PortletAppDescriptorServiceImpl();
        PortletAppDD portletAppDD = portletAppDescriptorService.read(portletXmlIn);
        portletXmlIn.close();
       
        for (Iterator it = portletAppDD.getPortlets().iterator();
                it.hasNext(); ) {
           
            // Read portlet definition.
            PortletDD portlet = (PortletDD) it.next();
            String name = portlet.getPortletName();

            ServletDD servlet = new ServletDD();
            servlet.setServletName(name);
    
            servlet.setServletClass(dispatchServletClass);

            InitParamDD initParam = new InitParamDD();
            initParam.setParamName("portlet-name");
            initParam.setParamValue(name);
            servlet.getInitParams().add(initParam);
           
            LoadOnStartupDD onStartup = new LoadOnStartupDD();
            onStartup.setPriority(1);
            servlet.setLoadOnStartup(onStartup);

            ServletMappingDD servletMapping = new ServletMappingDD();
            servletMapping.setServletName(name);
            servletMapping.setUrlPattern("/PlutoInvoker/" + name);

            webAppDDIn.getServlets().add(servlet);
            webAppDDIn.getServletMappings().add(servletMapping);
           
        }
       
        descriptorSvc.write(webAppDDIn, webXmlOut);
    }
View Full Code Here

            dispatchServletClass.trim().length() == 0) {
            dispatchServletClass = DISPATCH_SERVLET_CLASS;
        }

        WebAppDescriptorService descriptorSvc = new WebAppDescriptorServiceImpl();
        WebAppDD webAppDDIn = descriptorSvc.read(webXmlIn);

        PortletAppDescriptorService portletAppDescriptorService =
                new PortletAppDescriptorServiceImpl();
        PortletAppDD portletAppDD = portletAppDescriptorService.read(portletXmlIn);
        portletXmlIn.close();

        for (Iterator it = portletAppDD.getPortlets().iterator();
                it.hasNext(); ) {

            // Read portlet definition.
            PortletDD portlet = (PortletDD) it.next();
            String name = portlet.getPortletName();

            ServletDD servlet = new ServletDD();
            servlet.setServletName(name);

            servlet.setServletClass(dispatchServletClass);

            InitParamDD initParam = new InitParamDD();
            initParam.setParamName("portlet-name");
            initParam.setParamValue(name);
            servlet.getInitParams().add(initParam);

            LoadOnStartupDD onStartup = new LoadOnStartupDD();
            onStartup.setPriority(1);
            servlet.setLoadOnStartup(onStartup);

            ServletMappingDD servletMapping = new ServletMappingDD();
            servletMapping.setServletName(name);
            servletMapping.setUrlPattern("/PlutoInvoker/" + name);

            webAppDDIn.getServlets().add(servlet);
            webAppDDIn.getServletMappings().add(servletMapping);

        }

        descriptorSvc.write(webAppDDIn, webXmlOut);
    }
View Full Code Here

        in = null;
    }

    public void testRead() throws Exception
    {
        WebAppDD webappdd = underTest.read(in);
        assertNotNull(webappdd);
        assertEquals("2.3", webappdd.getServletVersion());
    }
View Full Code Here

    public void testWrite() throws Exception
    {
        File outputFile = File.createTempFile( "webapp-2.3-descriptor-test", ".xml" );
        OutputStream out = new FileOutputStream( outputFile );
        WebAppDD webappdd = underTest.read(in);
        underTest.write(webappdd, out);
        // now round-trip it
        WebAppDD webappdd2 = underTest.read(new FileInputStream(outputFile));
        assertNotNull(webappdd2);
        assertEquals("2.3", webappdd2.getServletVersion());
    }
View Full Code Here

        underTest = null;
    }

    public void testRead() throws Exception
    {
        WebAppDD webapp = underTest.read(in);
        assertNotNull(webapp);
        assertEquals("2.4", webapp.getServletVersion());
    }
View Full Code Here

        assertEquals("2.4", webapp.getServletVersion());
    }

    public void testWrite() throws Exception
    {
        WebAppDD webapp = underTest.read(in);
        File outputFile = File.createTempFile("webapp-2.4-descriptor-test", ".xml");
        FileOutputStream out = new FileOutputStream(outputFile);
        underTest.write(webapp, out);
        // roundtrip it.
        WebAppDD webapp2 = underTest.read(new FileInputStream(outputFile));
        assertNotNull(webapp2);
        assertEquals("2.4", webapp2.getServletVersion());
    }
View Full Code Here

TOP

Related Classes of org.apache.pluto.descriptors.servlet.WebAppDD

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.