Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Configured jax-rs controllers, filters and exception-mappers a… #44

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,38 +43,63 @@ public Set<Class<?>> getClasses() {

@NotNull
protected Set<Class<?>> getExceptionMappers() {
return new HashSet<>();
}

@NotNull
protected Set<Class<?>> getFilters() {
return new HashSet<>();
}

@NotNull
protected Set<Class<?>> getControllerClasses() {
return new HashSet<>();
}

@Override
@NotNull
public Set<Object> getSingletons() {
Set<Object> singletons = new HashSet<>();
singletons.addAll(getExceptionMapperSingletons());
singletons.addAll(getFilterSingletons());
singletons.addAll(getControllerSingletons());
return singletons;
}

@NotNull
protected Set<Object> getExceptionMapperSingletons() {
return new HashSet<>(Arrays.asList(
BadRequestExceptionMapper.class,
ForbiddenExceptionMapper.class,
IllegalArgumentExceptionMapper.class,
InternalServerErrorExceptionMapper.class,
NotFoundExceptionMapper.class,
ObjectNotFoundExceptionMapper.class,
UncaughtExceptionMapper.class
new BadRequestExceptionMapper(),
new ForbiddenExceptionMapper(),
new IllegalArgumentExceptionMapper(),
new InternalServerErrorExceptionMapper(),
new NotFoundExceptionMapper(),
new ObjectNotFoundExceptionMapper(),
new UncaughtExceptionMapper()
));
}

@NotNull
protected Set<Class<?>> getFilters() {
protected Set<Object> getFilterSingletons() {
return new HashSet<>(Arrays.asList(
AuthenticationFilter.class,
CorsFilter.class,
LogoutFilter.class
new AuthenticationFilter(),
new CorsFilter(),
new LogoutFilter()
));
}

@NotNull
protected Set<Class<?>> getControllerClasses() {
HashSet<Class<?>> controllerClasses = new HashSet<>(Arrays.asList(
ExtensionInfoApiController.class,
ExtensionInfoInternalController.class,
SwaggerController.class,
SwaggerDefinitionController.class
protected Set<Object> getControllerSingletons() {
HashSet<Object> controllerSingletons = new HashSet<>(Arrays.asList(
new ExtensionInfoApiController(),
new ExtensionInfoInternalController(),
new SwaggerController(),
new SwaggerDefinitionController()
));
if (!NamedSettingsRegistry.INSTANCE.getAll().isEmpty()) {
controllerClasses.add(NamedSettingsRegistry.INSTANCE.isScopeAgnostic() ? NamedSettingsApiScopeAgnosticController.class : NamedSettingsApiController.class);
controllerClasses.add(NamedSettingsInternalController.class);
controllerSingletons.add(NamedSettingsRegistry.INSTANCE.isScopeAgnostic() ? new NamedSettingsApiScopeAgnosticController() : new NamedSettingsApiController());
controllerSingletons.add(new NamedSettingsInternalController());
}
return controllerClasses;
return controllerSingletons;
}
}
Loading