Greg Bag wrote:My problem is it doesn't redirect, it stops.
The transferget does forward, but the transferpost does not.
Greg Bag wrote:how can I forward to a servlet from a rest @POST method?
Also is it safe to have @Context HttpServletRequest request and @Context HttpServletResponse response as instance variables? Thread-safety issue here?
Ulf Dittmer wrote:I guess I don't understand why there are servlets at all. Unless they are also used for some web app that emits HTML to browsers and needs to use the same logic (in which I would still say the approach I outlined in my previous post is a better design), using servlets seems a complication that doesn't add value. Am I missing something?
Greg Bag wrote:
So the flow is this
1) Any request that comes in automatically gets redirected to the rest service via a filter.
2) REST parses the json and turns it into an object.
3) Based on certain properties in the object, the properties of the object get forwarded to certain servlets for additional processing.
4) The reason im using rest for front end and not a regular servlet is because in a regular servlet there is just a doGet()/doPost() methods. In rest, I can add many paths.
I guess I don't know how to properly use databases with rest. I forward to the servlet so database updates can be made.
Ulf Dittmer wrote:
I guess I don't know how to properly use databases with rest. I forward to the servlet so database updates can be made.
I think this goes to the heart of the matter. Why do you think using a DB with a REST APi would be any different than using a DB with a servlet?
Don't listen to Steve. Just read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|