[Geoserver-devel] Content disposition changes breaking layer preview

Hi,
today I started playing with GeoServer and was greeted with a non working
layer preview, the html file would be downloaded on disk instead of
being shown.

Tracked back the issue to the get map respose returning null as the
preferred content disposition, and thus having Content-Disposition:
null; file=topp:states.html
in the headers (or something like that, I did not copy it).

The following patch seems to fix it:

diff --git a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
b/src/ows/src/main/java/org/geoserver/ows/Dispatche
index 44ed060..6f455a8 100644
--- a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
+++ b/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
@@ -792,6 +792,9 @@ public class Dispatcher extends AbstractController {
                 }
                 if (disposition == null) {
                     disposition =
response.getPreferredDisposition(result, opDescriptor);
+ if(disposition == null) {
+ disposition = Response.DISPOSITION_INLINE;
+ }
                 }
                 // this would be a good place to quote the filename
but unsure of
                 // compatibility - it appears to be the correct way to handle

Generally speaking, either the response is supposed to return a non null
preferred disposition, in which case the dispatcher should cry foul when
a response returns null, or we do the above and have a default in case
the response does not have an opinion

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

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

I vote for the patch, seems a little nicer to me on existing output formats.

On Wed, Aug 3, 2011 at 10:20 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi,
today I started playing with GeoServer and was greeted with a non working
layer preview, the html file would be downloaded on disk instead of
being shown.

Tracked back the issue to the get map respose returning null as the
preferred content disposition, and thus having Content-Disposition:
null; file=topp:states.html
in the headers (or something like that, I did not copy it).

The following patch seems to fix it:

diff --git a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
b/src/ows/src/main/java/org/geoserver/ows/Dispatche
index 44ed060…6f455a8 100644
— a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
+++ b/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
@@ -792,6 +792,9 @@ public class Dispatcher extends AbstractController {
}
if (disposition == null) {
disposition =
response.getPreferredDisposition(result, opDescriptor);

  • if(disposition == null) {
  • disposition = Response.DISPOSITION_INLINE;
  • }
    }
    // this would be a good place to quote the filename
    but unsure of
    // compatibility - it appears to be the correct way to handle

Generally speaking, either the response is supposed to return a non null
preferred disposition, in which case the dispatcher should cry foul when
a response returns null, or we do the above and have a default in case
the response does not have an opinion

Cheers
Andrea

Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf



BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Hey Andrea,

Thanks for bearing with the fallout from the changes. Agreed with the
patch - this is not acceptable.

I should have initiated a discussion regarding inline/attachment much
earlier in this process, but it seems to me that inline is almost
redundant for most output formats and serves to only add HTTP
overhead. Most of the references I could find in my quick research
indicate that folks use it for specific agent workarounds.
Specifically this comes to mind with WMS services where browsers and
clients. These superfluous headers may add a fair amount of
non-compressed overhead.

My assumption (bad) was that the inline disposition header was needed
for some specific reason (I can't recall the type that was using it),
though my intuition told me otherwise as I was only familiar with the
use of attachment.

I'd propose that the default be no content-disposition header unless
either a) the format knows better (pdf, shp, etc.) or b) the client
requests it specifically (via the new parameter API).

Thoughts?

-Ian

On Wed, Aug 3, 2011 at 10:20 AM, Andrea Aime
<andrea.aime@anonymised.com> wrote:

Hi,
today I started playing with GeoServer and was greeted with a non working
layer preview, the html file would be downloaded on disk instead of
being shown.

Tracked back the issue to the get map respose returning null as the
preferred content disposition, and thus having Content-Disposition:
null; file=topp:states.html
in the headers (or something like that, I did not copy it).

The following patch seems to fix it:

diff --git a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
b/src/ows/src/main/java/org/geoserver/ows/Dispatche
index 44ed060..6f455a8 100644
--- a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
+++ b/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
@@ -792,6 +792,9 @@ public class Dispatcher extends AbstractController {
}
if (disposition == null) {
disposition =
response.getPreferredDisposition(result, opDescriptor);
+ if(disposition == null) {
+ disposition = Response.DISPOSITION_INLINE;
+ }
}
// this would be a good place to quote the filename
but unsure of
// compatibility - it appears to be the correct way to handle

Generally speaking, either the response is supposed to return a non null
preferred disposition, in which case the dispatcher should cry foul when
a response returns null, or we do the above and have a default in case
the response does not have an opinion

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

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

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Ian Schneider
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

On Wed, Aug 3, 2011 at 11:15 AM, Ian Schneider <ischneider@anonymised.com> wrote:

