Refine search
@RestController @ExposesResourceFor(BarResource.class) @RequestMapping("/foos/{fooId}/bars") public class BarController { private final BarResourceAssembler assembler; public BarController(BarResourceAssembler assembler) { this.assembler = assembler; } @GetMapping("/{id}") public BarResource getBar(@PathVariable UUID fooId, @PathVariable UUID id) { return assembler.toResource(new Bar(id, "Bar", new Foo(fooId, "Root Foo"))); } }
public ControllerRelProvider(Class<?> controller, PluginRegistry<RelProvider, Class<?>> providers) { Assert.notNull(controller, "Controller must not be null!"); ExposesResourceFor annotation = AnnotationUtils.findAnnotation(controller, ExposesResourceFor.class); Assert.notNull(annotation, "Controller must be annotated with ExposesResourceFor!"); this.controllerType = controller; this.entityType = annotation.value(); this.providers = providers; }
@RequestMapping("/orders/{id}") @ExposesResourceFor(Payment.class) @RequiredArgsConstructor public class PaymentController {
@RestController @ExposesResourceFor(Likes.class) public class ApiController { @Autowired ProductRepository productRepository; @Autowired PersonRepository personRepository; @Autowired LikesRepository likesRepository; // This controller is constructed for this method only. Enables users to // create likes much easier. @RequestMapping(value = "/recommendations/{userName}/likes/{productId}", method = RequestMethod.POST) public ResponseEntity<Likes> createPersonProductLink(@PathVariable String userName, @PathVariable String productId) { Person person = personRepository.findByUserName(userName); Product product = productRepository.findByProductId(productId); Likes likes = new Likes(); likes.setPerson(person); likes.setProduct(product); likesRepository.save(likes); return new ResponseEntity<>(likes, HttpStatus.CREATED); } }
@RequestMapping("/batch/instances") @ExposesResourceFor(JobInstanceInfoResource.class) public class BatchJobInstancesController extends AbstractBatchJobsController {
@RestController @EnableConfigurationProperties(FeaturesProperties.class) @ExposesResourceFor(RootResource.class) public class RootController {
@RestController @ExposesResourceFor(BarResource.class) @RequestMapping("/foos/{fooId}/bars") public class BarController { private final BarResourceAssembler assembler; public BarController(BarResourceAssembler assembler) { this.assembler = assembler; } @GetMapping("/{id}") public BarResource getBar(@PathVariable UUID fooId, @PathVariable UUID id) { return assembler.toResource(new Bar(id, "Bar", new Foo(fooId, "Root Foo"))); } }
@RequestMapping("/batch/configurations") @ExposesResourceFor(DetailedJobInfoResource.class) public class BatchJobsController extends AbstractBatchJobsController {
@RestController @EnableConfigurationProperties(FeaturesProperties.class) @ExposesResourceFor(RootResource.class) public class RootController {
private void registerControllerClass(Class<?> controllerType) { Assert.notNull(controllerType, "Controller type must nor be null!"); ExposesResourceFor annotation = AnnotationUtils.findAnnotation(controllerType, ExposesResourceFor.class); if (annotation != null) { entityToController.put(annotation.value(), controllerType); } else { throw new IllegalArgumentException(String.format("Controller %s must be annotated with @ExposesResourceFor!", controllerType.getName())); } }
/** * @author Vinicius Carvalho */ @RestController @ExposesResourceFor(RootEndpoint.class) @RequestMapping("/") public class RootEndpoint { private final EntityLinks entityLinks; public RootEndpoint(EntityLinks entityLinks) { this.entityLinks = entityLinks; } @RequestMapping(method = RequestMethod.GET, produces = MediaTypes.HAL_JSON_VALUE) public RootResource info() { String streamTemplated = entityLinks.linkToCollectionResource(StreamMetrics.class).getHref() + "?{name}"; RootResource rootResource = new RootResource(); rootResource.add(new Link(streamTemplated).withRel("/collector/metrics/streams")); return rootResource; } }
@RequestMapping("/batch/files") @ExposesResourceFor(FileInfoResource.class) public class BatchFileController extends AbstractBatchJobsController {
public ControllerRelProvider(Class<?> controller, PluginRegistry<RelProvider, Class<?>> providers) { Assert.notNull(controller, "Controller must not be null!"); ExposesResourceFor annotation = AnnotationUtils.findAnnotation(controller, ExposesResourceFor.class); Assert.notNull(annotation, "Controller must be annotated with ExposesResourceFor!"); this.controllerType = controller; this.entityType = annotation.value(); this.providers = providers; }
@RestController @RequestMapping("/collector/metrics/streams") @ExposesResourceFor(StreamMetrics.class) public class MetricsCollectorEndpoint {
@RequestMapping("/batch/executions/{jobExecutionId}/steps") @ExposesResourceFor(StepExecutionInfoResource.class) public class BatchStepExecutionsController extends AbstractBatchJobsController {
private void registerControllerClass(Class<?> controllerType) { Assert.notNull(controllerType, "Controller type must nor be null!"); ExposesResourceFor annotation = AnnotationUtils.findAnnotation(controllerType, ExposesResourceFor.class); if (annotation != null) { entityToController.put(annotation.value(), controllerType); } else { throw new IllegalArgumentException(String.format("Controller %s must be annotated with @ExposesResourceFor!", controllerType.getName())); } }
@RestController @ExposesResourceFor(FooResource.class) @RequestMapping("/foos") public class FooController {
@ExposesResourceFor(Order.class) @RequestMapping("/orders") @Controller public class OrderController {
@RestController @ExposesResourceFor(FooResource.class) @RequestMapping("/foos") public class FooController {
@ExposesResourceFor(Order.class) @RequestMapping("/orders") @Controller public class OrderController {