/// <summary><inheritDoc/></summary> /// <exception cref="Javax.Servlet.ServletException"/> /// <exception cref="System.IO.IOException"/> protected override void DoGet(IHttpServletRequest request, IHttpServletResponse response) { logger.Info("GET SPIED query from " + request.GetRemoteAddr()); if (request.GetCharacterEncoding() == null) { request.SetCharacterEncoding("utf-8"); } response.SetContentType("text/json; charset=UTF-8"); PrintWriter @out = response.GetWriter(); try { string raw = request.GetParameter("q"); string seedwords = request.GetParameter("seedwords"); string model = request.GetParameter("model"); if (raw == null || string.Empty.Equals(raw)) { @out.Print("{\"okay\":false,\"reason\":\"No data provided\"}"); } else { Run(@out, raw, seedwords, model); } } catch (Exception t) { WriteError(t, @out, request.ToString()); } @out.Close(); }
/// <exception cref="Javax.Servlet.ServletException"/> /// <exception cref="System.IO.IOException"/> protected override void DoGet(IHttpServletRequest request, IHttpServletResponse response) { if (request.GetCharacterEncoding() == null) { request.SetCharacterEncoding("utf-8"); } response.SetContentType("text/html; charset=UTF-8"); this.GetServletContext().GetRequestDispatcher("/header.jsp").Include(request, response); AddResults(request, response); this.GetServletContext().GetRequestDispatcher("/footer.jsp").Include(request, response); }
/// <summary><inheritDoc/></summary> /// <exception cref="Javax.Servlet.ServletException"/> /// <exception cref="System.IO.IOException"/> protected override void DoGet(IHttpServletRequest request, IHttpServletResponse response) { if (request.GetCharacterEncoding() == null) { request.SetCharacterEncoding("utf-8"); } response.SetContentType("text/json; charset=UTF-8"); PrintWriter @out = response.GetWriter(); string raw = request.GetParameter("q"); if (raw == null || string.Empty.Equals(raw)) { @out.Println("{ok:false, entailments:[], triples=[], msg=\"\"}"); } else { DoGet(@out, raw); } @out.Close(); }