Package org.jboss.forge.addon.javaee.servlet

Examples of org.jboss.forge.addon.javaee.servlet.ServletFacet


                  && web.getWebResource(SEARCH_PNG).exists()
                  && web.getWebResource(TRUE_PNG).exists()
                  && web.getWebResource(JBOSS_COMMUNITY_PNG).exists()
                  && web.getWebResource(PAGINATOR).exists()
                  && getTemplateStrategy().getDefaultTemplate().exists();
         ServletFacet servlet = project.getFacet(ServletFacet.class);
         boolean isWelcomeFileListed = false;
         if (servlet instanceof ServletFacet_3_0)
         {
            WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
            for (WelcomeFileListType<WebAppDescriptor> welcomeFileList : servletConfig.getAllWelcomeFileList())
            {
               for (String welcomeFile : welcomeFileList.getAllWelcomeFile())
               {
                  if (welcomeFile.equals(INDEX_HTML))
                  {
                     isWelcomeFileListed = true;
                     break;
                  }
               }
            }
         }
         else if (servlet instanceof ServletFacet_3_1)
         {
            org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                     .getConfig();
            for (org.jboss.shrinkwrap.descriptor.api.webcommon31.WelcomeFileListType<org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor> welcomeFileList : servletConfig
                     .getAllWelcomeFileList())
            {
               for (String welcomeFile : welcomeFileList.getAllWelcomeFile())
View Full Code Here


   protected List<Resource<?>> generateIndex(String targetDir, final Resource<?> template)
   {
      List<Resource<?>> result = new ArrayList<Resource<?>>();
      WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);

      ServletFacet servlet = this.project.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile(INDEX_HTML);
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile(INDEX_HTML);
      }
      loadTemplates();
View Full Code Here

   }

   protected void setupWebXML()
   {
      WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);
      ServletFacet servlet = this.project.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         Node root = ((NodeDescriptor) servletConfig).getRootNode();
         removeConflictingErrorPages(root);

         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (ParamValueType<WebAppDescriptor> contextParam : servletConfig.getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (org.jboss.shrinkwrap.descriptor.api.javaee7.ParamValueType<org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor> contextParam : servletConfig
                  .getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
   }
View Full Code Here

    */
   private void configureWelcomeFile()
   {
      String indexFileEntry = "/index.html";

      ServletFacet servlet = this.project.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile(indexFileEntry);
         servlet.saveConfig(servletConfig);
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile(indexFileEntry);
         servlet.saveConfig(servletConfig);
      }
      return;
   }
View Full Code Here

   protected List<Resource<?>> generateIndex(String targetDir, final Resource<?> template, final boolean overwrite)
   {
      List<Resource<?>> result = new ArrayList<Resource<?>>();
      WebResourcesFacet web = this.origin.getFacet(WebResourcesFacet.class);

      ServletFacet servlet = this.origin.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile("/index.html");
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile("/index.html");
      }
      loadTemplates();
View Full Code Here

   }

   protected void setupWebXML()
   {
      WebResourcesFacet web = this.origin.getFacet(WebResourcesFacet.class);
      ServletFacet servlet = this.origin.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         Node root = ((NodeDescriptor) servletConfig).getRootNode();
         removeConflictingErrorPages(root);

         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (ParamValueType<WebAppDescriptor> contextParam : servletConfig.getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (org.jboss.shrinkwrap.descriptor.api.javaee7.ParamValueType<org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor> contextParam : servletConfig
                  .getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
   }
View Full Code Here

   @SuppressWarnings({ "rawtypes", "unchecked" })
   private boolean hasServletMapping()
   {
      if (getFaceted().hasFacet(ServletFacet.class))
      {
         ServletFacet servlet = getFaceted().getFacet(ServletFacet.class);
         List<ServletMappingCommonType> mappings = ((WebAppCommonDescriptor) servlet.getConfig())
                  .getAllServletMapping();
         for (ServletMappingCommonType mapping : mappings)
         {
            if (FACES_SERVLET_NAME.equals(mapping.getServletName()))
            {
View Full Code Here

   protected List<Resource<?>> generateIndex(String targetDir, final Resource<?> template, final boolean overwrite)
   {
      List<Resource<?>> result = new ArrayList<Resource<?>>();
      WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);

      ServletFacet servlet = this.project.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile("/index.html");
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         servletConfig.getOrCreateWelcomeFileList().welcomeFile("/index.html");
      }
      loadTemplates();
View Full Code Here

   }

   protected void setupWebXML()
   {
      WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);
      ServletFacet servlet = this.project.getFacet(ServletFacet.class);
      if (servlet instanceof ServletFacet_3_0)
      {
         WebAppDescriptor servletConfig = (WebAppDescriptor) servlet.getConfig();
         Node root = ((NodeDescriptor) servletConfig).getRootNode();
         removeConflictingErrorPages(root);

         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (ParamValueType<WebAppDescriptor> contextParam : servletConfig.getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
      else if (servlet instanceof ServletFacet_3_1)
      {
         org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor servletConfig = (org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor) servlet
                  .getConfig();
         // (prefer /faces/error.xhtml)

         String errorLocation = getAccessStrategy().getWebPaths(web.getWebResource(ERROR_XHTML)).get(1);
         servletConfig.createErrorPage().errorCode("404").location(errorLocation);
         servletConfig.createErrorPage().errorCode("500").location(errorLocation);

         // Use the server timezone since we accept dates in that timezone, and it makes sense to display them in the
         // same
         boolean found = false;
         for (org.jboss.shrinkwrap.descriptor.api.javaee7.ParamValueType<org.jboss.shrinkwrap.descriptor.api.webapp31.WebAppDescriptor> contextParam : servletConfig
                  .getAllContextParam())
         {
            if (contextParam.getParamName().equals("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE"))
            {
               found = true;
            }
         }
         if (!found)
         {
            servletConfig.createContextParam()
                     .paramName("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE").paramValue("true");
         }
         servlet.saveConfig(servletConfig);
      }
   }
View Full Code Here

   @SuppressWarnings({ "rawtypes", "unchecked" })
   private boolean hasServletMapping()
   {
      if (getFaceted().hasFacet(ServletFacet.class))
      {
         ServletFacet servlet = getFaceted().getFacet(ServletFacet.class);
         List<ServletMappingCommonType> mappings = ((WebAppCommonDescriptor) servlet.getConfig())
                  .getAllServletMapping();
         for (ServletMappingCommonType mapping : mappings)
         {
            if (FACES_SERVLET_NAME.equals(mapping.getServletName()))
            {
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.javaee.servlet.ServletFacet

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.