use of com.linkedin.restli.internal.server.response.ErrorResponseBuilder in project rest.li by linkedin.
the class TestCustomMethodAdapterProvider method initClass.
@BeforeClass
public void initClass() throws Exception {
RestLiConfig config = new RestLiConfig();
config.setMethodAdapterProvider(new DefaultMethodAdapterProvider(new ErrorResponseBuilder(ErrorResponseFormat.MESSAGE_AND_SERVICECODE)) {
@Override
public RestLiArgumentBuilder getArgumentBuilder(ResourceMethod resourceMethod) {
// Override the behavior of the CREATE argument builder
if (resourceMethod == ResourceMethod.CREATE) {
return new CreateArgumentBuilder() {
@Override
public RestLiRequestData extractRequestData(RoutingResult routingResult, DataMap dataMap) {
// Always use the FRIENDLY record regardless of the actual data
return new RestLiRequestDataImpl.Builder().entity(FRIENDLY).build();
}
};
} else {
return super.getArgumentBuilder(resourceMethod);
}
}
});
super.init(false, config);
}
use of com.linkedin.restli.internal.server.response.ErrorResponseBuilder in project rest.li by linkedin.
the class TestRestLiMethodInvocation method setUp.
@BeforeTest
protected void setUp() {
_scheduler = Executors.newSingleThreadScheduledExecutor();
_engine = new EngineBuilder().setTaskExecutor(_scheduler).setTimerScheduler(_scheduler).build();
_resourceFactory = new EasyMockResourceFactory();
_errorResponseBuilder = new ErrorResponseBuilder();
_methodAdapterProvider = new DefaultMethodAdapterProvider(_errorResponseBuilder);
// Add filters to the invoker.
_invoker = new RestLiMethodInvoker(_resourceFactory, _engine, ErrorResponseBuilder.DEFAULT_INTERNAL_ERROR_MESSAGE);
}
use of com.linkedin.restli.internal.server.response.ErrorResponseBuilder in project rest.li by linkedin.
the class TestMultiplexedRequestHandlerImpl method createMultiplexer.
private static MultiplexedRequestHandlerImpl createMultiplexer(RestRequestHandler requestHandler, MultiplexerSingletonFilter multiplexerSingletonFilter, Set<String> individualRequestHeaderWhitelist, int maxRequestCount, MultiplexerRunMode multiplexerRunMode) {
ExecutorService taskScheduler = Executors.newFixedThreadPool(1);
ScheduledExecutorService timerScheduler = Executors.newSingleThreadScheduledExecutor();
Engine engine = new EngineBuilder().setTaskExecutor(taskScheduler).setTimerScheduler(timerScheduler).build();
return new MultiplexedRequestHandlerImpl(requestHandler, engine, maxRequestCount, individualRequestHeaderWhitelist, multiplexerSingletonFilter, multiplexerRunMode, new ErrorResponseBuilder());
}
Aggregations