Search in sources :

Example 1 with RestLiValidationFilter

use of com.linkedin.restli.server.validation.RestLiValidationFilter in project incubator-gobblin by apache.

the class EmbeddedRestliServer method startUp.

@Override
protected void startUp() throws Exception {
    RestLiConfig config = new RestLiConfig();
    Set<String> resourceClassNames = Sets.newHashSet();
    for (Class<? extends BaseResource> resClass : this.resources) {
        resourceClassNames.add(resClass.getName());
    }
    config.addResourceClassNames(resourceClassNames);
    config.setServerNodeUri(this.serverUri);
    config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
    config.addFilter(new RestLiValidationFilter());
    ResourceFactory factory = new GuiceInjectResourceFactory(this.injector);
    TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory));
    String acceptedFilters = EncodingType.SNAPPY.getHttpName() + "," + EncodingType.GZIP.getHttpName();
    FilterChain filterChain = FilterChains.createRestChain(new ServerCompressionFilter(acceptedFilters));
    this.httpServer = Optional.of(new HttpNettyServerFactory(filterChain).createServer(this.port, dispatcher));
    this.log.info("Starting the {} embedded server at port {}.", this.name, this.port);
    this.httpServer.get().start();
}
Also used : RestLiValidationFilter(com.linkedin.restli.server.validation.RestLiValidationFilter) RestLiServer(com.linkedin.restli.server.RestLiServer) DelegatingTransportDispatcher(com.linkedin.restli.server.DelegatingTransportDispatcher) HttpNettyServerFactory(com.linkedin.r2.transport.http.server.HttpNettyServerFactory) ServerCompressionFilter(com.linkedin.r2.filter.compression.ServerCompressionFilter) DefaultDocumentationRequestHandler(com.linkedin.restli.docgen.DefaultDocumentationRequestHandler) FilterChain(com.linkedin.r2.filter.FilterChain) GuiceInjectResourceFactory(com.linkedin.restli.server.guice.GuiceInjectResourceFactory) ResourceFactory(com.linkedin.restli.server.resources.ResourceFactory) DelegatingTransportDispatcher(com.linkedin.restli.server.DelegatingTransportDispatcher) TransportDispatcher(com.linkedin.r2.transport.common.bridge.server.TransportDispatcher) RestLiConfig(com.linkedin.restli.server.RestLiConfig) GuiceInjectResourceFactory(com.linkedin.restli.server.guice.GuiceInjectResourceFactory)

Example 2 with RestLiValidationFilter

use of com.linkedin.restli.server.validation.RestLiValidationFilter in project rest.li by linkedin.

the class TestParseqBasedFluentClientApiWithProjections method setUp.

@BeforeClass
void setUp() throws Exception {
    super.init(Arrays.asList(new RestLiValidationFilter()));
    _parSeqUnitTestHelper = new ParSeqUnitTestHelper();
    _parSeqUnitTestHelper.setUp();
    _parSeqRestliClient = new ParSeqRestliClientBuilder().setClient(getClient()).setConfig(new ParSeqRestliClientConfigBuilder().build()).build();
}
Also used : ParSeqUnitTestHelper(com.linkedin.parseq.ParSeqUnitTestHelper) ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) RestLiValidationFilter(com.linkedin.restli.server.validation.RestLiValidationFilter) ParSeqRestliClientBuilder(com.linkedin.restli.client.ParSeqRestliClientBuilder) BeforeClass(org.testng.annotations.BeforeClass)

Example 3 with RestLiValidationFilter

use of com.linkedin.restli.server.validation.RestLiValidationFilter in project rest.li by linkedin.

the class TestParSeqBasedFluentClientApiWithExecutionGroup method setUp.

