Closed semanticfire closed 7 years ago
Hello @semanticfire , thanks for reporting the issue.
I just submitted a quick fix that might solve your problem. Try the latest version and let me know if the fix works for you.
Tried CORS with the new build, but CORS seems not to work. It still gives the CORS-header ‘Access-Control-Allow-Origin’ is missing error.
Hey @nicky508 CORS is actually handled outside of the application and can be configured directly in the Jetty web.xml file, which can be located at: jsp/xml/web.xml
Have you tried with the following parameters?
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping>
I think the easiest solution is to add a CORS header in the actual WFS servlet: https://github.com/jimjonesbr/lod4wfs/blob/master/lod4wfs/src/main/java/de/ifgi/lod4wfs/web/ServletWFS.java#L38
Hi @jimjonesbr,
Nope, it does not work. Adding the filter-mapping to the web.xml causes a InvocationTargetException:
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
I'm afraid I'm forgetting to submit some important change. In my computer (as always in developers computers) this error does not pop up.
I added the following lines to the servlet:
response.addHeader("Access-Control-Allow-Origin","*"); response.addHeader("Access-Control-Allow-Methods","GET,POST"); response.addHeader("Access-Control-Allow-Headers","Origin, X-Requested-With, Content-Type, Accept");
Nice! pulled, build and it works. Nice, thanks again for the fast fix again :+1:
Awesome!
Set to closed.
Currently the WFS service has no CORS support, this can only be achieved by putting a proxy in front of LOD4WFS.
I understand that a proxy is good thing anyway, but you don't want to mess with headers manually