Package com.sun.jersey.api.core

Examples of com.sun.jersey.api.core.ResourceConfig


            if (packages != null) {
                props.put(PackagesResourceConfig.PROPERTY_PACKAGES, packages);
                return new PackagesResourceConfig(props);
            }

            ResourceConfig defaultConfig = webConfig.getDefaultResourceConfig(props);
            if (defaultConfig != null)
                return defaultConfig;

            return getDefaultResourceConfig(props, webConfig);
        }
View Full Code Here


  public static final URI BASE_URI = getBaseURI();

  protected static HttpServer startServer() throws IOException {
    System.out.println("Starting grizzly...");
    ResourceConfig rc = new PackagesResourceConfig("restful.insecurity.resources");
    HashMap<String, Object> config = new HashMap<String, Object>();
    config.put(FeaturesAndProperties.FEATURE_DISABLE_XML_SECURITY, Boolean.TRUE);
    config.put(FeaturesAndProperties.FEATURE_FORMATTED, Boolean.TRUE);
    rc.setPropertiesAndFeatures(config);
   
    return GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
  }
View Full Code Here

            protected void configureServlets() {

                super.configureServlets();

                // Configuring Jersey via Guice:
                ResourceConfig resourceConfig = new PackagesResourceConfig("ngdemo/web");
                for (Class<?> resource : resourceConfig.getClasses()) {
                    bind(resource);
                }

                // hook Jackson into Jersey as the POJO <-> JSON mapper
                bind(JacksonJsonProvider.class).in(Scopes.SINGLETON);
View Full Code Here

                // hook Jackson into Jersey as the POJO <-> JSON mapper
                bind(JacksonJsonProvider.class).in(Scopes.SINGLETON);
            }
        });

        ResourceConfig rc = new PackagesResourceConfig("ngdemo.web");
        IoCComponentProviderFactory ioc = new GuiceComponentProviderFactory(rc, injector);
        server = GrizzlyServerFactory.createHttpServer(BASE_URI + "web/", rc, ioc);

        System.out.println(String.format("Jersey app started with WADL available at "
                + "%srest/application.wadl\nTry out %sngdemo\nHit enter to stop it...",
View Full Code Here

import java.io.IOException;
import java.util.HashSet;

public class TestApplication {
    public static void main(String[] args) throws IOException {
        ResourceConfig resourceConfig = resourceConfig();

        Closeable server = SimpleServerFactory.create("http://0.0.0.0:8080", resourceConfig);
        while (true) {
            try {
                Thread.sleep(1000);
View Full Code Here

            }
        }
    }

    public static ResourceConfig resourceConfig() {
        ResourceConfig resourceConfig = new DefaultResourceConfig(
                new HashSet<Class<?>>() {{
                    add(TestResource.class);
                }}
        );

        resourceConfig.getSingletons().add(new RuntimeExceptionMapper());
        resourceConfig.getSingletons().add(new NotFoundExceptionMapper());
        resourceConfig.getProperties().put(FreemarkerViewProcessor.FREEMARKER_TEMPLATES_BASE_PATH, "/ftl");
        return resourceConfig;
    }
View Full Code Here

  public static void main(String[] args) throws IOException {
    Map<String, String> mapArgs = parseArgs(args);
    System.out.println("Starting Ambari API server using the following properties: " + mapArgs);
    System.setProperty("ambariapi.dbfile", mapArgs.get("db"));

    ResourceConfig config = new PackagesResourceConfig("org.apache.ambari.server.api.services");
    System.out.println("Starting server: http://localhost:" + mapArgs.get("port") + '/');
    HttpServer server = HttpServerFactory.create("http://localhost:" + mapArgs.get("port") + '/', config);
    server.start();

    System.out.println("SERVER RUNNING: http://localhost:" + mapArgs.get("port") + '/');
View Full Code Here

  private static final File userRepositoryFile = new File("user_repository.bin");

  public static void main(String[] args) throws IOException {
    // jersey must scan classpath for resources and providers
    ResourceConfig rc = new ClasspathResourceConfig();

    // instantiate singleton user repository for injection
    final UserRepository userRepository = thaw();
    Injector injector = createInjector(new AbstractModule() {
      protected void configure() {
View Full Code Here

    public static final URI BASE_URI = getBaseURI();

    protected static HttpServer startServer() throws IOException {
        System.out.println("Starting grizzly...");
        ResourceConfig rc = new PackagesResourceConfig("com.sun.jersey.samples.helloworld.resources");
        return GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
    }
View Full Code Here

    public static final URI BASE_URI = getBaseURI();

    protected static HttpServer startServer() throws IOException {

        ResourceConfig rc = new PackagesResourceConfig(PropertiesProvider.class.getPackage().getName());

        System.out.println("Starting grizzly...");
        return GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.core.ResourceConfig

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.