You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Mahdi Ansari (Jira)" <ji...@apache.org> on 2020/06/03 18:08:00 UTC
[jira] [Resolved] (OLINGO-1462) How can I add CORS Origin to
ODataJPAServiceFactory
[ https://issues.apache.org/jira/browse/OLINGO-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mahdi Ansari resolved OLINGO-1462.
----------------------------------
Resolution: Fixed
We just need to a {{CorsConfigurationUtil.java}} file inside the {{odata-boilerplate/src/main/java/com/penninkhof/odata/utils/}} folder.
package com.penninkhof.odata.utils; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; @Configuration public class CorsConfigurationUtil { @Bean public FilterRegistrationBean<CorsFilter> corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.addAllowedOrigin("*"); config.addAllowedHeader("*"); config.addAllowedMethod("*"); source.registerCorsConfiguration("/**", config); FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<CorsFilter>(new CorsFilter(source)); bean.setOrder(0); return bean; } }
> How can I add CORS Origin to ODataJPAServiceFactory
> ---------------------------------------------------
>
> Key: OLINGO-1462
> URL: https://issues.apache.org/jira/browse/OLINGO-1462
> Project: Olingo
> Issue Type: Question
> Components: odata2-jpa
> Affects Versions: V2 2.0.11
> Reporter: Mahdi Ansari
> Priority: Major
>
> I made an odata service with {{olingo2}}, {{jpa}} and {{spring-boot}} based on this [GitHub repository|https://github.com/jpenninkhof/odata-boilerplate].
>
> It uses ODataJPAServiceFactory for handelling the requests.
> The question is how can I add CORS Origin to this application?
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)