[Users] Printprovider problem

Matt Priour mpriour at kestrelcomputer.com
Wed May 4 15:46:34 CEST 2011


That's because for the print job you are not going through a proxy. ExtJS doesn't "know" about your OL ProxyHost unless you are using the ext-override-ajax.js file which is not included by default.
Options                200                         text/plain(NS_ERROR_DOM_BAD_URI)                http://demo.opengeo.org/geoserver/pdf/create.json

As you can see from HttpFox, your request is going directly to demo.opengeo.org but your webpage is hosted at localhost:8080



The 2 solutions are:

1. Use ext-override-ajax.js -> it will send all request through OL rather than ExtJs and will be aware of and use the OL ProxyHost

2. Intercept the actual ExtJs request and modify the url before it is sent. Here's an example of how I did that:



....
 Ext.Ajax.on('beforerequest',App.interceptPrint,null,{single:true});
 App.printProvider.print(mappanel,printPage);
....
 App.interceptPrint = function(conn,options){
  Ext.apply(options,{
   url:Ext.urlAppend(OpenLayers.ProxyHost, Ext.urlEncode(options.url))
  });
  Ext.Ajax.request(options);
  return false;   
 }
/* I also apply my own callback & success functions to handle the print request response
myself and prevent the PrintProvider from handling it. I include them after the 'url' property.
However, that is not something you probably want to do, just letting you know that you can

*/



Matt Priour

Kestrel Computer Consulting



From: Ralph Dell 

Sent: Wednesday, May 04, 2011 7:51 AM
To: users at geoext.org 
Subject: Re: [Users] Printprovider problem


I have included my OpenLayers.ProxyHost  statement at the top of  my script.

 Last week when I was scratching my head I confirmed my proxy was working by doing some wfs requests opengeo and my production geoserver. They worked.

I do not know why I am fighting a proxy issue with the printProvider but in other circumstances I know my proxy is working.

 

Ralph Dell

 

From: Matt Priour [mailto:mpriour at kestrelcomputer.com] 
Sent: Tuesday, May 03, 2011 5:47 PM
To: Ralph Dell; users at geoext.org
Subject: Re: [Users] Printprovider problem

 

... 

The post will work in IE 7 & 8. I do get the message "This page is accessing information that is not under your control. . Do you want to continue"

...

That is because you need a proxy to get around the Same-site Origin Policy

http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost

Matt Priour

 

From: Ralph Dell 

Sent: Tuesday, May 03, 2011 1:51 PM

To: users at geoext.org 

Subject: [Users] Printprovider problem

 

I have recently installed the geoserver printing module and set up a app using the PrintProvider. The development went well until I realized that GET was not going to work for me because of the  URL length. After changing the method to POST I cannot get the printing to work at all in firefox. I have taken a step back and am currently testing with a local copy of the geoext example print-page.html and getting my printCapabilities from demo.opengeo.org or localhost:8080

 

I believe have a proxy problem but I do not know why, nor how to fix it . 

 

In config.yaml I have the entries 

- !localMatch

    dummy: true

- !dnsMatch

    host: demo.opengeo.org      I have tested with and without the line port:80

 

I can load the printCapabilities from opengeo and localhost   

 

After clicking the print button in  HttpFox I see (going to opengeo)

Method               Result                   Type                                                                                      url

 

Options                200                         text/plain(NS_ERROR_DOM_BAD_URI)                http://demo.opengeo.org/geoserver/pdf/create.json

 

I have a similar error from my localhost

 

The BAD_URI error indicates different domain names are being used, but I do not see that as being the case., and Method Options tells me I have a proxy issue.

My local test environment is  geoext 1.0,   geoserver 2.0.3 (jetty), OpenLayers 2.10, extjs 3.3.1, windows XP, and my web server is IIS

 

When going to my localhost after clicking the print button

The printprovider print exception listener response.statusText is "communication failure"

My geoserver request log has "OPTIONS /geoserver/pdf/create.json HTTP/1.1" 200 0

My geoserver.log contains DEBUG [geoserver.filters] - filtering http://localhost:8080/geoserver/pdf/create.json

 

I'm lost. Any suggestions on what I am missing would be appreciated.

 

The post will work in IE 7 & 8. I do get the message "This page is accessing information that is not under your control. . Do you want to continue"

 

Ralph Dell

 


--------------------------------------------------------------------------------

_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users



--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110504/7b75d032/attachment-0001.htm 


More information about the Users mailing list