Sunday, May 15, 2011

JSONP, Proxy, Valve

I'm not a JSONP fan.
But overcoming the cross-domain REST calls is important.
I don't like that it is restricted to GET requests.
I don't like that it doesn't return any error information from the server.
Yes, I could make GET versions of my POST calls. Yes, I could return error messages in a custom json error object.
But I'd rather not if possible, and there are other options.
I've read countless examples of writing up some PHP proxy code, to make the request to a different domain but allow a local request for it.
But I much prefer setting up Apache with mod proxy and a rewrite/proxy rule to handle it.

Recently I wrote my first Tomcat/Catalina valve, although to be used in JBoss.
This was also my first time coding using Apache Commons HttpClient.
It worked surprisingly well to accomplish the same goal to proxy the request without using Apache.

No comments:

Post a Comment