views:

61

answers:

2

POJO is the norm in Spring but also pervasive in JEE world. One non-POJO stronghold is Servlet. i'm wonderring if any open source ever appeals to change.

POJO examples:

class MyHttpServlet { @Inject void doGet (@HttpServletRequest Request request, @HttpServletResponse Response response) {..} }

class MyOtherServlet { @Inject void doOther (@OtherServletRequest Request request, @OtherServletResponse Response response) {..} }

class MyOneWayServlet { @Inject void doOneWay (@OneWayServletRequest Request request) {..} }

.....

Maybe it's all about how to make POJO/SoC/loose-coupling pragmatically.

Spring's taking on EJB2.x is straight replacing it that later yields to EJB3.x, but on Servlet adding a MVC layer above (like other web frameworks doing theirs).

Orginally i was asking if someone envisioned the radical way on Servlet. The answers seem to me clearly none.

+3  A: 

I understand that you're asking for POJO-flavored alternatives to Servlet, is this correct?

There are none. It's the core building stone of a Java EE webapplication. It provides a mandatory application programming interface to intercept on HTTP requests. There are however a lot of Java EE based MVC frameworks which abstracts the whole Servlet away so that you end up with basically a Javabean (or POJO as you call it) as model and a JSP/(X)HTML page as view. Examples of such are JSF, Spring MVC, Struts2, Wicket, etc.

There's no need to reinvent Servlet. It's a mature and solid building stone. Just abstract it away using a MVC framework if it disturbs you.

BalusC
i add examples that might make web/servlet container more vibrant thanks to POJO.
sof
I think you confused the meaning of term POJO. Your code example shows DI and that's less or more already what Spring MVC is doing.
BalusC
The examples appeal that web/servlet container needn't tighten to http request/response objects but may inject various types of them, by compositing the "POJO" servlet with the desingated tranport "SERVICE" (http/other/oneway...) .
sof
Still, this require the "raw" Servlet API to do its work in the background. Right now you're basically asking for Servlet API-provided annotations to inject the request/response objects. Well, basically there's only the `@WebServlet`. For the remnant this just look like more an idea for *another* MVC framework which abstracts the Servlet API away using the kind of annotations as shown in your example.
BalusC
+1  A: 

Take a look at the Spring-MVC Controllers: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-controller

If I understand correctly, this is what you are looking for

Eran Harel