[Geoserver-devel] TestWfsPost

Magne,

The TestWfsPost is pretty hacky, but it is actually pretty useful. What
might be better is to have the browser send an XMLHTTPRequest (AJAX)
request to the server. But:

1. You have to have a fairly modern-ish browser that has XMLHTTPRequest
2. Browser security means that the HTML page *must* come from the same
server as the where you are sending the XML to.

This is a wee bit limiting.

The basic problem is that the standard OGC services work like a normal
AJAX or SOP request. You send a normal HTTP request and stick the XML
document inside the body.

Unfortunately, there's no easy way to do this (except using the AJAX
XMLHTTPRequest) since normal <form>s (POST) stick other stuff in the
body of the request (like parameter separators).

When the TestWfsPost was created, it was just to mediate between the
HTML <form> POST and the 'pure' SOAP-like AJAX-XMLHTTPRequest
symantics.

What makes things a little more difficult, is that there are actually
two (actually 3) ways of making a WFS request to the server.
1. AJAX-like XML-in-body POST requests
2. GET request with &FILTER=... in the URL
3. (faking it) POST request, but exactly like the GET request.

To make things more complex the TestWfsPost form was written before any
of the WMS SLD-POST stuff was even thought of. So, the only way of
sending a request to the WMS was with GET.

So, the problems with TestWfsPost are 'for historical reasons'.

What would be great would be for *all* the servlets (and there are many
of them) to be able to tell the difference between an AJAX-POST (thats
what they're currently setup to handle), a HTML <form> POST (exactly
the same as the GET) and a HTML <form> POST with a single parameter
with the XML document in it.

I hope that all makes sense.

NOTE: the TestWfsPost bascially takes the "HTML <form> POST with a
single parameter with the XML document in it" and converts it into a
AJAX-like request.

Currently, there isnt a way (except with the TestWfsPost servlet) of
(easily) using HTML to make a proper 'POST' request to the WFS. (The
WMS has some support for this)

The OGC did not define a symantic for this -- they have a GET
(parameters in the URL) and a POST (AJAX style) symantic for requests.
The other two ways of making requests are not defined:
1. POST with parameters (ie. take a <form method=get> and change it to
<form method=post>)
2. POST with a parameter that contains an XML document

also:
3. GET with a parameter that contains an XML document (not really all
that useful).

dave

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dblasby@anonymised.com wrote:

Magne,

The TestWfsPost is pretty hacky, but it is actually pretty useful.

Hi Dave

I understand that, and I am not about to remove anything. Just add the
full potential of a servlet to any of the servlets used.

What

might be better is to have the browser send an XMLHTTPRequest (AJAX)
request to the server. But:

1. You have to have a fairly modern-ish browser that has XMLHTTPRequest

IE 5.0, 5.5 and 6.0. Mozilla and the latest opera all supports
XMLHTTPRequest (IE 5.0 and 5.5 does not support gzipped content).

2. Browser security means that the HTML page *must* come from the same
server as the where you are sending the XML to.

Yes, that is a known "problem".

This is a wee bit limiting.

The basic problem is that the standard OGC services work like a normal
AJAX or SOP request. You send a normal HTTP request and stick the XML
document inside the body.

Unfortunately, there's no easy way to do this (except using the AJAX
XMLHTTPRequest) since normal <form>s (POST) stick other stuff in the
body of the request (like parameter separators).

But that can easily(?) be handled right. It is just to set the correct
content type on the request, and add a check for it like we did in GetMap.

When the TestWfsPost was created, it was just to mediate between the
HTML <form> POST and the 'pure' SOAP-like AJAX-XMLHTTPRequest
symantics.

What makes things a little more difficult, is that there are actually
two (actually 3) ways of making a WFS request to the server.
1. AJAX-like XML-in-body POST requests
2. GET request with &FILTER=... in the URL
3. (faking it) POST request, but exactly like the GET request.

To make things more complex the TestWfsPost form was written before any
of the WMS SLD-POST stuff was even thought of. So, the only way of
sending a request to the WMS was with GET.

So, the problems with TestWfsPost are 'for historical reasons'.

What would be great would be for *all* the servlets (and there are many
of them) to be able to tell the difference between an AJAX-POST (thats
what they're currently setup to handle), a HTML <form> POST (exactly
the same as the GET) and a HTML <form> POST with a single parameter
with the XML document in it.

I hope that all makes sense.

Yes, but I must admit I see the problem as defining the correct content
type on the content that is sent.
x-www-form-urlencoded text/plain text/xml or any other applicable.

e.g. xmlhttpCon.setRequestHeader("Content-type", "text/xml");
or that the html form set application/x-www-form-urlencoded

The servlets should be able to tell the difference, as long as it is set
in the request.
It can handle the input from the TestWfsPost, so it can also handle the
input directly too.

My goal is to be able to send html form post directly to the servlet,
without going through the TestWfsPost.

I don't think it is too large of a change really. the doGet method will
handle this properly, as long as it is the same content type as it say
it is.

I am probably making it a bigger deal than it needs too be, since
nothing actually is broken or need fixing.

Magne

NOTE: the TestWfsPost bascially takes the "HTML <form> POST with a
single parameter with the XML document in it" and converts it into a
AJAX-like request.

Currently, there isnt a way (except with the TestWfsPost servlet) of
(easily) using HTML to make a proper 'POST' request to the WFS. (The
WMS has some support for this)

The OGC did not define a symantic for this -- they have a GET
(parameters in the URL) and a POST (AJAX style) symantic for requests.
The other two ways of making requests are not defined:
1. POST with parameters (ie. take a <form method=get> and change it to
<form method=post>)
2. POST with a parameter that contains an XML document

also:
3. GET with a parameter that contains an XML document (not really all
that useful).

dave

----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDlEK3Djwfc5lfNZcRAoPiAJ952tdxmPn+G1bT9PSeKiPHruwIPACfepw3
onLf3ZtqmJcLGQLlVGwEahg=
=rVDQ
-----END PGP SIGNATURE-----