On Thu, Sep 22, 2011 at 1:39 PM, Steve Lowery
<slow...@gatessolutions.com> wrote:
> Igor,
>
> Can you provide more info on the filter?  I'm struggling to see how adding a
> filter to my code will help since the js file is being requested on a
> different domain.  I tried the code below to inspect things, but I never got
> anything in there except GETs.

your filter has to send back a header telling the browser it is ok to
include the script resource from another domain via ajax. read up on
the OPTIONS headers rfc. i dont remember the exact details.

> Also, is this something you think might be worthwhile putting into wicket
> itself?

dont know. it is not often people load things from an external CDN
using ajax. maybe once you write it you can contribute it.

> I can see users wanting to include scripts from Google's CDN or
> other providers without having to provide some sort of hack.

because they are doing it using a normal request, not from inside ajax.

-igor


>
> public class OptionsFilter implements Filter {
>
> @Override
> public void destroy() {
> }
>
> @Override
> public void doFilter(ServletRequest req, ServletResponse res, FilterChain
> chain) throws IOException, ServletException {
> HttpServletRequest request = (HttpServletRequest) req;
>
> System.err.println(request.getMethod() + ": " + request.getRequestURL());
>
> if (request.getMethod().equals("OPTIONS")) {
> Enumeration headerNames = request.getHeaderNames();
> while (headerNames.hasMoreElements()) {
> System.err.println(headerNames.nextElement());
> }
> } else {
> chain.doFilter(req, res);
> }
> }
>
> @Override
> public void init(FilterConfig arg0) throws ServletException {
> }
>
> }
>
> On Thu, Sep 22, 2011 at 3:18 PM, Steve Lowery 
> <slow...@gatessolutions.com>wrote:
>
>> Is that a filter on my end?  Would that go before or after my wicket filter
>> mapping?  Any helpful resources out there on this?  I haven't dealt with
>> OPTIONS methods before.
>>
>>
>> On Thu, Sep 22, 2011 at 2:28 PM, Steve Lowery 
>> <slow...@gatessolutions.com>wrote:
>>
>>> I'm having an issue using resources after an ajax swap, in this case
>>> jquery.  My home page does not have anything jquery related on it.  There is
>>> an AjaxFallbackLink which swaps out the main content.  The new content Panel
>>> has a jquery header contributor.  I see this is being returned in the
>>> response to the AjaxFallbackLink click:
>>>
>>> <ajax-response><header-contribution encoding="wicket1" ><![CDATA[<head
>>> xmlns:wicket="http://wicket.apache.org";><script type="text/javascript"
>>> src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js";>
>>> </script>...
>>> </ajax-response>
>>>
>>> However, I notice that the browser is attempting to retrieve the jquery
>>> resource via the OPTIONS method.  It does not appear to be getting added to
>>> the head and therefore, my component fails because it tries to do some
>>> jQuery stuff but it isn't available.
>>>
>>> Is this the expected behavior or am I doing something wrong?  Do I have to
>>> load 3rd party libraries on the Page or register headerListener with the
>>> application?  I have seen the same behavior with other javascript libraries
>>> (i.e. yui).
>>>
>>>
>>>
>>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to