@Override public void setEmbeddedValueResolver(StringValueResolver resolver) { super.setEmbeddedValueResolver(resolver); this.corsConfigurationAccessor = new RepositoryCorsConfigurationAccessor(mappings, resolver == null ? NoOpStringValueResolver.INSTANCE : resolver, repositories); }
/** * Finally creates the {@link PersistentEntityResource} instance. * * @return */ public PersistentEntityResource build() { return new PersistentEntityResource(entity, content, links, embeddeds, false, false); }
/** * Configures the builder to embed the given {@link EmbeddedWrapper} instances. Creates a {@link Resources} instance * to make sure the {@link EmbeddedWrapper} handling gets applied to the serialization output ignoring the links. * * @param resources can be {@literal null}. * @return the builder */ public Builder withEmbedded(Iterable<EmbeddedWrapper> resources) { this.embeddeds = resources == null ? null : new NoLinksResources<EmbeddedWrapper>(resources); return this; }
/** * Verifies that the given {@link RootResourceInformation} has searches exposed. * * @param resourceInformation */ private static SearchResourceMappings verifySearchesExposed(RootResourceInformation resourceInformation) { SearchResourceMappings resourceMappings = resourceInformation.getSearchMappings(); if (!resourceMappings.isExported()) { throw new ResourceNotFoundException(); } return resourceMappings; }
private Builder wrap(Object instance, Object source) { PersistentEntity<?, ?> entity = entities.getRequiredPersistentEntity(source.getClass()); return PersistentEntityResource.build(instance, entity).// withEmbedded(getEmbeddedResources(source)).// withLink(getSelfLinkFor(source)).// withLink(linkProvider.createSelfLinkFor(source)); }
/** * Add a link to the {@link ProfileController}'s base URI to the app's root URI. * * @param resource * @return */ @Override public RepositoryLinksResource process(RepositoryLinksResource resource) { resource.add(new Link(ProfileController.getRootPath(this.configuration), PROFILE_REL)); return resource; } }
@Override public boolean supports(ResolvableType type, Object value) { if (!ResourceProcessorHandlerMethodReturnValueHandler.RESOURCE_TYPE.isAssignableFrom(type)) { return false; } return super.supports(type, value) && isValueTypeMatch((Resource<?>) value, getTargetType()); }
@Override public boolean supports(ResolvableType type, Object value) { if (!ResourceProcessorHandlerMethodReturnValueHandler.RESOURCES_TYPE.isAssignableFrom(type)) { return false; } return super.supports(type, value) && isValueTypeMatch((Resources<?>) value, getTargetType()); }
/** * Returns the embedded resources to render. This will add an {@link RelatedResource} for linkable associations if * they have an excerpt projection registered. * * @param instance must not be {@literal null}. * @return */ private Iterable<EmbeddedWrapper> getEmbeddedResources(Object instance) { return new EmbeddedResourcesAssembler(entities, associations, projector).getEmbeddedResources(instance); }
public RepositoryRestDispatcherServlet(WebApplicationContext webApplicationContext) { super(webApplicationContext); configure(); }
private static StatusAndHeaders modified(HttpHeaders headers) { return new StatusAndHeaders(headers, true); }
/** * Creates a new {@link Builder} to create {@link PersistentEntityResource}s eventually. * * @param content must not be {@literal null}. * @param entity must not be {@literal null}. * @return */ public static Builder build(Object content, PersistentEntity<?, ?> entity) { return new Builder(content, entity); }
@Override public int getOrder() { return CustomOrderAwareComparator.INSTANCE.getOrder(processor); }
private static ResponseEntity<ExceptionMessage> badRequest(HttpHeaders headers, Exception throwable) { return errorResponse(HttpStatus.BAD_REQUEST, headers, throwable); }
private static <T> ResponseEntity<T> response(HttpStatus status, HttpHeaders headers) { return response(status, headers, null); }
public static HttpRequestMethodNotSupportedException forRejectedMethod(HttpMethod method) { return new HttpRequestMethodNotSupportedException(method, new HttpMethod[0], null); }
/** * Finally creates the {@link PersistentEntityResource} instance to symbolize the contained entity is about to be * created. * * @return */ public PersistentEntityResource forCreation() { return new PersistentEntityResource(entity, content, links, embeddeds, true, false); }
public RepositoryRestDispatcherServlet() { configure(); }
private static StatusAndHeaders notModified(HttpHeaders headers) { return new StatusAndHeaders(headers, false); }
public PersistentEntityResource buildNested() { return new PersistentEntityResource(entity, content, links, embeddeds, false, true); } }