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("3.0")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
      }
      return descriptor;
   }
View Full Code Here


    @Inject
    private ProjectStage projectStage;

    @Deployment(testable = true)
    public static WebArchive getArchive() {
        final WebAppDescriptor descriptor = Descriptors.create(WebAppDescriptor.class).version(WebAppVersionType._3_0);
        // web.xml params is not supported by default
        // descriptor.contextParam(ProjectStage.PROJECT_STAGE_PARAM_NAME, ProjectStage.SystemTest.name());

        return ShrinkWrap.create(WebArchive.class, "MyFacesExtCdiDeploymentTest.war")
                .addAsLibraries(JarLocation.jarLocation(Test.class)) // junit
                .addAsLibraries(JarLocation.jarLocation(JsfProjectStageProducer.class)) // codi
                .setWebXML(new StringAsset(descriptor.exportAsString()))
                .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
    }
View Full Code Here

   public void install(Project project)
   {
      if (!installedInWebXML(project))
      {
         ServletFacet_3_0 servlet = project.getFacet(ServletFacet_3_0.class);
         WebAppDescriptor config = servlet.getConfig();

         config.createServlet().servletName(JAXRS_SERVLET).loadOnStartup(1);
         String urlPattern = path;
         if (urlPattern.endsWith("/"))
         {
            urlPattern = urlPattern.substring(0, urlPattern.length() - 1);
         }
         config.createServletMapping().servletName(JAXRS_SERVLET).urlPattern(urlPattern);
         servlet.saveConfig(config);
      }
   }
View Full Code Here

   {
      String servletPath = null;
      if (project.hasFacet(ServletFacet_3_0.class))
      {
         ServletFacet_3_0 servlet = project.getFacet(ServletFacet_3_0.class);
         WebAppDescriptor config = servlet.getConfig();
         List<ServletMappingType<WebAppDescriptor>> allServletMapping = config.getAllServletMapping();
         for (ServletMappingType<WebAppDescriptor> servletMappingType : allServletMapping)
         {
            if (JAXRS_SERVLET.equals(servletMappingType.getServletName()))
            {
               List<String> allUrlPattern = servletMappingType.getAllUrlPattern();
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

  private static DeploymentContext createDeploymentContext(
      GatewayConfig config, Topology topology,
      Map<String,List<ProviderDeploymentContributor>> providers,
      Map<String,List<ServiceDeploymentContributor>> services ) {
    WebArchive webArchive = ShrinkWrap.create( WebArchive.class, topology.getName() );
    WebAppDescriptor webAppDesc = Descriptors.create( WebAppDescriptor.class );
    GatewayDescriptor gateway = GatewayDescriptorFactory.create();
    DeploymentContext context = new DeploymentContextImpl(
        config, topology, gateway, webArchive, webAppDesc, providers, services );
    return context;
  }
View Full Code Here

  private static void initialize(
      DeploymentContext context,
      Map<String,List<ProviderDeploymentContributor>> providers,
      Map<String,List<ServiceDeploymentContributor>> services ) {
    WebAppDescriptor wad = context.getWebAppDescriptor();
    String servletName = context.getTopology().getName();
    String servletClass = GatewayServlet.class.getName();
    wad.createServlet().servletName( servletName ).servletClass( servletClass );
    wad.createServletMapping().servletName( servletName ).urlPattern( "/*" );
    if (gatewayServices != null) {
      gatewayServices.initializeContribution(context);
    } else {
      log.gatewayServicesNotInitialized();
    }
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.1")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
      }
      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("3.1")
                  .displayName(projectName)
                  .createSessionConfig()
                  .sessionTimeout(30).up();
         // FORGE-657
         unit.createMimeMapping().extension("ico").mimeType("image/x-icon");
      }
      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("3.1")
                  .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.