I have a class annotated with @Path and in this class I have a method that handles a PUT request.
How can I do this?
@PUT
@Consumes(MediaType.TEXT_PLAIN)
public void putString(String myString) throws JMSException {
if (txtmessage != null && producer != null ){
txtmessage.clearBody();
txtmessage.setText(myString);
producer.send(txtmessage);
}
}
all the initialization is done
Does jersey let you handle on close events?
Implement the
ServletContextListener: http://tomcat.apache.org/tomcat-7.0-doc/servletapi/javax/servlet/ServletContextListener.html
Register the listener in web.xml:
and then the servlet (from where you use the producer and session):