in grails-forge-api/src/main/java/org/grails/forge/api/create/github/GitHubCreateController.java [104:142]
public HttpResponse<GitHubCreateDTO> createApp(
@NonNull ApplicationType type,
@Pattern(regexp = "[\\w\\d-_\\.]+") String name,
@Nullable List<String> features,
@Nullable BuildTool build,
@Nullable TestFramework test,
@Nullable GormImpl gorm,
@Nullable ServletImpl servlet,
@Nullable JdkVersion javaVersion,
@Nullable String code,
@Nullable String state,
@Nullable @Header(HttpHeaders.USER_AGENT) String userAgent,
@Parameter(hidden = true) @NonNull RequestInfo requestInfo) {
URI launcherURI = redirectService.getLauncherURI();
try {
if (StringUtils.isEmpty(code) || StringUtils.isEmpty(state)) {
return HttpResponse.temporaryRedirect(redirectService.constructOAuthRedirectUrl(requestInfo));
} else {
GitHubRepository repository = gitHubCreateService.creatApp(
type, name, features, build, test, gorm, servlet, javaVersion, code, state, userAgent);
if (launcherURI == null) {
return HttpResponse.ok(new GitHubCreateDTO(repository.getUrl(), repository.getCloneUrl(), repository.getHtmlUrl()));
} else {
return HttpResponse.temporaryRedirect(redirectService.constructGrailsForgeRedirectUrl(repository));
}
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage());
}
if (launcherURI == null) {
throw e;
} else {
return HttpResponse.temporaryRedirect(redirectService.constructGrailsForgeErrorRedirectUrl(e.getMessage()));
}
}
}