Bear Bibeault wrote:Perhaps what you really want to delve into is RESTful web APIs?
Maybe. I've written code to consume RESTful services, but never to generate them. I need to look into that.
Bear Bibeault wrote:P.S. I don't see any issues with sometimes returning JSON and sometimes HTML; I do it all the time. It depends upon usage and the needs of the API.
That's reassuring. But I feel like I'm missing something. If you'll indulge me for a moment...
I usually write an "AjaxHandler" class that looks something like this:
Except for the lack of logging, that looks like decent code to me. But this:
That looks hideous to me with all that
String appending going on and I can't help but think that there has to be a better way. That' why I asked about improving my server-side code. I feel like there must be techniques that I just haven't learned yet, because it's hard to believe that this is the best way to do it. Is this really an acceptable solution, or have I wandered off into the wilderness?