@BeforeClass
void setUp() throws Exception {
    super.init(Arrays.asList(new RestLiValidationFilter()));
    ParSeqRestliClientConfig config = new ParSeqRestliClientConfigBuilder().addBatchingEnabled("*.*/*.*", Boolean.TRUE).addMaxBatchSize("*.*/*.*", TEST_BATCH_SIZE).build();
    BatchingSupport batchingSupport = new BatchingSupport();
    _parSeqUnitTestHelper = new ParSeqUnitTestHelper(engineBuilder -> {
        engineBuilder.setPlanDeactivationListener(batchingSupport);
    });
    _parSeqUnitTestHelper.setUp();
    _parSeqRestliClient = // RestClient Registered Strategy
    new ParSeqRestliClientBuilder().setBatchingSupport(batchingSupport).setClient(getClient()).setConfig(config).build();
}
Also used : ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) ParSeqUnitTestHelper(com.linkedin.parseq.ParSeqUnitTestHelper) AfterClass(org.testng.annotations.AfterClass) Arrays(java.util.Arrays) RestLiValidationFilter(com.linkedin.restli.server.validation.RestLiValidationFilter) BeforeClass(org.testng.annotations.BeforeClass) GreetingsFluentClient(com.linkedin.restli.examples.greetings.client.GreetingsFluentClient) TimeoutException(java.util.concurrent.TimeoutException) ExecutionGroup(com.linkedin.restli.client.ExecutionGroup) Test(org.testng.annotations.Test) Trace(com.linkedin.parseq.trace.Trace) ArrayList(java.util.ArrayList) ParSeqRestliClientConfig(com.linkedin.restli.client.ParSeqRestliClientConfig) TimeUnit(java.util.concurrent.TimeUnit) ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) ParSeqRestliClient(com.linkedin.restli.client.ParSeqRestliClient) Assert(org.testng.Assert) ParSeqRestliClientBuilder(com.linkedin.restli.client.ParSeqRestliClientBuilder) Greeting(com.linkedin.restli.examples.greetings.api.Greeting) ParSeqBasedCompletionStage(com.linkedin.restli.client.ParSeqBasedCompletionStage) ParSeqUnitTestHelper(com.linkedin.parseq.ParSeqUnitTestHelper) BatchingSupport(com.linkedin.parseq.batching.BatchingSupport) Task(com.linkedin.parseq.Task) ParSeqRestliClientConfig(com.linkedin.restli.client.ParSeqRestliClientConfig) RestLiValidationFilter(com.linkedin.restli.server.validation.RestLiValidationFilter) BatchingSupport(com.linkedin.parseq.batching.BatchingSupport) ParSeqRestliClientBuilder(com.linkedin.restli.client.ParSeqRestliClientBuilder) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

RestLiValidationFilter (com.linkedin.restli.server.validation.RestLiValidationFilter)3 ParSeqUnitTestHelper (com.linkedin.parseq.ParSeqUnitTestHelper)2 ParSeqRestliClientBuilder (com.linkedin.restli.client.ParSeqRestliClientBuilder)2 ParSeqRestliClientConfigBuilder (com.linkedin.restli.client.ParSeqRestliClientConfigBuilder)2 BeforeClass (org.testng.annotations.BeforeClass)2 Task (com.linkedin.parseq.Task)1 BatchingSupport (com.linkedin.parseq.batching.BatchingSupport)1 Trace (com.linkedin.parseq.trace.Trace)1 FilterChain (com.linkedin.r2.filter.FilterChain)1 ServerCompressionFilter (com.linkedin.r2.filter.compression.ServerCompressionFilter)1 TransportDispatcher (com.linkedin.r2.transport.common.bridge.server.TransportDispatcher)1 HttpNettyServerFactory (com.linkedin.r2.transport.http.server.HttpNettyServerFactory)1 ExecutionGroup (com.linkedin.restli.client.ExecutionGroup)1 ParSeqBasedCompletionStage (com.linkedin.restli.client.ParSeqBasedCompletionStage)1 ParSeqRestliClient (com.linkedin.restli.client.ParSeqRestliClient)1 ParSeqRestliClientConfig (com.linkedin.restli.client.ParSeqRestliClientConfig)1 DefaultDocumentationRequestHandler (com.linkedin.restli.docgen.DefaultDocumentationRequestHandler)1 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)1 GreetingsFluentClient (com.linkedin.restli.examples.greetings.client.GreetingsFluentClient)1 DelegatingTransportDispatcher (com.linkedin.restli.server.DelegatingTransportDispatcher)1