/// <summary>Process a GET request for the specified resource.</summary>
        /// <param name="request">The servlet request we are processing</param>
        /// <param name="response">The servlet response we are creating</param>
        protected override void DoGet(HttpServletRequest request, HttpServletResponse response
                                      )
        {
            string      jsonpcb = null;
            PrintWriter writer  = null;

            try
            {
                if (!IsInstrumentationAccessAllowed(request, response))
                {
                    return;
                }
                JsonGenerator jg = null;
                try
                {
                    writer = response.GetWriter();
                    response.SetContentType("application/json; charset=utf8");
                    response.SetHeader(AccessControlAllowMethods, "GET");
                    response.SetHeader(AccessControlAllowOrigin, "*");
                    JsonFactory jsonFactory = new JsonFactory();
                    jg = jsonFactory.CreateJsonGenerator(writer);
                    jg.Disable(JsonGenerator.Feature.AutoCloseTarget);
                    jg.UseDefaultPrettyPrinter();
                    jg.WriteStartObject();
                    if (mBeanServer == null)
                    {
                        jg.WriteStringField("result", "ERROR");
                        jg.WriteStringField("message", "No MBeanServer could be found");
                        jg.Close();
                        Log.Error("No MBeanServer could be found.");
                        response.SetStatus(HttpServletResponse.ScNotFound);
                        return;
                    }
                    // query per mbean attribute
                    string getmethod = request.GetParameter("get");
                    if (getmethod != null)
                    {
                        string[] splitStrings = getmethod.Split("\\:\\:");
                        if (splitStrings.Length != 2)
                        {
                            jg.WriteStringField("result", "ERROR");
                            jg.WriteStringField("message", "query format is not as expected.");
                            jg.Close();
                            response.SetStatus(HttpServletResponse.ScBadRequest);
                            return;
                        }
                        ListBeans(jg, new ObjectName(splitStrings[0]), splitStrings[1], response);
                        jg.Close();
                        return;
                    }
                    // query per mbean
                    string qry = request.GetParameter("qry");
                    if (qry == null)
                    {
                        qry = "*:*";
                    }
                    ListBeans(jg, new ObjectName(qry), null, response);
                }
                finally
                {
                    if (jg != null)
                    {
                        jg.Close();
                    }
                    if (writer != null)
                    {
                        writer.Close();
                    }
                }
            }
            catch (IOException e)
            {
                Log.Error("Caught an exception while processing JMX request", e);
                response.SetStatus(HttpServletResponse.ScInternalServerError);
            }
            catch (MalformedObjectNameException e)
            {
                Log.Error("Caught an exception while processing JMX request", e);
                response.SetStatus(HttpServletResponse.ScBadRequest);
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }