List of usage examples for org.springframework.web.util WebUtils DEFAULT_CHARACTER_ENCODING
String DEFAULT_CHARACTER_ENCODING
To view the source code for org.springframework.web.util WebUtils DEFAULT_CHARACTER_ENCODING.
Click Source Link
From source file:com.contact.UrlUtil.java
public static String encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) { String enc = httpServletRequest.getCharacterEncoding(); if (enc == null) { enc = WebUtils.DEFAULT_CHARACTER_ENCODING; }/* www . jav a2s.c o m*/ try { pathSegment = UriUtils.encodePathSegment(pathSegment, enc); } catch (UnsupportedEncodingException uee) { // } return pathSegment; }
From source file:net.triptech.metahive.web.model.BaseFilter.java
/** * Encode the url path segment.//www .ja va 2s.c o m * * @param pathSegment the path segment * @return the string */ protected String encodeUrlPathSegment(String pathSegment) { if (StringUtils.isBlank(encoding)) { encoding = WebUtils.DEFAULT_CHARACTER_ENCODING; } try { pathSegment = UriUtils.encodePathSegment(pathSegment, encoding); } catch (UnsupportedEncodingException uee) { } return pathSegment; }
From source file:net.triptech.buildulator.web.BaseController.java
/** * Encode the url path segment./* w ww . j a v a 2 s.c o m*/ * * @param pathSegment the path segment * @param httpServletRequest the http servlet request * @return the string */ protected String encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) { String enc = httpServletRequest.getCharacterEncoding(); if (enc == null) { enc = WebUtils.DEFAULT_CHARACTER_ENCODING; } try { pathSegment = UriUtils.encodePathSegment(pathSegment, enc); } catch (UnsupportedEncodingException uee) { } return pathSegment; }
From source file:de.codecentric.boot.admin.zuul.filters.post.SendResponseFilterTests.java
private void runFilter(String characterEncoding, String content, boolean streamContent) throws Exception { MockHttpServletResponse response = new MockHttpServletResponse(); SendResponseFilter filter = createFilter(content, characterEncoding, response, streamContent); assertTrue("shouldFilter returned false", filter.shouldFilter()); filter.run();// www.ja v a 2s . c o m String encoding = RequestContext.getCurrentContext().getResponse().getCharacterEncoding(); String expectedEncoding = characterEncoding != null ? characterEncoding : WebUtils.DEFAULT_CHARACTER_ENCODING; assertThat("wrong character encoding", encoding, equalTo(expectedEncoding)); assertThat("wrong content", response.getContentAsString(), equalTo(content)); }
From source file:cn.clxy.studio.common.web.multipart.GFileUploadSupport.java
/** * Returns the default encoding.// w w w .ja v a 2 s. c o m * * @return the default encoding. */ protected String getDefaultEncoding() { String encoding = getFileUpload().getHeaderEncoding(); if (encoding == null) { encoding = WebUtils.DEFAULT_CHARACTER_ENCODING; } return encoding; }
From source file:org.cloudfoundry.tools.timeout.monitor.MonitoredHttpServletResponseWrapper.java
@Override public PrintWriter getWriter() throws IOException { String characterEncoding = getCharacterEncoding(); if (characterEncoding == null) { characterEncoding = WebUtils.DEFAULT_CHARACTER_ENCODING; }//from w ww . j a va 2 s.c o m Writer out = new OutputStreamWriter(getOutputStream(), characterEncoding); return new PrintWriter(out, true); }
From source file:com.jd.survey.web.security.AuthorityController.java
String encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) { log.info("encodeUrlPathSegment()"); try {/*from ww w .j a v a2 s.co m*/ String enc = httpServletRequest.getCharacterEncoding(); if (enc == null) { enc = WebUtils.DEFAULT_CHARACTER_ENCODING; } try { pathSegment = UriUtils.encodePathSegment(pathSegment, enc); } catch (UnsupportedEncodingException uee) { log.error(uee); } return pathSegment; } catch (Exception e) { log.error(e.getMessage(), e); throw (new RuntimeException(e)); } }
From source file:com.jd.survey.web.security.AccountController.java
/** * helper function for encoding paths //from w ww. j ava2 s. com * @param pathSegment * @param httpServletRequest * @return */ String encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) { log.info("encodeUrlPathSegment()"); try { String enc = httpServletRequest.getCharacterEncoding(); if (enc == null) { enc = WebUtils.DEFAULT_CHARACTER_ENCODING; } try { pathSegment = UriUtils.encodePathSegment(pathSegment, enc); } catch (UnsupportedEncodingException uee) { log.error(uee); } return pathSegment; } catch (Exception e) { log.error(e.getMessage(), e); throw (new RuntimeException(e)); } }
From source file:eu.dime.dnsregister.controllers.RecordsController.java
String encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) { String enc = httpServletRequest.getCharacterEncoding(); if (enc == null) { enc = WebUtils.DEFAULT_CHARACTER_ENCODING; }//from ww w . j a va2s. c o m try { pathSegment = UriUtils.encodePathSegment(pathSegment, enc); } catch (UnsupportedEncodingException uee) { } return pathSegment; }
From source file:org.finra.dm.ui.RequestLoggingFilterTest.java
/** * Test to get the coverage for unused implemented methods of RequestLoggingFilterWrapper. *//*from w ww. j av a 2 s. c o m*/ @Test public void testRequestLoggingFilterWrapper() throws Exception { HttpServletRequest servletRequest = createServletRequest(); servletRequest.setCharacterEncoding(WebUtils.DEFAULT_CHARACTER_ENCODING); RequestLoggingFilter requestLoggingFilter = new RequestLoggingFilter(); RequestLoggingFilter.RequestLoggingFilterWrapper wrapper = requestLoggingFilter.new RequestLoggingFilterWrapper( servletRequest); wrapper.getContentLength(); wrapper.getCharacterEncoding(); wrapper.getReader(); wrapper.getReader(); }