Auto-Registering in the Servlet Mode

The following example shows how the TeaAgentServlet can be configured to auto-register itself.
public class HelloWorldAgentServlet extends TeaAgentServlet{
	private static final long serialVersionUID = 8327019718482894467L;
 
	@Override
	public void init() throws ServletException {
		super.init();
this.autoRegisterAgent("http://localhost:8777", "http://localhost:8080");
	}
 
	@Override
	protected Object[] getObjectInstances() throws ServletException {
		return new Object[] {new HelloWorld()};
	}
}
After making a call to the init method in the super class of TeaAgentServlet, call thecom.tibco.tea.agent.server.TeaAgentServlet.autoRegisterAgent() method.
Note: The com.tibco.tea.agent.server.TeaAgentServlet.autoRegisterAgent() must be the last line in the code for the class. You cannot call any other method such as the unregisterAgent() method after this line.