Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
        protected internal override void doGet(HttpServletRequest req, HttpServletResponse resp)
        {
            LOG.debug("Resource GET REQUEST ========= " + req.ToString());
            string uri       = sanitise(req.RequestURI);
            string id        = getId(uri);
            string type      = getType(uri);
            string extension = getExtension(uri);

            echoHeader(req, resp);
            echoQString(req, resp);
            try
            {
                if (string.ReferenceEquals(id, null))
                {
                    list(resp, type, extension);
                    headers(resp, extension, DEF_CHARSET);
                }
                else if (resources.get(type, id) == null)
                {
                    notFound(resp);
                }
                else
                {
                    if (resources.get(type, id).Deleted)
                    {
                        notFound(resp);
                    }
                    else
                    {
                        found(resp, type, id);
                        headers(resp, extension, DEF_CHARSET);
                    }
                }
            }
            catch (Exception)
            {
                resp.sendError(HttpServletResponse.SC_BAD_REQUEST);
            }
            finally
            {
                LOG.debug("Resource GET RESPONSE ========= " + resp.ToString());
            }
        }