How to List Alert Definitions with the RHQ REST API


import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.glassfish.jersey.client.filter.EncodingFeature;
import org.glassfish.jersey.message.GZipEncoder;

@WebServlet(name = "SampleRhqServlet", value = "/")
public final class SampleRhqServlet extends HttpServlet {

  protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) {
    final Client client = ClientBuilder.newClient();

    client.register(new EncodingFeature(GZipEncoder.class));
    client.register(HttpAuthenticationFeature.basic("rhqadmin", "rhqadmin"));

    final Response res ="http://localhost:7080/rest/1/alert/definition.xml").get();

    final InputStream in = res.readEntity(InputStream.class);




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s