示例#1
0
        protected override void doPost(HttpServletRequest request, HttpServletResponse response)
        {
            request.setCharacterEncoding("Shift_JIS");
            response.setContentType("text/plain; charset=Shift_JIS");
            StreamWriter output = response.getWriter();

            foreach (Part part in request.getParts())
            {
                output.WriteLine("name.." + part.getName());
                foreach (String headerName in part.getHeaderNames())
                {
                    output.WriteLine(headerName + "=" + part.getHeader(headerName));
                }
                output.WriteLine("Content-Type.." + part.getContentType());
                output.WriteLine("Name.." + part.getName() + "/size.." + part.getSize());
                StreamReader reader = new StreamReader(part.getInputStream(), Encoding.GetEncoding("Shift_JIS"));
                int          ch;
                while ((ch = reader.Read()) >= 0)
                {
                    output.Write((char)(ch & 0xffff));
                }
                reader.Close();
                output.WriteLine("\n==================================");
            }
            output.WriteLine("text_name=" + request.getParameter("text_name"));
        }
示例#2
0
        void LoadWwwForm()
        {
            HttpServletRequest servletReq = context.ServletRequest;

            if (servletReq == null)
            {
                NameValueCollection requestParameters = context.RequestParameters;
                if (requestParameters != null)
                {
                    form.Add(requestParameters);
                }
                else
                {
                    RawLoadWwwForm();
                }
                return;
            }

            servletReq.setCharacterEncoding(ContentEncoding.WebName);

            for (java.util.Enumeration e = servletReq.getParameterNames(); e.hasMoreElements();)
            {
                string    key     = (string)e.nextElement();
                string [] qvalue  = QueryString.GetValues(key);
                string [] qfvalue = servletReq.getParameterValues(key);

                for (int i = (qvalue != null) ? qvalue.Length : 0; i < qfvalue.Length; i++)
                {
                    form.Add(key, qfvalue [i]);
                }
            }
        }
示例#3
0
 protected override void doPost(HttpServletRequest request, HttpServletResponse response)
 {
     request.setCharacterEncoding("UTF-8");
     Message.Message newMessage = new Message.Message(request.getParameter("title"),
                                                      request.getParameter("handle"),
                                                      request.getParameter("message"));
     newMessage.date = DateTime.Now;
     Message.Message.messageList.Insert(0, newMessage);
     response.sendRedirect("/testbbs/ShowBBS");
 }