/** * Exposes {@link ResourceConfig#registerResources(Resource...)}. * * @param resources resources to register * @return an updated instance */ public Builder registerResources(Resource... resources) { resourceConfig.registerResources(resources); return this; }
/** * Register new programmatic resource models in the {@code ResourceConfig}. * * @param resources resource models to register. * @return updated resource configuration instance. */ public final ResourceConfig registerResources(final Resource... resources) { if (resources == null) { return this; } return registerResources(Arrays.stream(resources).collect(Collectors.toSet())); }
/** * Register new programmatic resource models in the {@code ResourceConfig}. * * @param resources resource models to register. * @return updated resource configuration instance. */ public final ResourceConfig registerResources(final Resource... resources) { if (resources == null) { return this; } return registerResources(Arrays.stream(resources).collect(Collectors.toSet())); }
.packages(true, controllerPackages) .packages(true, RESOURCE_PACKAGE_WEB) .registerResources(additionalResources);
/** * Create example application resource configuration. * * @return initialized resource configuration of the example application. */ public static ResourceConfig create() { final ResourceConfig resourceConfig = new ResourceConfig(JaxrsInjectionReportingResource.class); final Resource.Builder resourceBuilder = Resource.builder(ROOT_PATH_PROGRAMMATIC); resourceBuilder.addMethod("GET").handledBy(JaxrsInjectionReportingInflector.class); return resourceConfig.registerResources(resourceBuilder.build()); } }
/** * Create example application resource configuration. * * @return initialized resource configuration of the example application. */ public static ResourceConfig create() { final ResourceConfig resourceConfig = new ResourceConfig(TracingResource.class); final Resource.Builder resourceBuilder = Resource.builder(ROOT_PATH_PROGRAMMATIC); resourceBuilder.addMethod(TRACE.NAME).handledBy(new Inflector<ContainerRequestContext, Response>() { @Override public Response apply(ContainerRequestContext request) { if (request == null) { return Response.noContent().build(); } else { return Response.ok(Stringifier.stringify((ContainerRequest) request), MediaType.TEXT_PLAIN).build(); } } }); return resourceConfig.registerResources(resourceBuilder.build()); } }
resourceConfig.registerResources(resourceBuilder.build()); return resourceConfig;
resourceBuilder.addMethod("OPTIONS").handledBy(noContentResponder); return new ResourceConfig().registerResources(resourceBuilder.build());
/** * Merges fields (e.g. custom binders, properties) of the given application with this application. * <p> * The merging should be done because of the possibility of reloading this {@code ResourceConfig} in a container * so this resource config should know about custom binders and properties of the underlying application to ensure * the reload process will complete successfully. * </p> * * @param application the application which fields should be merged with this application. * @see org.glassfish.jersey.server.spi.Container#reload() * @see org.glassfish.jersey.server.spi.Container#reload(ResourceConfig) */ private void mergeApplications(final Application application) { if (application instanceof ResourceConfig) { // Merge custom binders. final ResourceConfig rc = (ResourceConfig) application; // Merge resources super.registerResources(rc.getResources()); // properties set on the wrapping resource config take precedence // (as those are retrieved from the web.xml, for example) rc.invalidateCache(); rc.addProperties(super.getProperties()); super.addProperties(rc.getProperties()); super.setApplicationName(rc.getApplicationName()); super.setClassLoader(rc.getClassLoader()); rc.lock(); } else if (application != null) { super.addProperties(application.getProperties()); } }
/** * Register new programmatic resource models in the {@code ResourceConfig}. * * @param resources resource models to register. * @return updated resource configuration instance. */ public final ResourceConfig registerResources(final Resource... resources) { if (resources == null) { return this; } return registerResources(Arrays.stream(resources).collect(Collectors.toSet())); }
/** * Merges fields (e.g. custom binders, properties) of the given application with this application. * <p> * The merging should be done because of the possibility of reloading this {@code ResourceConfig} in a container * so this resource config should know about custom binders and properties of the underlying application to ensure * the reload process will complete successfully. * </p> * * @param application the application which fields should be merged with this application. * @see org.glassfish.jersey.server.spi.Container#reload() * @see org.glassfish.jersey.server.spi.Container#reload(ResourceConfig) */ private void mergeApplications(final Application application) { if (application instanceof ResourceConfig) { // Merge custom binders. final ResourceConfig rc = (ResourceConfig) application; // Merge resources super.registerResources(rc.getResources()); // properties set on the wrapping resource config take precedence // (as those are retrieved from the web.xml, for example) rc.invalidateCache(); rc.addProperties(super.getProperties()); super.addProperties(rc.getProperties()); super.setApplicationName(rc.getApplicationName()); super.setClassLoader(rc.getClassLoader()); rc.lock(); } else if (application != null) { super.addProperties(application.getProperties()); } }
return new ResourceConfig().registerResources(resourceBuilder.build());
/** * Exposes {@link ResourceConfig#registerResources(Resource...)}. * * @param resources resources to register * @return an updated instance */ public Builder registerResources(Resource... resources) { resourceConfig.registerResources(resources); return this; }
/** * <p>registerResources.</p> * * @param resources a {@link java.util.Set} object. * @return a {@link ameba.core.Application} object. */ public Application registerResources(Set<Resource> resources) { config.registerResources(resources); return this; }
/** * <p>registerResources.</p> * * @param resources a {@link org.glassfish.jersey.server.model.Resource} object. * @return a {@link ameba.core.Application} object. */ public Application registerResources(Resource... resources) { config.registerResources(resources); return this; }
/** * Register new programmatic resource models in the {@code ResourceConfig}. * * @param resources resource models to register. * @return updated resource configuration instance. */ public final ResourceConfig registerResources(final Resource... resources) { if (resources == null) { return this; } return registerResources(Arrays.stream(resources).collect(Collectors.toSet())); }
/** * Merges fields (e.g. custom binders, properties) of the given application with this application. * <p> * The merging should be done because of the possibility of reloading this {@code ResourceConfig} in a container * so this resource config should know about custom binders and properties of the underlying application to ensure * the reload process will complete successfully. * </p> * * @param application the application which fields should be merged with this application. * @see org.glassfish.jersey.server.spi.Container#reload() * @see org.glassfish.jersey.server.spi.Container#reload(ResourceConfig) */ private void mergeApplications(final Application application) { if (application instanceof ResourceConfig) { // Merge custom binders. final ResourceConfig rc = (ResourceConfig) application; // Merge resources super.registerResources(rc.getResources()); // properties set on the wrapping resource config take precedence // (as those are retrieved from the web.xml, for example) rc.invalidateCache(); rc.addProperties(super.getProperties()); super.addProperties(rc.getProperties()); super.setApplicationName(rc.getApplicationName()); super.setClassLoader(rc.getClassLoader()); rc.lock(); } else if (application != null) { super.addProperties(application.getProperties()); } }
/** * Register new programmatic resource models in the {@code ResourceConfig}. * * @param resources resource models to register. * @return updated resource configuration instance. */ public final ResourceConfig registerResources(final Resource... resources) { if (resources == null) { return this; } return registerResources(Sets.newHashSet(resources)); }
/** * Register new programmatic resource models in the {@code ResourceConfig}. * * @param resources resource models to register. * @return updated resource configuration instance. */ public final ResourceConfig registerResources(final Resource... resources) { if (resources == null) { return this; } return registerResources(Sets.newHashSet(resources)); }
/** * Register new programmatic resource models in the {@code ResourceConfig}. * * @param resources resource models to register. * @return updated resource configuration instance. */ public final ResourceConfig registerResources(final Resource... resources) { if (resources == null) { return this; } return registerResources(Sets.newHashSet(resources)); }