Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D81592009D9 for ; Wed, 18 May 2016 05:25:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D2FD3160A23; Wed, 18 May 2016 03:25:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0027F160A09 for ; Wed, 18 May 2016 05:25:17 +0200 (CEST) Received: (qmail 28523 invoked by uid 500); 18 May 2016 03:25:16 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 28510 invoked by uid 99); 18 May 2016 03:25:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 May 2016 03:25:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 12E27C0E1D for ; Wed, 18 May 2016 03:25:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.28 X-Spam-Level: * X-Spam-Status: No, score=1.28 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=poonam-org.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id DMbfHtH7zzMl for ; Wed, 18 May 2016 03:25:13 +0000 (UTC) Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id DC8985F239 for ; Wed, 18 May 2016 03:25:12 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id x19so56948560oix.2 for ; Tue, 17 May 2016 20:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poonam-org.20150623.gappssmtp.com; s=20150623; h=mime-version:date:message-id:subject:from:to; bh=lcPiv5RPbDwy0bJX1YC91KhXskFKE3nnowy8qVVgv2w=; b=cons2YIlcmKtnp7OHbX+7uPYI7fHChOAiyHuRDcS+mK7vhextSqKOsNhogeTTGxhwn A1MaLNC3qdIitddPOD0VVYSKeE8Edxm0rX2wrr28nt1zyJCpvO3V9aj02pao1NC05JXG oAMqZQc357uIlPBwksemPrK/2mWmztWq5OomLaqwG4WfEeDLTEyUb2kGeCn/IXXeXqcy yQnliBzISADbYVwQ6QNn0R8Jk/aQS5yeu02SGfQ8/GBJU6WuwYeLijeltu7Rq0HCTXDR wfNkcDlIAVMrFoWIG5eZ4AmbGCTqTjSGpRsm5Az8lHC8BBEDhh/r+r26DesrMuoO/Abf pIow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=lcPiv5RPbDwy0bJX1YC91KhXskFKE3nnowy8qVVgv2w=; b=XeMcKrTOsHdobFXR5dUABwux/ufQ3mq3Ox5I/MZphQth9ptyvXn3A0uDBEXkaZqAU2 UHFAQfnhuPyq/ex9mBxoGYVSbku1BcCEi229115iPKVxMfQJquHlM/Er8qGIQkFuvWxe 48h3PRsNgtkzJrZ9BGWIx2mL+EOz527AjYSX7XZLJWARtakYb9njKhYEVqdaISnlRvO7 kQ8btgydLV7MRhCGpWYFcvlhecCw3JHgBp03CR3qQvFSsM8lyG5sCaUdhdDLFF0t86oL t92GBslCZc7UiRHczHxH3mN1RxYMbQse7q1WIyIt4KfzpKvzA8Gah4yPZIYaymX1mtRM 3Zpg== X-Gm-Message-State: AOPr4FUyFW2zo+O4vgIi2z93iInwR7QMMwZkl9urk2tudOomXcKaTNqj8jaKrbf6+efEdLwYP+mzRiAutktVZQ== MIME-Version: 1.0 X-Received: by 10.202.107.148 with SMTP id g142mr2971054oic.38.1463541911614; Tue, 17 May 2016 20:25:11 -0700 (PDT) Received: by 10.202.215.6 with HTTP; Tue, 17 May 2016 20:25:11 -0700 (PDT) Date: Tue, 17 May 2016 23:25:11 -0400 Message-ID: Subject: request.getParameter and special characters - Apache Tomcat/7.0.57 on win 7 From: Kiran Badi To: Tomcat Users List Content-Type: multipart/alternative; boundary=001a11407b28c18f21053315675e archived-at: Wed, 18 May 2016 03:25:19 -0000 --001a11407b28c18f21053315675e Content-Type: text/plain; charset=UTF-8 Hi , I have this link in jsp which has below tags, <%@page contentType="text/html" pageEncoding="UTF-8"%> Testing and then my servlet looks like below, /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Kiran */ @WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"}) public class TestServlet extends HttpServlet { /** * Processes requests for both HTTP GET and POST * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ String param = request.getParameter("teststring"); String param1 = new String(request.getParameter("teststring").getBytes("UTF-8")); out.println(""); out.println(""); out.println(""); out.println("Servlet TestServlet"); out.println(""); out.println(""); out.println("

Servlet TestServlet at " + request.getContextPath() + "

"); out.println("

Servlet TestServlet at " + param + "

"); out.println("

Servlet TestServlet at " + param1 + "

"); out.println(""); out.println(""); } } // /** * Handles the HTTP GET method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP POST method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } } and getParameter for some reason seems to truncating the value after & Servlet TestServlet at testingServlet TestServlet at testing I really need to understand as what characters are accepted and what characters get truncated with getParameter. I am building few links on the fly which might have space,backslashes, comma and & characters in it.So wanted to understand should I encode it via js or container can take care of those for me. container connector setting has URIEncoding="UTF-8" settings. Thanking you Kiran Badi --001a11407b28c18f21053315675e--