List of usage examples for javax.servlet.http HttpServletRequest setCharacterEncoding
public void setCharacterEncoding(String env) throws UnsupportedEncodingException;
From source file:CiudadesApp.Modelo.Parameter.GuardarCiudades_Parameter.java
public GuardarCiudades_Parameter(HttpServletRequest request) { try {/*from w w w .j a v a2 s .co m*/ request.setCharacterEncoding("UTF-8"); nombreCiudad = (String) request.getParameter("nombreCiudad"); descripcion = (String) request.getParameter("descripcion"); Part filePart = request.getPart("fileName"); InputStream in = filePart.getInputStream(); foto = IOUtils.toByteArray(in); } catch (UnsupportedEncodingException ex) { Logger.getLogger(GuardarCiudades_Parameter.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(GuardarCiudades_Parameter.class.getName()).log(Level.SEVERE, null, ex); } catch (ServletException ex) { Logger.getLogger(GuardarCiudades_Parameter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:org.messic.server.facade.controllers.SetCharacterEncodingInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { request.setCharacterEncoding(this.characterEncoding); return true;/* w w w.ja v a 2 s .co m*/ }
From source file:org.gbif.portal.web.filter.CriteriaUtil.java
/** * Fix the criteria values to can be understood by the database. Usually when one of them contain * characters with accents./* w w w . ja va 2s . c om*/ * * @param request * @param criteria * @throws UnsupportedEncodingException */ public static void fixEncoding(HttpServletRequest request, CriteriaDTO criteria) throws UnsupportedEncodingException { if (request.getCharacterEncoding() != "UTF-8") { for (int c = 0; c < criteria.size(); c++) { criteria.get(c).setValue(URLEncoder.encode(criteria.get(c).getValue(), "UTF-8")); criteria.get(c).setValue(URLDecoder.decode(criteria.get(c).getValue(), "UTF-8")); if (criteria.get(c).getDisplayValue() != null) { criteria.get(c).setDisplayValue(URLEncoder.encode(criteria.get(c).getDisplayValue(), "UTF-8")); criteria.get(c).setDisplayValue(URLDecoder.decode(criteria.get(c).getDisplayValue(), "UTF-8")); } request.setCharacterEncoding("UTF-8"); } } }
From source file:ua.aits.oblenergo_site.controller.SystemController.java
@RequestMapping(value = { "/system/users/add", "/system/users/add/" }) public ModelAndView addUser(HttpServletRequest request, HttpServletResponse response) throws Exception { request.setCharacterEncoding("UTF-8"); ModelAndView modelAndView = new ModelAndView("/system/users_add"); return modelAndView; }
From source file:com.googlecode.psiprobe.ProbeServlet.java
protected void doDispatch(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { httpServletRequest.setCharacterEncoding("UTF-8"); super.doDispatch(httpServletRequest, httpServletResponse); }
From source file:ua.aits.oblenergo_site.controller.AjaxAndFormController.java
@RequestMapping(value = { "/system/logout.do", "/archive/logout.do/" }) public ModelAndView logout(HttpServletRequest request, HttpServletResponse response) throws Exception { request.setCharacterEncoding("UTF-8"); HttpSession session = request.getSession(false); if (session != null) { session.invalidate();/*from w ww .ja v a 2 s . c om*/ } return new ModelAndView("redirect:" + "/system/login"); }
From source file:common.interceptors.MyInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { request.setCharacterEncoding(encoding); return true;//from ww w . j ava 2 s . c om }
From source file:net.testdriven.psiprobe.ProbeServlet.java
@Override protected void doDispatch(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { httpServletRequest.setCharacterEncoding("UTF-8"); super.doDispatch(httpServletRequest, httpServletResponse); }
From source file:com.sbu.controller.AddJobServlet.java
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); HttpSession session = request.getSession(); int id = Integer.parseInt(request.getParameter("id")); String username = request.getParameter("email"); Employer user = employerService.getEmployer(id); String name = user.getCompanyName(); Feed feed = new Feed(); feed.setEmployeridEmployer(user);/*from w ww . j a v a 2 s.co m*/ session.setAttribute("email", username); session.setAttribute("name", name); session.setAttribute("id", request.getParameter("id")); getServletContext().getRequestDispatcher("/AddJob.jsp").forward(request, response); }
From source file:org.siphon.jssp.JsspServlet.java
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); JsspRunner jsspRunner = (JsspRunner) this.getServletContext().getAttribute("jsspRunner"); jsspRunner.run(request, response);/*from w w w .j a va 2 s. c o m*/ }