Hi all,
this user question popped up quite often lately, always by people having
java code making requests to geoserver that used to work with 1.3.x and
do not work any more with 1.4.0 onwards.
The issue happens because we changed the behaviour to consider a POST
request a real post only if the mime type is not set to "application-x-www-form-urlencoded". Here is the code in Dispather.dispatch(...) (web module):
boolean isGet = "GET".equalsIgnoreCase(httpRequest.getMethod())
|| ((httpRequest.getContentType() != null)
&& httpRequest.getContentType().startsWith("application/x-www-form-urlencoded"));
Unfortunately when you do a POST with java that mime type is the default. We started considering that to allow people make big
WMS request (encoding the same GET parameters in a POST request).
Since the dispatcher does not know about the service, it treats every
request like this, not only WMS ones.
I do believe the change is doing more harm than good. Opinions?
Cheers
Andrea
StaceyRoos ha scritto:
I am having a similar problem to this one - posted on 16th January (i.e.
problems when querying geoserver from code, but not from the demo). I
followed this thread but it doesn't seem to have been resolved. I tried all
the solutions suggested to the original poster, including testing using a
standard query, that I cut and pasted from the demo, and adding GetFeature
to the end of the URL. (This resulted in a different error , and again -
worked in the demo)When I use the same code, but post to a geoserver v1.3 - there is no
problem, the problem is only occurring with v. 1.4. Note that I do not get
back an error if I use the Geoserver demo, only when I try to post a query
from within code.If anyone has any additional ideas I would really appreciate it - something
has obviously changed between the two versions - and I don't know where to
start looking to track it down. Details follow.Thanks
Stacey RoosJava Code used to do the request:
/********************/
URL url = new URL(wfsURL); // this is one of the URL's listed below
URLConnection connection = url.openConnection();
connection.setDoOutput(true);OutputStreamWriter out = new OutputStreamWriter(
connection.getOutputStream());
out.write(wfsRequest); // this has been passed in to the method - I am
using the query listed below
out.close();
/*******************/
Response is simply read in on an input stream from the same connection.URLs: working URL: http://ict4eo.meraka.csir.co.za:8080/geoserver_1.3/wfs not working( v1.4): http://ict4eo.meraka.csir.co.za:8080/geoserver/wfs
Query tested: <wfs:GetFeature service='WFS' version='1.0.0' outputFormat='GML2'
xmlns:topp='http://www.openplans.org/topp’ xmlns:wfs='http://www.opengis.net/wfs’
xmlns:ogc='http://www.opengis.net/ogc’ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance’
xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd’> <wfs:Query
typeName='topp:states'> <ogc:Filter> <ogc:FeatureId
fid='states.3'/> </ogc:Filter> </wfs:Query> </wfs:GetFeature>Response received:
<?xml version="1.0" ?><ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc
http://ict4eo.meraka.csir.co.za:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd"> <ServiceException> org.vfny.geoserver.ServiceException: Could not
locate service mapping to: (wfs,null) at
org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193) at
org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
at .... etc .....</ServiceException></ServiceExceptionReport>
Original post:
-----------------Lee Wai See wrote:
Hi,
I am trying to send a GetFeature request (with a ogc:DWithin filter) to GeoServer in my Java business code. However, I got the following
error:
25592 [WARNING] org.vfny.geoserver.ServiceException - encountered error: Could not locate service mapping to: (wfs,null)
StackTrace: org.vfny.geoserver.ServiceException: Could not locate service mapping to: (wfs,null)
at org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:193)
at
org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:58)
at
<snipped rest of stack trace>