Search in sources :

Example 1 with ExceptionMapperRegistryBuilder

use of io.crnk.core.engine.internal.exception.ExceptionMapperRegistryBuilder in project crnk-framework by crnk-project.

the class ModuleRegistry method init.

/**
 * Initializes the {@link ModuleRegistry} and applies all pending changes.
 * After the initialization completed, it is not possible to add any further
 * modules.
 *
 * @param objectMapper object mapper
 */
public void init(ObjectMapper objectMapper) {
    PreconditionUtil.assertEquals("already initialized", InitializedState.NOT_INITIALIZED, initializedState);
    this.initializedState = InitializedState.INITIALIZING;
    this.objectMapper = objectMapper;
    this.objectMapper.registerModules(getJacksonModules());
    initializeModules();
    applyRepositoryRegistrations();
    ExceptionMapperLookup exceptionMapperLookup = getExceptionMapperLookup();
    ExceptionMapperRegistryBuilder mapperRegistryBuilder = new ExceptionMapperRegistryBuilder();
    exceptionMapperRegistry = mapperRegistryBuilder.build(exceptionMapperLookup);
    filterBehaviorProvider = new ResourceFilterDirectoryImpl(aggregatedModule.getResourceFilters(), httpRequestContextProvider, resourceRegistry);
    this.initializedState = InitializedState.INITIALIZED;
}
Also used : ExceptionMapperLookup(io.crnk.core.engine.internal.exception.ExceptionMapperLookup) ResourceFilterDirectoryImpl(io.crnk.core.module.internal.ResourceFilterDirectoryImpl) ExceptionMapperRegistryBuilder(io.crnk.core.engine.internal.exception.ExceptionMapperRegistryBuilder)

Example 2 with ExceptionMapperRegistryBuilder

use of io.crnk.core.engine.internal.exception.ExceptionMapperRegistryBuilder in project crnk-framework by crnk-project.

the class CrnkClient method initExceptionMapperRegistry.

private void initExceptionMapperRegistry() {
    ExceptionMapperLookup exceptionMapperLookup = moduleRegistry.getExceptionMapperLookup();
    exceptionMapperRegistry = new ExceptionMapperRegistryBuilder().build(exceptionMapperLookup);
}
Also used : ExceptionMapperLookup(io.crnk.core.engine.internal.exception.ExceptionMapperLookup) ExceptionMapperRegistryBuilder(io.crnk.core.engine.internal.exception.ExceptionMapperRegistryBuilder)

Aggregations

ExceptionMapperLookup (io.crnk.core.engine.internal.exception.ExceptionMapperLookup)2 ExceptionMapperRegistryBuilder (io.crnk.core.engine.internal.exception.ExceptionMapperRegistryBuilder)2 ResourceFilterDirectoryImpl (io.crnk.core.module.internal.ResourceFilterDirectoryImpl)1