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 Summary
Fields inherited from class io.micronaut.starter.api.create.AbstractCreateController
projectGenerator
-
Constructor Summary
ConstructorDescriptionZipCreateController
(ProjectGenerator projectGenerator, io.micronaut.context.event.ApplicationEventPublisher eventPublisher) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.http.HttpResponse<io.micronaut.core.io.Writable>
createApp
(ApplicationType type, @Pattern(regexp="[\\w\\d-_\\.]+") String name, @Nullable List<String> features, @Nullable BuildTool build, @Nullable TestFramework test, @Nullable Language lang, @Nullable JdkVersion javaVersion, @Nullable String userAgent) Creates an application, generating a ZIP file as the response.io.micronaut.http.HttpResponse<io.micronaut.core.io.Writable>
createZip
(ApplicationType type, @Pattern(regexp="[\\w\\d-_]+") @NotBlank String name, @Nullable List<String> features, @Nullable BuildTool build, @Nullable TestFramework test, @Nullable Language lang, @Nullable JdkVersion javaVersion, @Nullable String userAgent) Creates the default application type using the name of the given Zip.io.micronaut.http.HttpResponse<io.micronaut.core.io.Writable>
generateAppIntoZipFile
(@NotNull ApplicationType type, @NotNull String name, @Nullable List<String> features, @Nullable BuildTool buildTool, @Nullable TestFramework testFramework, @Nullable Language lang, @Nullable JdkVersion javaVersion, @Nullable String userAgent) protected @NonNull String
getFilename
(@NonNull Project project) Methods inherited from class io.micronaut.starter.api.create.AbstractCreateController
createProjectGeneratorContext, getOperatingSystem
-
Field Details
-
MEDIA_TYPE_APPLICATION_ZIP
- See Also:
-
-
Constructor Details
-
ZipCreateController
public ZipCreateController(ProjectGenerator projectGenerator, io.micronaut.context.event.ApplicationEventPublisher eventPublisher) Default constructor.- Parameters:
projectGenerator
- The project generatoreventPublisher
- 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 interfaceZipCreateOperation
- Parameters:
type
- The application type The application typename
- The name of the application The name of the applicationfeatures
- The features The chosen featuresbuild
- 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 typename
- The ZIP namefeatures
- The featuresbuild
- The build tooltest
- The test frameworklang
- 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
- Parameters:
project
- The project- Returns:
- The file name to return.
-