You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jan Stette <ja...@gmail.com> on 2007/11/05 16:30:06 UTC

gmap2 and permissions

I've just started playing with wicket-contrib-gmap2 but I'm having a bit of
a problem:

When I try to create a simple map inside my Wicket application, I get an
exception in Firefox saying:
  "uncaught exception: Permission denied to call method XMLHttpRequest.open"

I've had a look at issues surrounding security restrictions in Javascript
and I understand that Firefox will block XMLHttpRequests to hosts other than
where the page came from.  I've also seen a few workarounds such as running
proxies for the XML-HTTP requests.  Does gmap2 deal with these issues in any
way?  I suspect I'm missing something, as when I run the gmap2 examples in a
local Tomcat, everything works fine...

One additional question: after I get the above JavaScript exception, the
other AJAX controls on the same page seem to stop working as well - is this
something that Wicket ought to be handling better?  (I'm running
Wicket 1.3beta 4, with the head version of gmap2 built against this).

Regards,
Jan

Re: gmap2 and permissions

Posted by Jan Stette <ja...@gmail.com>.
Hi Martin,

adding the header contributions in the way suggested works fine for me, and
I think this is an acceptable workaround for now.

Many thanks for your quick response!

Regards,
Jan


On 06/11/2007, Martin Funk <fu...@arcor.de> wrote:
>
> Hi Jan,
>
> the good news is that I think we got a better understanding on this
> question, the bad news is we only can offer a workaround, not an elegant
> solution.
>
> The problem is that Firefox and obviously Konqueror too object to load
> external <header> <script> Elements within an XMLHttpRequest. If those
> elements are stated in the header of the 'original' html page its no
> problem.
> See:
>
> http://www.nabble.com/ajax-with-external-javascripts-tf4650719.html#a13287137
>
> http://www.nabble.com/Re%3A-contributing-to-header-%28was%3A-Must-renderHead-even-if-setVisible%28false%29%29-tf4193674.html#a11928113
> Actually I haven't checked if Firefox executes that XMLHttpRequest when
> it points to an 'already known' resource or if that request is filtered
> somewhere along the wicket toolchain.
>
> The second thread seems to talk about a solution on this on wicket side.
> Afaikt nothing has made its way into the code yet.
>
> Up till then I could offer the solution to add the needed scripting tags
> to html page beforehand. This can be done by adding a
> GMapHeaderContributor. Sven updated ManyPages source code for an example
> of that. The GMapHeaderContributor doesnt have to be added to the page,
> its sufficient to add it to the component that might get an GMap2 added
> later on.
> That's what I mean by workaround. I can't think of an mechanism that
> would add the HeaderContribution automatically. The developer has to
> decide explicitly.
>
> Have fun,
>
> Martin
>
> > Great, thanks!
> >
> > Jan
> >
> >
> > On 05/11/2007, Martin Funk <fu...@arcor.de> wrote:
> >
> >> Hi Jan,
> >>
> >> not sure if Sven or I can come up with something tonight,
> >> but it won't be forgotten.
> >>
> >> http://wicketstuff.org/jira/browse/WSGMAPP-3
> >>
> >> Martin
> >>
> >> Jan Stette schrieb:
> >>
> >>> Some more information after looking further into this - it looks like
> >>>
> >> I'm
> >>
> >>> seeing the same problem as mentioned in this thread:
> >>> http://www.nabble.com/Google-Maps-and-AJAX-tf4591408.html
> >>>
> >>> It only occurs when a Google Map is added via an AJAX request to a
> page
> >>>
> >> that
> >>
> >>> previously had no Google maps on it.
> >>>
> >>> It's easy to reproduce the same problem in the "Many" example in
> >>> wicket-contrib-gmap2-examples, by commenting out the call to
> addPanel()
> >>>
> >> at
> >>
> >>> the end of the ManyPage constructor, line 42 in ManyPage.java
> .  Normally
> >>> this example starts with a single Google map on the page and adds more
> >>>
> >> when
> >>
> >>> the user clicks an AjaxFallbackLink.  When this line is commented out,
> >>>
> >> the
> >>
> >>> page starts up with no maps on it, and will fail to add more when the
> >>>
> >> user
> >>
> >>> clicks the link.
> >>>
> >>> In Firefox, the error is an "uncaught exception: Permission denied to
> >>>
> >> call
> >>
> >>> method XMLHttpRequest.open", but this is only visible when I have the
> >>> Firebug debugger enabled.  The Ajax link stops working after this
> error
> >>> happens.
> >>>
> >>> In Konqueror, it shows up as a JavaScript error with code 304, and
> >>>
> >> renders
> >>
> >>> the rest of the page, but the maps aren't drawn, presumably because
> the
> >>> XmlHttpRequests are blocked here as well.  Subsequent Ajax requests
> work
> >>>
> >> OK
> >>
> >>> here though.
> >>>
> >>> Is this a bug in the gmap2 component that could be addressed?
> >>>
> >>> Regards,
> >>> Jan
> >>>
> >>>
> >>> On 05/11/2007, Jan Stette <ja...@gmail.com> wrote:
> >>>
> >>>
> >>>> I've just started playing with wicket-contrib-gmap2 but I'm having a
> >>>>
> >> bit
> >>
> >>>> of a problem:
> >>>>
> >>>> When I try to create a simple map inside my Wicket application, I get
> >>>>
> >> an
> >>
> >>>> exception in Firefox saying:
> >>>>   "uncaught exception: Permission denied to call method
> >>>> XMLHttpRequest.open"
> >>>>
> >>>> I've had a look at issues surrounding security restrictions in
> >>>>
> >> Javascript
> >>
> >>>> and I understand that Firefox will block XMLHttpRequests to hosts
> other
> >>>>
> >> than
> >>
> >>>> where the page came from.  I've also seen a few workarounds such as
> >>>>
> >> running
> >>
> >>>> proxies for the XML-HTTP requests.  Does gmap2 deal with these issues
> >>>>
> >> in any
> >>
> >>>> way?  I suspect I'm missing something, as when I run the gmap2
> examples
> >>>>
> >> in a
> >>
> >>>> local Tomcat, everything works fine...
> >>>>
> >>>> One additional question: after I get the above JavaScript exception,
> >>>>
> >> the
> >>
> >>>> other AJAX controls on the same page seem to stop working as well -
> is
> >>>>
> >> this
> >>
> >>>> something that Wicket ought to be handling better?  (I'm running
> Wicket
> >>>> 1.3 beta 4, with the head version of gmap2 built against this).
> >>>>
> >>>> Regards,
> >>>> Jan
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: gmap2 and permissions

