Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HttpErrorResponse {headers: HttpHeaders, status: 405, statusText: "OK", url: "http://localhost:8080/api/delete/1", ok: false, …}
- //Rest Controller
- @PutMapping(path = "edit/{id}", produces = MediaType.APPLICATION_JSON_VALUE,
- consumes = MediaType.APPLICATION_JSON_VALUE)
- public void editRecipient(@PathVariable("id") Long id,
- @RequestBody RecipientEntity recipient){
- service.updateRecipient(id, recipient);
- }
- @DeleteMapping(path = "delete/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
- public void deleteRecipient(@PathVariable("id") Long id) throws NotFoundException {
- service.deleteRecipient(id);
- }
- @Configuration
- public class WebConfig {
- @Bean
- public FilterRegistrationBean corsFilter() {
- UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
- CorsConfiguration config = new CorsConfiguration();
- config.setAllowCredentials(true);
- config.addAllowedOrigin("*");
- config.addAllowedHeader("*");
- config.addAllowedMethod("*");
- source.registerCorsConfiguration("/**", config);
- FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
- bean.setOrder(0);
- return bean;
- }
Add Comment
Please, Sign In to add comment