Package com.linkedin.restli.server

Examples of com.linkedin.restli.server.RestLiConfig


   * @param port the port the server will run on
   * @return
   */
  private static RestLiConfig createConfig(int port)
  {
    RestLiConfig restLiConfig = new RestLiConfig();
    restLiConfig.setServerNodeUri(URI.create(LOCALHOST + port));
    restLiConfig.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
    return restLiConfig;
  }
View Full Code Here


  public static HttpServer create(int port,
                                  Set<Class<?>> resourceClasses,
                                  Map<String, ?> beans,
                                  boolean enableAsync)
  {
    RestLiConfig config = createConfig(port);
    Set<String> resourceClassNames = new HashSet<String>();
    for (Class<?> clazz: resourceClasses)
    {
      resourceClassNames.add(clazz.getName());
    }
    config.setResourceClassNamesSet(resourceClassNames);
    return create(port, config, beans, enableAsync);
  }
View Full Code Here

  public static HttpServer create(int port,
                                  String[] resourcePackageNames,
                                  Map<String, Object> beans,
                                  boolean enableAsync)
  {
    RestLiConfig config = createConfig(port);
    config.addResourcePackageNames(resourcePackageNames);
    return create(port, config, beans, enableAsync);
  }
View Full Code Here

  public static HttpServer createServer()
  {
    // create Rest.li resource class information and initialize documentation generator
    // only the resource classes in the specified package names are visible for public
    final RestLiConfig config = new RestLiConfig();
    config.addResourcePackageNames("com.linkedin.restli.example.impl");
    config.setServerNodeUri(URI.create(getServerUrl()));
    config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
    // Create an instance of the Example Filter and add it to the config.
    RestLiExampleFilter filter = new RestLiExampleFilter();
    config.addRequestFilter(filter);
    config.addResponseFilter(filter);

    // demonstrate dynamic dependency injection
    final PhotoDatabase photoDb = new PhotoDatabaseImpl(10);
    final SimpleBeanProvider beanProvider = new SimpleBeanProvider();
    beanProvider.add("photoDb", photoDb);
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);
View Full Code Here

                                String[] resourceClasses,
                                String outdir,
                                List<DocsProvider> additionalDocProviders)
      throws IOException
  {
    final RestLiConfig config = new RestLiConfig();
    if (resourcePackages != null)
    {
      config.addResourcePackageNames(resourcePackages);
    }

    final Map<String, String> classFileNames = new HashMap<String, String>();
    for (String path : sourcePaths)
    {
      classFileNames.putAll(FileClassNameScanner.scan(path));
    }

    Collection<String> sourceFileNames = null;
    if (resourceClasses != null || resourcePackages == null)
    {
      if (resourceClasses != null)
      {
        config.addResourceClassNames(resourceClasses);

        sourceFileNames = new ArrayList<String>(resourceClasses.length);
        for (String resourceClass : resourceClasses)
        {
          final String resourceFileName = classFileNames.get(resourceClass);
          if (resourceFileName == null)
          {
            log.warn("Unable to find source file for class " + resourceClass + " .  No documentation will be generated for it.");
          }
          else
          {
            sourceFileNames.add(resourceFileName);
          }
        }
      }
      else
      {
        config.addResourceClassNames(classFileNames.keySet());
        sourceFileNames = classFileNames.values();
      }
    }

    log.info("Executing Rest.li annotation processor...");
View Full Code Here

        new AbstractModule()
        {
          @Override
          protected void configure()
          {
            RestLiConfig restLiConfig = new RestLiConfig();
            restLiConfig.setResourcePackageNames("com.example.fortune");
            bind(RestLiConfig.class).toInstance(restLiConfig);

            FilterChain filterChain = FilterChains.create(
                new ServerCompressionFilter(new EncodingType[] { EncodingType.SNAPPY }),
                new SimpleLoggingFilter());
View Full Code Here

                                String[] resourceClasses,
                                String outdir,
                                List<DocsProvider> additionalDocProviders)
    throws IOException
  {
    final RestLiConfig config = new RestLiConfig();
    if (resourcePackages != null)
    {
      config.addResourcePackageNames(resourcePackages);
    }

    final Map<String, String> classFileNames = new HashMap<String, String>();
    for (String path : sourcePaths)
    {
      classFileNames.putAll(FileClassNameScanner.scan(path));
    }

    Collection<String> sourceFileNames = null;
    if (resourceClasses != null || resourcePackages == null)
    {
      if (resourceClasses != null)
      {
        config.addResourceClassNames(resourceClasses);

        sourceFileNames = new ArrayList<String>(resourceClasses.length);
        for (String resourceClass : resourceClasses)
        {
          final String resourceFileName = classFileNames.get(resourceClass);
          if (resourceFileName == null)
          {
            log.warn("Unable to find source file for class " + resourceClass + " .  No Javadoc will be generated for it.");
          }
          else
          {
            sourceFileNames.add(resourceFileName);
          }
        }
      }
      else
      {
        config.addResourceClassNames(classFileNames.keySet());
        sourceFileNames = classFileNames.values();
      }
    }

    log.info("Executing Rest.li annotation processor...");
View Full Code Here

*/
public class TestResourceSchemaCollection
{
  public TestResourceSchemaCollection()
  {
    final RestLiConfig config = new RestLiConfig();
    config.addResourcePackageNames("com.linkedin.restli.examples.groups.server.rest.impl",
                                   "com.linkedin.restli.examples.greetings.server",
                                   "com.linkedin.restli.examples.typeref.server");
    final Map<String, ResourceModel> rootResources = new RestLiApiBuilder(config).build();
    _schemas = ResourceSchemaCollection.loadOrCreateResourceSchema(rootResources);
  }
View Full Code Here

                                        boolean useAsyncServletApi,
                                        int asyncTimeOut,
                                        List<? extends RequestFilter> requestFilters,
                                        List<? extends ResponseFilter> responseFilters)
  {
    RestLiConfig config = new RestLiConfig();
    config.addResourcePackageNames(RESOURCE_PACKAGE_NAMES);
    config.setServerNodeUri(URI.create("http://localhost:" + port));
    config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler());
    config.addDebugRequestHandlers(new ParseqTraceDebugRequestHandler());
    config.setRequestFilters(requestFilters);
    config.setResponseFilters(responseFilters);

    GroupMembershipMgr membershipMgr = new HashGroupMembershipMgr();
    GroupMgr groupMgr = new HashMapGroupMgr(membershipMgr);
    GroupsRestApplication app = new GroupsRestApplication(groupMgr, membershipMgr);
    SimpleBeanProvider beanProvider = new SimpleBeanProvider();
View Full Code Here

TOP

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

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.