Can I Use WAR With Java EE 6 Full Profile?

Java EE 6 brings a lot new features. Among the others there is the concept of profiles. Java EE starts with the definition of two: Full and Web Profile. The idea is to create separate and more specialized set of services that better suits your job. E.g. if you only want to use Servlets, JSP and add some EJB’s – do you really need full-blown application server with JMS, JMX, CORBA, JAX-WS and a lot of other abbreviations?...

November 11, 2012 · 2 min

One Servlet Instance to Rule Them All...

I see a lot of people saying that: “there is only one instance of servlet per application”. Surely it gives you some information and knowing this will save you from a lot of strange, unexpected errors. However, the above statement is not very accurate and precise. It’s useful to know what is the actual contract between the web container and developer. Moreover, a lot of questions arise because of the multi-threading issues, so let me sum this up backing my words with Servlet 3....

April 30, 2012 · 2 min

Using Servlets 3.0 ServletContainerInitializer

Servlets 3.0 in Java EE 6, brings new interface called ServletContainerInitializer. The name is very self-explanatory, but the question is – how it’s different from the ServletContextListener? Well, technically, the ServletContainerInitializer is not a listener – it is an initializer and it’s executed before any servlet context will even be ready. You can use this initializer to do some programmatic servlet/filters/listeners addition (which is also possible in Servlets 3.0!). The ServletContainerInitializer....

March 20, 2011 · 2 min

Accessing web application resources from different context

You can access the resources which are available for one servlet context from the other. Let’s say you have two web applications deployed (in the same Servlet container): /myApp1 /myApp2 Basically, if you’re in /myApp1 and you will execute the getServletContext() method on ServletRequest object, it will return the ServletContext for the application related with this ServletRequest object (in this case – /myApp1). With the ServletContext object you can execute getResource(-) or getResourceAsStream(-) to get access to the needed resource from within the /myapp1 application....

January 27, 2011 · 2 min