Posted by Martin Funk <fu...@arcor.de>.
Hi Jan,

the good news is that I think we got a better understanding on this 
question, the bad news is we only can offer a workaround, not an elegant 
solution.

The problem is that Firefox and obviously Konqueror too object to load 
external <header> <script> Elements within an XMLHttpRequest. If those 
elements are stated in the header of the 'original' html page its no 
problem.
See:
http://www.nabble.com/ajax-with-external-javascripts-tf4650719.html#a13287137
http://www.nabble.com/Re%3A-contributing-to-header-%28was%3A-Must-renderHead-even-if-setVisible%28false%29%29-tf4193674.html#a11928113
Actually I haven't checked if Firefox executes that XMLHttpRequest when 
it points to an 'already known' resource or if that request is filtered 
somewhere along the wicket toolchain.

The second thread seems to talk about a solution on this on wicket side. 
Afaikt nothing has made its way into the code yet.

Up till then I could offer the solution to add the needed scripting tags 
to html page beforehand. This can be done by adding a 
GMapHeaderContributor. Sven updated ManyPages source code for an example 
of that. The GMapHeaderContributor doesnt have to be added to the page, 
its sufficient to add it to the component that might get an GMap2 added 
later on.
That's what I mean by workaround. I can't think of an mechanism that 
would add the HeaderContribution automatically. The developer has to 
decide explicitly.

