Package com.linkedin.restli.server

Examples of com.linkedin.restli.server.RestLiServer


    AsyncCallableTask.register(engineBuilder, executor);

    final Engine engine = engineBuilder.build();
    ResourceFactory resourceFactory = createResourceFactory(beans);

    TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config,
                                                                                        resourceFactory,
                                                                                        engine));

    final FilterChain fc = FilterChains.empty().addLast(new SimpleLoggingFilter());
    final HttpServer server = new HttpServerFactory(fc).createServer(port,
View Full Code Here


    beanProvider.add("albumEntryDb", new AlbumEntryDatabaseImpl(photoDb, 3));

    // using InjectMockResourceFactory to keep examples spring-free
    final ResourceFactory factory = new InjectMockResourceFactory(beanProvider);

    final TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory));
    return new HttpServerFactory(FilterChains.empty()).createServer(SERVER_PORT, dispatcher);
  }
View Full Code Here

  @Test
  public void testQueryParamValueEncoding()
  {
    RestLiConfig config = new RestLiConfig();
    config.setResourcePackageNames(QueryParamMockCollection.class.getPackage().getName());
    RestLiServer server = new RestLiServer(config, new PrototypeResourceFactory(), null);

    for (char c = 0; c < 256; ++c)
    {
      final String testValue = String.valueOf(c);
      GetRequest<QueryParamMockCollection.DummyRecord> req =
              new GetRequestBuilder<String, QueryParamMockCollection.DummyRecord>(
                      QueryParamMockCollection.RESOURCE_NAME,
                      QueryParamMockCollection.DummyRecord.class,
                      new ResourceSpecImpl(Collections.<ResourceMethod> emptySet(),
                                           Collections.<String, DynamicRecordMetadata> emptyMap(),
                                           Collections.<String, DynamicRecordMetadata> emptyMap(),
                                           String.class,
                                           null,
                                           null,
                                           QueryParamMockCollection.DummyRecord.class,
                                           Collections.<String, CompoundKey.TypeInfo> emptyMap()),
                      RestliRequestOptions.DEFAULT_OPTIONS)
                      .id("dummy")
                      .setParam(QueryParamMockCollection.VALUE_KEY, testValue).build();
      RestRequest restRequest = new RestRequestBuilder(RestliUriBuilderUtil.createUriBuilder(req).build())
              .setMethod(req.getMethod().getHttpMethod().toString()).build();

      // N.B. since QueryParamMockCollection is implemented using the synchronous rest.li interface,
      // RestLiServer.handleRequest() will invoke the application resource *and* the callback
      // *synchronously*, ensuring that the all instances of the callback are invoked before the
      // loop terminates.
      server.handleRequest(restRequest, new RequestContext(), new Callback<RestResponse>()
      {
        @Override
        public void onError(Throwable e)
        {
          Assert.fail();
View Full Code Here

                                  FilterChain filterChain)
  {
    _r2Servlet = new RAPServlet(
        new FilterChainDispatcher(
            new DelegatingTransportDispatcher(
                new RestLiServer(config, injectResourceFactory)),
            filterChain
        )
    );
  }
View Full Code Here

    SimpleBeanProvider beanProvider = new SimpleBeanProvider();
    beanProvider.add("GroupsRestApplication", app);
    //using InjectMockResourceFactory to keep examples spring-free
    ResourceFactory factory = new InjectMockResourceFactory(beanProvider);

    TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config, factory, engine));

    final FilterChain fc = FilterChains.empty().addLast(new ServerCompressionFilter(supportedCompression))
        .addLast(new SimpleLoggingFilter());
    return new HttpServerFactory(fc).createServer(port,
                                                  HttpServerFactory.DEFAULT_CONTEXT_PATH,
View Full Code Here

                            OptionalEngine engine)
  {
    _r2Servlet = new RAPServlet(
        new FilterChainDispatcher(
            new DelegatingTransportDispatcher(
                new RestLiServer(config, resourceFactory, engine.value)),
            filterChain.value
        )
    );
  }
View Full Code Here

            new InjectMockResourceFactory(new SimpleBeanProvider()
                                                  .add("counterBean", counter)
                                                  .add("mySpecialBean", new SpecialBean()));
    RestLiConfig config = new RestLiConfig();
    config.addResourcePackageNames("com.linkedin.restli.server.mock");
    RestLiServer server = new RestLiServer(config, factory);
    server.handleRequest(new MockRequest(), new RequestContext(), new Callback<RestResponse>()
    {
      @Override
      public void onError(Throwable e)
      {
        Assert.fail("expected success response");
View Full Code Here

TOP

Related Classes of com.linkedin.restli.server.RestLiServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.