Package org.jboss.shrinkwrap.descriptor.api.webapp25

Examples of org.jboss.shrinkwrap.descriptor.api.webapp25.WebAppDescriptor


    */
   @Override
   public WebAppDescriptor getConfig()
   {
      FileResource<?> configFile = getConfigFile();
      WebAppDescriptor descriptor;
      if (configFile.exists())
      {

         DescriptorImporter<WebAppDescriptor> importer = Descriptors.importAs(WebAppDescriptor.class);
         InputStream inputStream = configFile.getResourceInputStream();
         try
         {
            descriptor = importer.fromStream(inputStream);
         }
         finally
         {
            Streams.closeQuietly(inputStream);
         }
      }
      else
      {
         descriptor = Descriptors.create(WebAppDescriptor.class);
         String projectName = getFaceted().getFacet(MetadataFacet.class).getProjectName();
         WebAppDescriptor unit = descriptor
                  .version("2.5")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
         configFile.setContents(descriptor.exportAsString());
      }
      return descriptor;
   }
View Full Code Here


    */
   @Override
   public WebAppDescriptor getConfig()
   {
      FileResource<?> configFile = getConfigFile();
      WebAppDescriptor descriptor;
      if (configFile.exists())
      {

         DescriptorImporter<WebAppDescriptor> importer = Descriptors.importAs(WebAppDescriptor.class);
         InputStream inputStream = configFile.getResourceInputStream();
         try
         {
            descriptor = importer.fromStream(inputStream);
         }
         finally
         {
            Streams.closeQuietly(inputStream);
         }
      }
      else
      {
         descriptor = Descriptors.create(WebAppDescriptor.class);
         String projectName = getFaceted().getFacet(MetadataFacet.class).getProjectName();
         WebAppDescriptor unit = descriptor
                  .version("2.5")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
         configFile.setContents(descriptor.exportAsString());
      }
      return descriptor;
   }
View Full Code Here

      }
   }

   private void enhanceWithSeamListener(final WebArchive archive, final InputStream webAppDescriptorStream)
   {
      final WebAppDescriptor webAppDescriptor = Descriptors.importAs(WebAppDescriptor.class).fromStream(webAppDescriptorStream);
      webAppDescriptor.getOrCreateListener().listenerClass("org.jboss.seam.servlet.SeamListener");
      archive.delete("WEB-INF/web.xml");
      archive.setWebXML(new StringAsset(webAppDescriptor.exportAsString()));
   }
View Full Code Here

    */
   @Override
   public WebAppDescriptor getConfig()
   {
      FileResource<?> configFile = getConfigFile();
      WebAppDescriptor descriptor;
      if (configFile.exists())
      {

         DescriptorImporter<WebAppDescriptor> importer = Descriptors.importAs(WebAppDescriptor.class);
         InputStream inputStream = configFile.getResourceInputStream();
         try
         {
            descriptor = importer.fromStream(inputStream);
         }
         finally
         {
            Streams.closeQuietly(inputStream);
         }
      }
      else
      {
         descriptor = Descriptors.create(WebAppDescriptor.class);
         String projectName = getFaceted().getFacet(MetadataFacet.class).getProjectName();
         WebAppDescriptor unit = descriptor
                  .version("2.5")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
         configFile.setContents(descriptor.exportAsString());
      }
      return descriptor;
   }
View Full Code Here

    */
   @Override
   public WebAppDescriptor getConfig()
   {
      FileResource<?> configFile = getConfigFile();
      WebAppDescriptor descriptor;
      if (configFile.exists())
      {

         DescriptorImporter<WebAppDescriptor> importer = Descriptors.importAs(WebAppDescriptor.class);
         InputStream inputStream = configFile.getResourceInputStream();
         try
         {
            descriptor = importer.fromStream(inputStream);
         }
         finally
         {
            Streams.closeQuietly(inputStream);
         }
      }
      else
      {
         descriptor = Descriptors.create(WebAppDescriptor.class);
         String projectName = getFaceted().getFacet(MetadataFacet.class).getProjectName();
         WebAppDescriptor unit = descriptor
                  .version("2.5")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
         configFile.setContents(descriptor.exportAsString());
      }
      return descriptor;
   }
View Full Code Here

                  && 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())
               {
                  if (welcomeFile.equals(INDEX_HTML))
View Full Code Here

      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();

      generateTemplates(targetDir);
      HashMap<Object, Object> context = getTemplateContext(targetDir, template);
View Full Code Here

   {
      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

      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

    */
   @Override
   public WebAppDescriptor getConfig()
   {
      FileResource<?> configFile = getConfigFile();
      WebAppDescriptor descriptor;
      if (configFile.exists())
      {

         DescriptorImporter<WebAppDescriptor> importer = Descriptors.importAs(WebAppDescriptor.class);
         InputStream inputStream = configFile.getResourceInputStream();
         try
         {
            descriptor = importer.fromStream(inputStream);
         }
         finally
         {
            Streams.closeQuietly(inputStream);
         }
      }
      else
      {
         descriptor = Descriptors.create(WebAppDescriptor.class);
         String projectName = getFaceted().getFacet(MetadataFacet.class).getProjectName();
         WebAppDescriptor unit = descriptor
                  .version("3.0")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
      }
      return descriptor;
   }
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.descriptor.api.webapp25.WebAppDescriptor

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.