[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Jetty Cross Origin Filter
|
I've updated the Cross Origin Filter wiki page to include instructions
to put the jetty-servlets.jar into WEB-INF/lib:
http://wiki.eclipse.org/Jetty/Feature/Cross_Origin_Filter
You don't mention what version of jetty you are using?
Jan
On 29 November 2011 09:08, Ari King <ari.brandeis.king@xxxxxxxxx> wrote:
>> Does anyone know how to configure the Jetty-Maven plugin to use the
>> cross origin filter?
>>
>> I added the following to the application web.xml file, but when I
>> execute "mvn jetty:run" I get "java.lang.ClassNotFoundException:
>> org.eclipse.jetty.servlets.CrossOriginFilter"
>>
>> <web-app ...>
>> ...
>> <filter>
>> <filter-name>cross-origin</filter-name>
>> <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
>> </filter>
>> <filter-mapping>
>> <filter-name>cross-origin</filter-name>
>> <url-pattern>/*</url-pattern>
>> </filter-mapping>
>> ...
>> </web-app>
>
> To solve the "ClassNotFoundException" I needed to add
> jetty-servlets.jar to the classpath; originally, I assumed it was
> already on the classpath. While jetty now runs, I continue to be
> unable to do cross origin resource sharing (CORS); specifically, I get
> the error:
>
> "Origin http://localhost:8081 is not allowed by Access-Control-Allow-Origin."
>
> I've included my override descriptor below; does anyone know what
> could be wrong? Thanks.
>
> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> "http://java.sun.com/dtd/web-app_2_3.dtd" >
>
> <web-app>
> <filter>
> <filter-name>cross-origin</filter-name>
> <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
> <init-param>
> <param-name>allowedOrigins</param-name>
> <param-value>*</param-value>
> </init-param>
> <init-param>
> <param-name>allowedMethods</param-name>
> <param-value>*</param-value>
> </init-param>
> <init-param>
> <param-name>allowedHeaders</param-name>
> <param-value>*</param-value>
> </init-param>
> </filter>
> <filter-mapping>
> <filter-name>cross-origin</filter-name>
> <filter-pattern>/*</filter-pattern>
> </filter-mapping>
> </web-app>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>