Have fun,

Martin

> Great, thanks!
>
> Jan
>
>
> On 05/11/2007, Martin Funk <fu...@arcor.de> wrote:
>   
>> Hi Jan,
>>
>> not sure if Sven or I can come up with something tonight,
>> but it won't be forgotten.
>>
>> http://wicketstuff.org/jira/browse/WSGMAPP-3
>>
>> Martin
>>
>> Jan Stette schrieb:
>>     
>>> Some more information after looking further into this - it looks like
>>>       
>> I'm
>>     
>>> seeing the same problem as mentioned in this thread:
>>> http://www.nabble.com/Google-Maps-and-AJAX-tf4591408.html
>>>
>>> It only occurs when a Google Map is added via an AJAX request to a page
>>>       
>> that
>>     
>>> previously had no Google maps on it.
>>>
>>> It's easy to reproduce the same problem in the "Many" example in
>>> wicket-contrib-gmap2-examples, by commenting out the call to addPanel()
>>>       
>> at
>>     
>>> the end of the ManyPage constructor, line 42 in ManyPage.java.  Normally
>>> this example starts with a single Google map on the page and adds more
>>>       
>> when
>>     
>>> the user clicks an AjaxFallbackLink.  When this line is commented out,
>>>       
>> the
>>     
>>> page starts up with no maps on it, and will fail to add more when the
>>>       
>> user
>>     
>>> clicks the link.
>>>
>>> In Firefox, the error is an "uncaught exception: Permission denied to
>>>       
>> call
>>     
>>> method XMLHttpRequest.open", but this is only visible when I have the
>>> Firebug debugger enabled.  The Ajax link stops working after this error
>>> happens.
>>>
>>> In Konqueror, it shows up as a JavaScript error with code 304, and
>>>       
>> renders
>>     
>>> the rest of the page, but the maps aren't drawn, presumably because the
>>> XmlHttpRequests are blocked here as well.  Subsequent Ajax requests work
>>>       
>> OK
>>     
>>> here though.
>>>
>>> Is this a bug in the gmap2 component that could be addressed?
>>>
>>> Regards,
>>> Jan
>>>
>>>
>>> On 05/11/2007, Jan Stette <ja...@gmail.com> wrote:
>>>
>>>       
>>>> I've just started playing with wicket-contrib-gmap2 but I'm having a
>>>>         
>> bit
>>     
>>>> of a problem:
>>>>
>>>> When I try to create a simple map inside my Wicket application, I get
>>>>         
>> an
>>     
>>>> exception in Firefox saying:
>>>>   "uncaught exception: Permission denied to call method
>>>> XMLHttpRequest.open"
>>>>
>>>> I've had a look at issues surrounding security restrictions in
>>>>         
>> Javascript
>>     
>>>> and I understand that Firefox will block XMLHttpRequests to hosts other
>>>>         
>> than
>>     
>>>> where the page came from.  I've also seen a few workarounds such as
>>>>         
>> running
>>     
>>>> proxies for the XML-HTTP requests.  Does gmap2 deal with these issues
>>>>         
>> in any
>>     
>>>> way?  I suspect I'm missing something, as when I run the gmap2 examples
>>>>         
>> in a
>>     
>>>> local Tomcat, everything works fine...
>>>>
>>>> One additional question: after I get the above JavaScript exception,
>>>>         
>> the
>>     
>>>> other AJAX controls on the same page seem to stop working as well - is
>>>>         
>> this
>>     
>>>> something that Wicket ought to be handling better?  (I'm running Wicket
>>>> 1.3 beta 4, with the head version of gmap2 built against this).
>>>>
>>>> Regards,
>>>> Jan
>>>>
>>>>
>>>>
>>>>         
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>   


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


Re: gmap2 and permissions

Posted by Jan Stette <ja...@gmail.com>.
Great, thanks!

