Compilando un servlet independientemente de un contenedor: ¿fuente del servlet-api 'oficial'?

I've come back to building web applications after a couple of years and realised I've never once compiled a servlet without depending on whatever container I happen to be using.

I can of course carry on doing that, but I'd still prefer some kind of 'official' servlet api JAR.

Encontré uno aquí:

But what I don't understand is how that got there? It's odd that it's not a group id starting with com.sun or

The only other official method I can think of is depending on the Glassfish implementation?

Muchas Gracias

preguntado el 31 de julio de 12 a las 10:07

2 Respuestas

"javax.servlet" is actually the official Sun/Oracle groupId for the "Java Extensions", hence javax. "com.sun" is used for all the internal nitty gritty implementations.

Respondido 31 Jul 12, 10:07

The servlet-api.jar on Maven contains only the interfaces and abstract classes of the publically-defined interface. There are no method implementations there and it is trivial to verify that the classes and method signatures are correct. That is all that is necessary to compile against. (Running of course is another matter, and you need an actual implementation provided by a servlet container).

com.sun and packages generally contain "offical" implementaciones of the standard APIs, where the standard class library does not already include them.

tl; dr: is absolutely fine to use for compiling against.

Respondido 24 ago 12, 23:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.