|
|
Strange problem w/IE, Ajax, OpenRico
I am currently adding Ajax calls to an existing Spring web application. I am using OpenRico 1.1.2/Prototype 1.4.0 to make my Ajax calls to a Spring 2.0 back-end controller running on BEA WebLogic 8.1 SP3.
My calls work perfectly using a FireFox 2.0 browser but they don't work when using IE 5.5. The calls are to quot;runTest.htmquot;, which is mapped (via Spring) to a Java-based controller. But the call never gets there when running IE. I get the following error:
Method get is not defined in RFC 2068 and is not supported by the Servlet API.
If I change my method from 'get' to 'GET', then IE _does_ make the call, but none of the parameters are accessible from the controller (using request.getParameter()). (This is the same behavior in FireFox 2.0.) I get similar behaviors using 'post' and 'POST'.
Any ideas? Thanks!
I ended up solving my own problem, although I'm not sure it's the best solution... First, some more background:
I was attempting to make Ajax calls using OpenRico 1.1.2/Prototype 1.4. Everything worked fine when attempting to access a JSP page directly. But when I switched to calling a .htm (which routed to a Spring 2.0-based Controller running on BEA WebLogic 8.1 SP3), it broke things in Internet Explorer 5.5. (It worked fine in FireFox 2.0.) After doing some debugging, I found that the returned response (instead of my expected XML string) was:
Method get is not defined in RFC 2068 and is not supported by the Servlet API
I also tried using post with similar results.
Next, I attempted to override the method using quot;GETquot;/quot OSTquot; instead of quot;getquot;/quot;postquot;. This produced identical results on both IE and FireFox -- the calls occurred but the controller did not pick up the parameters.
So, in summary, here's what I had happening:
FireFox 2.0 IE 5.5 ----------------------------- -------------------------
'get' |Worked! RFC 2068 error
'post' |Worked! RFC 2068 error
'GET' |No values passed to Controller No values passed to Controller
'POST' |No values passed to Controller No values passed to Controller
Since I couldn't come up with a way to make 'get' or 'post' work in IE 5.5, I ended up editing prototype.js as follows:
BEFORE (lines 600, 651, and 663, respectively):
method: 'post',
this.transport.send(this.options.method == 'post' ? body : null);
if (this.options.method == 'post') {
AFTER:
method: 'POST',
this.transport.send(this.options.method == 'post' || this.options.method == 'POST' ? body : null);
if (this.options.method == 'post' || this.options.method == 'POST' ) {
This seems to work for both IE 5.5 and FireFox 2.0, provided 'POST' is used for the method. |
|