Package com.sun.jersey.api.core

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


    private ApplicationDescription createApplication(String[] paths) {
        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
        final ClassLoader ncl = new Loader(classpath.list(), this.getClass().getClassLoader());
        Thread.currentThread().setContextClassLoader(ncl);
        try {
            ResourceConfig rc = new ClasspathResourceConfig(classpath.list());
            rc.validate();
            Set<AbstractResource> s = new HashSet<AbstractResource>();
            for (Class c : rc.getRootResourceClasses()) {
                s.add(IntrospectionModeller.createResource(c));
            }
           
            return new WadlBuilder().generate(null, s);
        } catch(Exception e) {
View Full Code Here


     * @return the HTTP handler, if a handler could not be created then null is
     * returned.
     * @throws IllegalArgumentException if no container provider supports the type.
     */
    public static <A> A createContainer(Class<A> type, String... paths) {
        ClasspathResourceConfig config = new ClasspathResourceConfig(paths);
        return createContainer(type, config, null);
    }
View Full Code Here

            // TODO add support for WebAppResourceConfig
            if (resourceConfigClass == ClasspathResourceConfig.class) {
                String[] paths = getPaths(webConfig.getInitParameter(
                        ClasspathResourceConfig.PROPERTY_CLASSPATH));
                props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
                return new ClasspathResourceConfig(props);
            } else if (ResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
                try {
                    Constructor constructor = resourceConfigClass.getConstructor(Map.class);
                    if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
                        String[] paths = getPaths(webConfig.getInitParameter(
View Full Code Here

            ClassNamesResourceConfig classNamesResourceConfig = new ClassNamesResourceConfig(classes);
            populateResourceConfigFeatures(classNamesResourceConfig, wad.getInitParams());
            return new LowLevelAppDescriptor.Builder(classNamesResourceConfig).build();
        } else if (wad.getInitParams().get(ClasspathResourceConfig.PROPERTY_CLASSPATH) != null) {
            String classpath = wad.getInitParams().get(ClasspathResourceConfig.PROPERTY_CLASSPATH);
            ClasspathResourceConfig classpathResourceConfig = new ClasspathResourceConfig(classpath.split(";"));
            populateResourceConfigFeatures(classpathResourceConfig, wad.getInitParams());
            return new LowLevelAppDescriptor.Builder(classpathResourceConfig).build();
        }
        return null;
    }
View Full Code Here

            userRepository = null;
          }

          public void start() {
            try {
              ResourceConfig rc = new ClasspathResourceConfig();
              userRepository = new UserRepository();
              Injector injector = createInjector(new AbstractModule() {
                protected void configure() {
                  bind(UserRepository.class).toInstance(userRepository);
                }
View Full Code Here

  @Override
  protected AppDescriptor configure() {
    ClientConfig cc = new DefaultClientConfig();
    cc.getClasses().add(JacksonJsonProvider.class);
    return new LowLevelAppDescriptor.Builder(new ClasspathResourceConfig()).clientConfig(cc).build();
  }
View Full Code Here

            // TODO add support for WebAppResourceConfig
            if (resourceConfigClass == ClasspathResourceConfig.class) {
                String[] paths = getPaths(webConfig.getInitParameter(
                        ClasspathResourceConfig.PROPERTY_CLASSPATH));
                props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
                return new ClasspathResourceConfig(props);
            } else if (ResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
                try {
                    Constructor constructor = resourceConfigClass.getConstructor(Map.class);
                    if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
                        String[] paths = getPaths(webConfig.getInitParameter(
View Full Code Here

            // TODO add support for WebAppResourceConfig
            if (resourceConfigClass == ClasspathResourceConfig.class) {
                String[] paths = getPaths(webConfig.getInitParameter(
                        ClasspathResourceConfig.PROPERTY_CLASSPATH));
                props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
                return new ClasspathResourceConfig(props);
            } else if (ResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
                try {
                    Constructor constructor = resourceConfigClass.getConstructor(Map.class);
                    if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
                        String[] paths = getPaths(webConfig.getInitParameter(
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

            WebConfig webConfig) throws ServletException  {
        // Default to using class path resource config
        String[] paths = getPaths(webConfig.getInitParameter(
                ClasspathResourceConfig.PROPERTY_CLASSPATH));
        props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
        return new ClasspathResourceConfig(props);
    }
View Full Code Here

TOP

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

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.