Class ZipCreateController

java.lang.Object
io.micronaut.starter.api.create.AbstractCreateController
io.micronaut.starter.api.create.zip.ZipCreateController
All Implemented Interfaces:
ZipCreateOperation

@Controller @ExecuteOn("blocking") public class ZipCreateController extends AbstractCreateController implements ZipCreateOperation
Implements the ZipCreateOperation interface for applications.
Since:
1.0.0
Author:
graemerocher
  • Field Details

  • Constructor Details

    • ZipCreateController

      public ZipCreateController(ProjectGenerator projectGenerator, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)
      Default constructor.
      Parameters:
      projectGenerator - The project generator
      eventPublisher - The event publisher
  • Method Details

    • createApp

      @Get(uri="/create/{type}/{name}{?features,lang,build,test,javaVersion}", produces="application/zip") public io.micronaut.http.HttpResponse<io.micronaut.core.io.Writable> createApp(ApplicationType type, @Pattern(regexp="[\\w\\d-_\\.]+") @Pattern(regexp="[\\w\\d-_\\.]+") String name, @Nullable @Nullable List<String> features, @Nullable @Nullable BuildTool build, @Nullable @Nullable TestFramework test, @Nullable @Nullable Language lang, @Nullable @Nullable JdkVersion javaVersion, @Nullable @Header("User-Agent") @Nullable String userAgent)
      Creates an application, generating a ZIP file as the response.
      Specified by:
      createApp in interface ZipCreateOperation
      Parameters:
      type - The application type The application type
      name - The name of the application The name of the application
      features - The features The chosen features
      build - The build type (optional, defaults to Gradle)
      test - The test framework (optional, defaults to JUnit)
      lang - The language (optional, defaults to Java)
      Returns:
      A ZIP file containing the generated application.
    • createZip

      @Get(uri="/{name}.zip{?type,features,lang,build,test}", produces="application/zip") public io.micronaut.http.HttpResponse<io.micronaut.core.io.Writable> createZip(@Bindable(defaultValue="default") ApplicationType type, @Pattern(regexp="[\\w\\d-_]+") @NotBlank @Pattern(regexp="[\\w\\d-_]+") @NotBlank String name, @Nullable @Nullable List<String> features, @Nullable @Nullable BuildTool build, @Nullable @Nullable TestFramework test, @Nullable @Nullable Language lang, @Nullable @Nullable JdkVersion javaVersion, @Nullable @Header("User-Agent") @Nullable String userAgent)
      Creates the default application type using the name of the given Zip.
      Parameters:
      type - The type
      name - The ZIP name
      features - The features
      build - The build tool
      test - The test framework
      lang - The language
      Returns:
      A Zip file containing the application
    • generateAppIntoZipFile

      public io.micronaut.http.HttpResponse<io.micronaut.core.io.Writable> generateAppIntoZipFile(@NotNull @NotNull ApplicationType type, @NotNull @NotNull String name, @Nullable @Nullable List<String> features, @Nullable @Nullable BuildTool buildTool, @Nullable @Nullable TestFramework testFramework, @Nullable @Nullable Language lang, @Nullable @Nullable JdkVersion javaVersion, @Nullable @Nullable String userAgent)
    • getFilename

      @NonNull protected @NonNull String getFilename(@NonNull @NonNull Project project)
      Parameters:
      project - The project
      Returns:
      The file name to return.