I think the issue here it that the request is being denied by the server as the media type specified in the Accept Header is not supported by the route. To fix this one would have to specify that the route in question produces json:<div>
<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;color:rgb(0,0,0)">
<span class="">route</span><span class="" style="font-weight:bold">()</span>
        <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">from</span><span class="" style="font-weight:bold">(</span><span class="" style="color:rgb(221,17,68)">&quot;/cars&quot;</span><span class="" style="font-weight:bold">)</span>
        <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">on</span><span class="" style="font-weight:bold">(</span><span class="">RequestMethod</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">GET</span><span class="" style="font-weight:bold">)</span>
        <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">produces</span><span class="" style="font-weight:bold">(</span><span class="">MediaType</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">JSON</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">toString</span><span class="" style="font-weight:bold">())</span>
        <span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">to</span><span class="" style="font-weight:bold">(</span><span class="">Home</span><span class="" style="font-weight:bold">.</span><span class="" style="color:rgb(0,128,128)">class</span><span class="" style="font-weight:bold">).</span><span class="" style="color:rgb(0,128,128)">anotherPage</span><span class="" style="font-weight:bold">();</span></pre>
</div><div class="gmail_extra">We have overloaded the producers method to also take only the enum MediaType, but this has not made it upstream yet. I know this looks a little ugly :(</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">If you try this and updated scripts/cors.js and change the endpoint to &quot;cars&quot; this should return:</div><div class="gmail_extra"><span style="color:rgb(0,0,0);font-family:Menlo,monospace;font-size:11px;white-space:pre-wrap"><span class="" style="display:inline-block;vertical-align:top"><span class="" style="font-style:italic">Object {<span class="" style="color:rgb(136,19,145)">color</span>: <span class="" style="color:rgb(196,26,22);white-space:pre">&quot;silver&quot;</span>, <span class="" style="color:rgb(136,19,145)">brand</span>: <span class="" style="color:rgb(196,26,22);white-space:pre">&quot;delorean&quot;</span>}</span></span></span><span style="color:rgb(0,0,0);font-family:Menlo,monospace;font-size:11px;white-space:pre-wrap"> </span></div>
<div class="gmail_extra"><span style="color:rgb(0,0,0);font-family:Menlo,monospace;font-size:11px;white-space:pre-wrap"><br></span></div><div class="gmail_extra"><span style="color:rgb(0,0,0);font-family:Menlo,monospace;font-size:11px;white-space:pre-wrap"><br>
</span></div><div class="gmail_extra"><span style="color:rgb(0,0,0);font-family:Menlo,monospace;font-size:11px;white-space:pre-wrap"><br></span></div><div class="gmail_extra"><div class="gmail_quote">On 12 December 2012 15:50, Lucas Holmquist <span dir="ltr">&lt;<a href="mailto:lholmqui@redhat.com" target="_blank">lholmqui@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Thanks dan,</div><br>
<div><div class="im"><div>On Dec 12, 2012, at 9:47 AM, Daniel Bevenius &lt;<a href="mailto:daniel.bevenius@gmail.com" target="_blank">daniel.bevenius@gmail.com</a>&gt; wrote:</div><br><blockquote type="cite"><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-top:0px!important">
To specify request header that are valid you can use the <code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px 2px;padding:0px 5px;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">validRequestHeaders</code> method:</p>

<div style="border:none;padding:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px"><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<span style="font-weight:bold">return</span> <span>CorsConfig</span><span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">enableCorsSupport</span><span style="font-weight:bold">()</span>
                <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">anyOrigin</span><span style="font-weight:bold">()</span>
                <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">enableCookies</span><span style="font-weight:bold">()</span>
                <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">maxAge</span><span style="font-weight:bold">(</span><span style="color:rgb(0,153,153)">20</span><span style="font-weight:bold">)</span>
                <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">enableAllRequestMethods</span><span style="font-weight:bold">()</span>
                <span style="font-weight:bold">.</span><span style="color:rgb(0,128,128)">validRequestHeaders</span><span style="font-weight:bold">(</span><span style="color:rgb(221,17,68)">&quot;header1, header2&quot;</span><span style="font-weight:bold">);</span></pre>
</div></blockquote><blockquote type="cite"><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Is this how you modified you local aerogear-controller-demo?</p><p style="margin-top:15px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important">

</p></blockquote></div><div>i actually did this in the CorsConfig class.  Should have know it was easier than that</div><div><br></div><div>     public CorsConfiguration build() {</div><div>            validRequestHeaders.add(&quot;origin&quot;);</div>
<div>            validRequestHeaders.add(&quot;accept&quot;);</div><div>            validRequestHeaders.add(&quot;content-type&quot;);</div><div>            if (validRequestMethods.isEmpty()) {</div><div>                enableAllRequestMethods();</div>
<div>            }</div><div>            return new CorsConfig(this);</div><div class="im"><div>        }</div><div><br></div><br><blockquote type="cite"><p style="margin-top:15px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important">
I&#39;m not sure exaclty what is going on just by looking at the request and the response. Let me try this out and see if I can figure it out.</p><div><p><span><br></span></p></div></blockquote><div><br></div></div><div>cool,  i just used python -m SimpleHTTPServer to run the html/js stuff</div>
<div><div class="h5"><br><blockquote type="cite"><div class="gmail_extra">
<br><br><div class="gmail_quote">On 12 December 2012 15:26, Lucas Holmquist <span dir="ltr">&lt;<a href="mailto:lholmqui@redhat.com" target="_blank">lholmqui@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div style="word-wrap:break-word"><h3 style="margin:0px 0px 10px;padding:0px;font-size:18px;font-family:Helvetica,arial,freesans,clean,sans-serif">CORS with Aerogear.js and AG-Controller</h3><p style="margin:0px 0px 15px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">

from this gist:<a href="https://gist.github.com/4268092" target="_blank">https://gist.github.com/4268092</a></p><p style="margin:0px 0px 15px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">

2 things.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">So when using aerogear.js to make a cross domain call,</p><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">var pipeline = AeroGear.Pipeline();
        cors = pipeline.add( {
            name: &quot;cors&quot;,
            settings: {
                baseURL: &quot;<a href="http://localhost:8080/aerogear-controller-demo/" target="_blank">http://localhost:8080/aerogear-controller-demo/</a>&quot;,
                endpoint: &quot;login/&quot;
            }
        });

        pipeline.pipes.cors.read({
            success: function( data, xhr, thing1 ) {
                console.log( data );
            },
            error: function( error ) {
                console.log( error );
            }
        });
</code></pre><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">the initial OPTIONS request looks similar to this. Request URL:<a href="http://localhost:8080/aerogear-controller-demo/login/" target="_blank">http://localhost:8080/aerogear-controller-demo/login/</a></p>

<pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:origin, content-type, accept
Access-Control-Request-Method:GET
Cache-Control:max-age=0
Connection:keep-alive
Host:localhost:8080
Origin:<a href="http://localhost:8000/" target="_blank">http://localhost:8000</a>
Pragma:no-cache
Referer:<a href="http://localhost:8000/app/cors.html" target="_blank">http://localhost:8000/app/cors.html</a>
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11
</code></pre><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">I just copy and pasted this from chrome dev tools.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">

Here is what the CORS config looks like in the controller demo, for those who don&#39;t want to go look it up</p><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">@Produces
public CorsConfiguration demoConfig() {
    return CorsConfig.enableCorsSupport()
            .anyOrigin()
            .enableCookies()
            .maxAge(20)
            .enableAllRequestMethods()
            .build();
}
</code></pre><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">So the above request will fail since it has more headers than just &quot;origin&quot;. This brings me to my first question:</p>
<p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">How do i specify more headers in this config object?, i guess in this case it would be origin, content-type, and accept</p>
<p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Now to the second part</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">

I modified my local aerogear-controller to add these other headers in by default, and then ran the above request again.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">

This time i get the same OPTIONS request but then i get a cross domain error with the follow up GET that the browser makes</p><pre style="font-size:13px;line-height:19px;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;word-wrap:break-word;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(204,204,204);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<code style="font-size:12px;line-height:normal;font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">Request URL:<a href="http://localhost:8080/aerogear-controller-demo/login/" target="_blank">http://localhost:8080/aerogear-controller-demo/login/</a>

Request Headersview source
Accept:application/json, text/javascript, */*; q=0.01
Cache-Control:no-cache
Content-Type:application/json
Origin:<a href="http://localhost:8000/" target="_blank">http://localhost:8000</a>
Pragma:no-cache
Referer:<a href="http://localhost:8000/app/cors.html" target="_blank">http://localhost:8000/app/cors.html</a>
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11
</code></pre><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">And i don&#39;t get any errors on the server log, so not really sure whats going on here</p><p style="margin-top:15px;margin-right:0px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px;margin-bottom:0px!important">

This is the repo i was using to play around with <a href="https://github.com/lholmquist/WoWAerogear" style="color:rgb(65,131,196);text-decoration:initial" target="_blank">https://github.com/lholmquist/WoWAerogear</a> checkout the cors.html and cors.js page</p>

<div><br></div><div><br></div><div>-Luke</div></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
</blockquote></div></div></div><br></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
<br></blockquote></div><br></div>