Hey Andrea,

Thanks for bearing with the fallout from the changes. Agreed with the
patch - this is not acceptable.

I should have initiated a discussion regarding inline/attachment much
earlier in this process, but it seems to me that inline is almost
redundant for most output formats and serves to only add HTTP
overhead. Most of the references I could find in my quick research
indicate that folks use it for specific agent workarounds.
Specifically this comes to mind with WMS services where browsers and
clients. These superfluous headers may add a fair amount of
non-compressed overhead.

My assumption (bad) was that the inline disposition header was needed
for some specific reason (I can’t recall the type that was using it),
though my intuition told me otherwise as I was only familiar with the
use of attachment.

I’d propose that the default be no content-disposition header unless
either a) the format knows better (pdf, shp, etc.) or b) the client
requests it specifically (via the new parameter API).

Thoughts?

RIght, yeah this makes more sense and seems more like the behaviour before the patch. +1

-Ian

On Wed, Aug 3, 2011 at 10:20 AM, Andrea Aime
<andrea.aime@anonymised.com> wrote:

Hi,
today I started playing with GeoServer and was greeted with a non working
layer preview, the html file would be downloaded on disk instead of
being shown.

Tracked back the issue to the get map respose returning null as the
preferred content disposition, and thus having Content-Disposition:
null; file=topp:states.html
in the headers (or something like that, I did not copy it).

The following patch seems to fix it:

diff --git a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
b/src/ows/src/main/java/org/geoserver/ows/Dispatche
index 44ed060…6f455a8 100644
— a/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
+++ b/src/ows/src/main/java/org/geoserver/ows/Dispatcher.java
@@ -792,6 +792,9 @@ public class Dispatcher extends AbstractController {
}
if (disposition == null) {
disposition =
response.getPreferredDisposition(result, opDescriptor);

  • if(disposition == null) {
  • disposition = Response.DISPOSITION_INLINE;
  • }
    }
    // this would be a good place to quote the filename
    but unsure of
    // compatibility - it appears to be the correct way to handle

Generally speaking, either the response is supposed to return a non null
preferred disposition, in which case the dispatcher should cry foul when
a response returns null, or we do the above and have a default in case
the response does not have an opinion

Cheers
Andrea

Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf



BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Ian Schneider

OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.


BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

On Wed, Aug 3, 2011 at 7:15 PM, Ian Schneider <ischneider@anonymised.com> wrote:

Hey Andrea,

Thanks for bearing with the fallout from the changes. Agreed with the
patch - this is not acceptable.

I should have initiated a discussion regarding inline/attachment much
earlier in this process, but it seems to me that inline is almost
redundant for most output formats and serves to only add HTTP
overhead. Most of the references I could find in my quick research
indicate that folks use it for specific agent workarounds.

Not really, it has a specific and nice purpose the moment poeople try
to save the output on disk after seeing it in the browser.
If you add the content disposition header every time they save something
they won't be presented with "ows" as the file name, but topp_states.png
instead.

I actually added the inline content disposition plus file name in some raster
WMS output formats some time ago for this very reason, after hearing
some complains and getting annoyed quite a few times me too.

Specifically this comes to mind with WMS services where browsers and
clients. These superfluous headers may add a fair amount of
non-compressed overhead.

Given the smallest output is anyways around 1kb, and the normal outputs
are around 50KB, well, who cares :slight_smile:

My assumption (bad) was that the inline disposition header was needed
for some specific reason (I can't recall the type that was using it),
though my intuition told me otherwise as I was only familiar with the
use of attachment.

I'd propose that the default be no content-disposition header unless
either a) the format knows better (pdf, shp, etc.) or b) the client
requests it specifically (via the new parameter API).

Thoughts?

As said above, I disagree, I want my nice file name when I go so
save the gml or png on disk :slight_smile:

We could also agree to disagree and add a flag to control this :slight_smile:

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

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

Thanks Andrea,

Your explanation makes good sense and makes this discussion and issue
seem more relevant.

Given the smallest output is anyways around 1kb, and the normal outputs
are around 50KB, well, who cares :slight_smile:

Good point - my initial thought was w/ respect to GWC and ETag 304
responses, but the headers are not included so this is moot.

As said above, I disagree, I want my nice file name when I go so
save the gml or png on disk :slight_smile:

We could also agree to disagree and add a flag to control this :slight_smile:

With your reasoning, I now agree with you.

Another patch coming (getting tired yet?) :wink:

Regards,
-Ian

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

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

--
Ian Schneider
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.