Package org.jasig.portal.container.om.servlet

Examples of org.jasig.portal.container.om.servlet.ServletMappingListImpl


                webAppE.appendChild(servletE);
            }
        }
       
        // <servlet-mapping>
        ServletMappingListImpl servletMappings = webAppImpl.getServletMappings();
        if (servletMappings != null) {
            for (Iterator iter = servletMappings.iterator(); iter.hasNext();) {
                ServletMappingImpl servletMapping = (ServletMappingImpl)iter.next();
                Element servletMappingE = doc.createElement("servlet-mapping");
                addTextElement(servletMappingE, "servlet-name", servletMapping.getServletName());
                addTextElement(servletMappingE, "url-pattern", servletMapping.getUrlPattern());
                webAppE.appendChild(servletMappingE);
View Full Code Here


        }
        return listeners;
    }
   
    private ServletMappingListImpl getServletMappings(Element e) {
        ServletMappingListImpl servletMappings = new ServletMappingListImpl();
        NodeList servletMappingNL = e.getElementsByTagName("servlet-mapping");
        for (int i = 0; i < servletMappingNL.getLength(); i++) {
            Element servletMappingE = (Element)servletMappingNL.item(i);
            String servletName = XML.getChildElementText(servletMappingE, "servlet-name");
            String urlPattern = XML.getChildElementText(servletMappingE, "url-pattern");
            ServletMappingImpl servletMapping = new ServletMappingImpl();
            servletMapping.setServletName(servletName);
            servletMapping.setUrlPattern(urlPattern);
            servletMappings.add(servletMapping);
        }
        return servletMappings;
    }
View Full Code Here

            PortletApplicationDefinition portletApplicationDefinition = pau.getPortletApplicationDefinition(webApplicationDefinition);
         
            ControllerFactory controllerFactory = new ControllerFactoryImpl();

            ServletDefinitionListCtrl servletDefinitionSetCtrl = (ServletDefinitionListCtrl)controllerFactory.get(webApplicationDefinition.getServletDefinitionList());
            ServletMappingListImpl servletMappings = webApplicationDefinition.getServletMappings();

            Iterator portlets = portletApplicationDefinition.getPortletDefinitionList().iterator();
            while (portlets.hasNext()) {

                PortletDefinition portlet = (PortletDefinition)portlets.next();

                // Check if already exists
                ServletDefinition servlet = webApplicationDefinition.getServletDefinitionList().get(portlet.getName());
                if (servlet != null) {
                    if (!servlet.getServletClass().equals("org.apache.pluto.core.PortletServlet")) {
                        System.out.println("Note: Replaced already existing the servlet with the name '" + portlet.getName() + "' with the wrapper servlet.");
                    }
                    ServletDefinitionCtrl _servletCtrl = (ServletDefinitionCtrl)controllerFactory.get(servlet);
                    _servletCtrl.setServletClass("org.apache.pluto.core.PortletServlet");
                } else {
                    servlet = servletDefinitionSetCtrl.add(portlet.getName(), "org.apache.pluto.core.PortletServlet");
                }

                ServletDefinitionCtrl servletCtrl = (ServletDefinitionCtrl)controllerFactory.get(servlet);

                DisplayNameImpl dispName = new DisplayNameImpl();
                dispName.setDisplayName(portlet.getName() + " Wrapper");
                dispName.setLocale(Locale.getDefault());
                DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
                dispSet.add(dispName);
                servletCtrl.setDisplayNames((DisplayNameSet)dispSet);
                DescriptionImpl desc = new DescriptionImpl();
                desc.setDescription("Automated generated Portlet Wrapper");
                desc.setLocale(Locale.getDefault());
                DescriptionSetImpl descSet = new DescriptionSetImpl();
                descSet.add(desc);
                servletCtrl.setDescriptions(descSet);
                ParameterSet parameters = servlet.getInitParameterSet();

                ParameterSetCtrl parameterSetCtrl = (ParameterSetCtrl)controllerFactory.get(parameters);

                Parameter parameter1 = parameters.get("portlet-class");
                if (parameter1 == null) {
                    parameterSetCtrl.add("portlet-class", portlet.getClassName());
                } else {
                    ParameterCtrl parameterCtrl = (ParameterCtrl)controllerFactory.get(parameter1);
                    parameterCtrl.setValue(portlet.getClassName());

                }
                Parameter parameter2 = parameters.get("portlet-guid");
                if (parameter2 == null) {
                    parameterSetCtrl.add("portlet-guid", portlet.getId().toString());
                } else {
                    ParameterCtrl parameterCtrl = (ParameterCtrl)controllerFactory.get(parameter2);
                    parameterCtrl.setValue(portlet.getId().toString());

                }

                boolean found = false;
                Iterator mappings = servletMappings.iterator();
                while (mappings.hasNext()) {
                    ServletMappingImpl servletMapping = (ServletMappingImpl)mappings.next();
                    if (servletMapping.getServletName().equals(portlet.getName())) {
                        found = true;
                        servletMapping.setUrlPattern("/" + portlet.getName().replace(' ', '_') + "/*");
                    }
                }
                if (!found) {
                    ServletMappingImpl servletMapping = new ServletMappingImpl();
                    servletMapping.setServletName(portlet.getName());
                    servletMapping.setUrlPattern("/" + portlet.getName().replace(' ', '_') + "/*");
                    servletMappings.add(servletMapping);
                }
               
                // Add in portlet taglib
                TagLibImpl tagLib = new TagLibImpl();
                tagLib.setTaglibUri(WEB_PORTLET_TAGLIB_URI);
View Full Code Here

TOP

Related Classes of org.jasig.portal.container.om.servlet.ServletMappingListImpl

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.