/*
   * Facet Methods
   */
  @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;
  }
Example #2
0
 public WebAppDescriptor getConfig() {
   DescriptorImporter<WebAppDescriptor> importer = Descriptors.importAs(WebAppDescriptor.class);
   WebAppDescriptor descriptor = importer.from(getConfigFile().getResourceInputStream());
   return descriptor;
 }