Jan


On 05/11/2007, Martin Funk <fu...@arcor.de> wrote:
>
> Hi Jan,
>
> not sure if Sven or I can come up with something tonight,
> but it won't be forgotten.
>
> http://wicketstuff.org/jira/browse/WSGMAPP-3
>
> Martin
>
> Jan Stette schrieb:
> > Some more information after looking further into this - it looks like
> I'm
> > seeing the same problem as mentioned in this thread:
> > http://www.nabble.com/Google-Maps-and-AJAX-tf4591408.html
> >
> > It only occurs when a Google Map is added via an AJAX request to a page
> that
> > previously had no Google maps on it.
> >
> > It's easy to reproduce the same problem in the "Many" example in
> > wicket-contrib-gmap2-examples, by commenting out the call to addPanel()
> at
> > the end of the ManyPage constructor, line 42 in ManyPage.java.  Normally
> > this example starts with a single Google map on the page and adds more
> when
> > the user clicks an AjaxFallbackLink.  When this line is commented out,
> the
> > page starts up with no maps on it, and will fail to add more when the
> user
> > clicks the link.
> >
> > In Firefox, the error is an "uncaught exception: Permission denied to
> call
> > method XMLHttpRequest.open", but this is only visible when I have the
> > Firebug debugger enabled.  The Ajax link stops working after this error
> > happens.
> >
> > In Konqueror, it shows up as a JavaScript error with code 304, and
> renders
> > the rest of the page, but the maps aren't drawn, presumably because the
> > XmlHttpRequests are blocked here as well.  Subsequent Ajax requests work
> OK
> > here though.
> >
> > Is this a bug in the gmap2 component that could be addressed?
> >
> > Regards,
> > Jan
> >
> >
> > On 05/11/2007, Jan Stette <ja...@gmail.com> wrote:
> >
> >> I've just started playing with wicket-contrib-gmap2 but I'm having a
> bit
> >> of a problem:
> >>
> >> When I try to create a simple map inside my Wicket application, I get
> an
> >> exception in Firefox saying:
> >>   "uncaught exception: Permission denied to call method
> >> XMLHttpRequest.open"
> >>
> >> I've had a look at issues surrounding security restrictions in
> Javascript
> >> and I understand that Firefox will block XMLHttpRequests to hosts other
> than
> >> where the page came from.  I've also seen a few workarounds such as
> running
> >> proxies for the XML-HTTP requests.  Does gmap2 deal with these issues
> in any
> >> way?  I suspect I'm missing something, as when I run the gmap2 examples
> in a
> >> local Tomcat, everything works fine...
> >>
> >> One additional question: after I get the above JavaScript exception,
> the
> >> other AJAX controls on the same page seem to stop working as well - is
> this
> >> something that Wicket ought to be handling better?  (I'm running Wicket
> >> 1.3 beta 4, with the head version of gmap2 built against this).
> >>
> >> Regards,
> >> Jan
> >>
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: gmap2 and permissions

Posted by Martin Funk <fu...@arcor.de>.
Hi Jan,

not sure if Sven or I can come up with something tonight,
but it won't be forgotten.

http://wicketstuff.org/jira/browse/WSGMAPP-3

Martin

