示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            SpellCheckerInput  input       = SpellCheckerInput.Parse(new StreamReader(context.Request.InputStream));
            SpellCheckerResult suggestions = null;

            switch (input.Method)
            {
            case "checkWords":
                suggestions = CheckWords(input.Language, input.Words.ToArray());
                break;

            case "getSuggestions":
                suggestions = GetSuggestions(input.Language, input.Words[0]);
                break;

            default:
                suggestions = new SpellCheckerResult();
                break;
            }

            suggestions.id = input.Id;
            JavaScriptSerializer ser = new JavaScriptSerializer();
            var res = ser.Serialize(suggestions);

            context.Response.Write(res);
        }