Hi Justin,
Thanks for your response.
The WFS 1.1 specification say like this:
"If, however, the value of the resultType attribute is specified as hits, a web feature service must generate a <wfs:FeatureCollection> element with no content (i.e. empty) but must populate the values of the timeStamp attribute and the numberOfFeatures attribute."
I guess that means we can't put a bounding box element inside the FeatureCollection in the ordinary resultType=hits case. Or how do you interpret it?
So maybe the format_options is the way to do it. I've read what is written at http://geoserver.org/display/GEOSDOC/Format+Options and also your discussion in the dev-list linked from that page.
I can see that you implemented the format_options parameter for GET requests and there's no problem to get hold of them from the HitsOutputFormat class. What was your conclusion about format_options and POSTs?
After looking a little into the code it seems like the main challenge would be how to alter the Encoder class 
//Albin
-----Original Message-----
From: Justin Deoliveira [mailto:jdeolive@anonymised.com]
Sent: Mon 3/2/2009 6:48 PM
To: Lundmark Albin
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Best way to implement WFS response that only returns the bbox of the result
Hi Albin,
There are a couple of ways we could approach this. One way could be to
include the bounding box when result type = hits. I don't think there is
anything in the spec that disallows this.
If the spec does say that the bounds should not be included then we
could perhaps add a format option to explicitly enable that option. For
instance something like:
...request=getfeature&resulttype=hits&format_options=bounds:true
Either way I think the only change required would be to the
HitsOutputFormat class. There may be a tweak necessary to the geotools
feature encoding classes as well.
What are your thoughts on this solution? Or do you still think a
separate value for resulttype is necessary?
-Justin
Lundmark Albin wrote:
Hi list,
I'm looking into implementing the possibility to get only the bbox (same
as envelope?) of the result of a GetFeature request. I need some help to
find out a good way to do it.
I have already made an outputformat extension named "onlybbox" and it
works fine. But it doesn't feel right because it's not a real format 
A more obvious way would be to create a new ResultType but it seems
problematic. There are two resulttypes in the WFS 1.1 spec and they are
"results" and "hits". A new one called "bbox" would be the neatest way.
But the spec does not seem to allow this as the WFS schema has a
ResultTypeType that only allows the two values "results" and "hits".
This means that the geoserver (or geotools?) code parses the resultType
attribute of the query as a ResultTypeType object and this object is
final and can't be overloaded with my new type "bbox" added. And even if
it was possible it would not follow the spec.
Does anyone have an idea of how to achieve this in a nice way? Do I have
to do a GetBbox operation in order to not go against the spec?
Regards
Albin
------------------------------------------------------------------------
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.