Jan Stette schrieb:
> Some more information after looking further into this - it looks like I'm
> seeing the same problem as mentioned in this thread:
> http://www.nabble.com/Google-Maps-and-AJAX-tf4591408.html
>
> It only occurs when a Google Map is added via an AJAX request to a page that
> previously had no Google maps on it.
>
> It's easy to reproduce the same problem in the "Many" example in
> wicket-contrib-gmap2-examples, by commenting out the call to addPanel() at
> the end of the ManyPage constructor, line 42 in ManyPage.java.  Normally
> this example starts with a single Google map on the page and adds more when
> the user clicks an AjaxFallbackLink.  When this line is commented out, the
> page starts up with no maps on it, and will fail to add more when the user
> clicks the link.
>
> In Firefox, the error is an "uncaught exception: Permission denied to call
> method XMLHttpRequest.open", but this is only visible when I have the
> Firebug debugger enabled.  The Ajax link stops working after this error
> happens.
>
> In Konqueror, it shows up as a JavaScript error with code 304, and renders
> the rest of the page, but the maps aren't drawn, presumably because the
> XmlHttpRequests are blocked here as well.  Subsequent Ajax requests work OK
> here though.
>
> Is this a bug in the gmap2 component that could be addressed?
>
> Regards,
> Jan
>
>
> On 05/11/2007, Jan Stette <ja...@gmail.com> wrote:
>   
>> I've just started playing with wicket-contrib-gmap2 but I'm having a bit
>> of a problem:
>>
>> When I try to create a simple map inside my Wicket application, I get an
>> exception in Firefox saying:
>>   "uncaught exception: Permission denied to call method
>> XMLHttpRequest.open"
>>
>> I've had a look at issues surrounding security restrictions in Javascript
>> and I understand that Firefox will block XMLHttpRequests to hosts other than
>> where the page came from.  I've also seen a few workarounds such as running
>> proxies for the XML-HTTP requests.  Does gmap2 deal with these issues in any
>> way?  I suspect I'm missing something, as when I run the gmap2 examples in a
>> local Tomcat, everything works fine...
>>
>> One additional question: after I get the above JavaScript exception, the
>> other AJAX controls on the same page seem to stop working as well - is this
>> something that Wicket ought to be handling better?  (I'm running Wicket
>> 1.3 beta 4, with the head version of gmap2 built against this).
>>
>> Regards,
>> Jan
>>
>>
>>     
>
>   


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


Re: gmap2 and permissions

Posted by Jan Stette <ja...@gmail.com>.
Some more information after looking further into this - it looks like I'm
seeing the same problem as mentioned in this thread:
http://www.nabble.com/Google-Maps-and-AJAX-tf4591408.html

It only occurs when a Google Map is added via an AJAX request to a page that
previously had no Google maps on it.

It's easy to reproduce the same problem in the "Many" example in
wicket-contrib-gmap2-examples, by commenting out the call to addPanel() at
the end of the ManyPage constructor, line 42 in ManyPage.java.  Normally
this example starts with a single Google map on the page and adds more when
the user clicks an AjaxFallbackLink.  When this line is commented out, the
page starts up with no maps on it, and will fail to add more when the user
clicks the link.

In Firefox, the error is an "uncaught exception: Permission denied to call
method XMLHttpRequest.open", but this is only visible when I have the
Firebug debugger enabled.  The Ajax link stops working after this error
happens.

In Konqueror, it shows up as a JavaScript error with code 304, and renders
the rest of the page, but the maps aren't drawn, presumably because the
XmlHttpRequests are blocked here as well.  Subsequent Ajax requests work OK
here though.

Is this a bug in the gmap2 component that could be addressed?

Regards,
Jan


On 05/11/2007, Jan Stette <ja...@gmail.com> wrote:
>
> I've just started playing with wicket-contrib-gmap2 but I'm having a bit
> of a problem:
>
> When I try to create a simple map inside my Wicket application, I get an
> exception in Firefox saying:
>   "uncaught exception: Permission denied to call method
> XMLHttpRequest.open"
>
> I've had a look at issues surrounding security restrictions in Javascript
> and I understand that Firefox will block XMLHttpRequests to hosts other than
> where the page came from.  I've also seen a few workarounds such as running
> proxies for the XML-HTTP requests.  Does gmap2 deal with these issues in any
> way?  I suspect I'm missing something, as when I run the gmap2 examples in a
> local Tomcat, everything works fine...
>
> One additional question: after I get the above JavaScript exception, the
> other AJAX controls on the same page seem to stop working as well - is this
> something that Wicket ought to be handling better?  (I'm running Wicket
> 1.3 beta 4, with the head version of gmap2 built against this).
>
> Regards,
> Jan
>
>