List of usage examples for org.apache.commons.lang CharEncoding UTF_8
String UTF_8
To view the source code for org.apache.commons.lang CharEncoding UTF_8.
Click Source Link
Eight-bit Unicode Transformation Format.
From source file:com.fujitsu.dc.core.auth.AuthUtils.java
/** * ?Hash?./*from ww w .ja v a 2s . c o m*/ * @param passwd * @return ??? */ public static String hashPassword(final String passwd) { if (passwd == null) { return null; } // DC0 Ruby Code // Digest::SHA256.hexdigest(pw + "Password hash salt value") String str2hash = passwd + DcCoreConfig.getAuthPasswordSalt(); try { MessageDigest md = MessageDigest.getInstance(MD_ALGORITHM); byte[] digestBytes = md.digest(str2hash.getBytes(CharEncoding.UTF_8)); // ???????????DC0????????????? return DcCoreUtils.byteArray2HexString(digestBytes); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
From source file:io.personium.core.auth.AuthUtils.java
/** * ?Hash?.//from ww w.j a v a 2s. co m * @param passwd * @return ??? */ public static String hashPassword(final String passwd) { if (passwd == null) { return null; } // DC0 Ruby Code // Digest::SHA256.hexdigest(pw + "Password hash salt value") String str2hash = passwd + PersoniumUnitConfig.getAuthPasswordSalt(); try { MessageDigest md = MessageDigest.getInstance(MD_ALGORITHM); byte[] digestBytes = md.digest(str2hash.getBytes(CharEncoding.UTF_8)); // ???????????DC0????????????? return PersoniumCoreUtils.byteArray2HexString(digestBytes); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
From source file:net.jotel.ws.client.WebSocketKeepAliveThread.java
@Override public void run() { try {// w ww . j a va2s.co m while (true) { Thread.sleep(wsClient.getPingInterval()); // Ping wsClient.trySend(WebSocketClient.PING_OPCODE, new Date().toString().getBytes(Charset.forName(CharEncoding.UTF_8))); } } catch (InterruptedException e) { // ignore; } catch (IOException e) { if (wsClient.isReconnectEnabled()) { new WebSocketReconnectionThread(wsClient).start(); } } }
From source file:net.bulletin.pdi.xero.step.support.Helpers.java
/** * <p>If the value is provided then this method will augment the supplied URL by adding on the * query to the URL.</p>/* ww w . j a v a2 s . c om*/ */ public static StringBuilder appendUrlQuery(StringBuilder url, String key, String value) { if (null == url || 0 == url.length()) { throw new IllegalArgumentException("the supplied url may not be empty."); } if (StringUtils.isEmpty(key)) { throw new IllegalArgumentException("the supplied query key may not be empty."); } if (StringUtils.isNotBlank(value)) { url.append(-1 == url.indexOf("?") ? '?' : '&'); url.append(key); url.append("="); try { url.append(URLEncoder.encode(value, CharEncoding.UTF_8)); } catch (UnsupportedEncodingException uee) { throw new IllegalStateException("the encoding must be supported; " + CharEncoding.UTF_8); } } return url; }
From source file:net.sourceforge.fenixedu.util.tests.ResponseExternalization.java
private static Response getResponse(String xmlResponse) { XMLDecoder decoder = null;/*w ww.j av a 2 s. c o m*/ try { decoder = new XMLDecoder(new ByteArrayInputStream(xmlResponse.getBytes(CharEncoding.UTF_8))); } catch (UnsupportedEncodingException e1) { logger.error(e1.getMessage(), e1); } Response response = null; try { response = (Response) decoder.readObject(); } catch (ArrayIndexOutOfBoundsException e) { logger.error(e.getMessage(), e); } decoder.close(); return response; }
From source file:com.boyuanitsm.fort.config.ThymeleafConfiguration.java
@Bean @Description("Thymeleaf template resolver serving HTML 5 emails") public ClassLoaderTemplateResolver emailTemplateResolver() { ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver(); emailTemplateResolver.setPrefix("mails/"); emailTemplateResolver.setSuffix(".html"); emailTemplateResolver.setTemplateMode("HTML5"); emailTemplateResolver.setCharacterEncoding(CharEncoding.UTF_8); emailTemplateResolver.setOrder(1);// w w w. java 2 s . c o m return emailTemplateResolver; }
From source file:com.blacklocus.webapp.app.StaticResourceUTF8CharEncodingFilterHolder.java
public StaticResourceUTF8CharEncodingFilterHolder() { super(new Filter() { @Override//www . ja v a 2 s . c o m public void init(FilterConfig filterConfig) throws ServletException { // no-op } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { response.setCharacterEncoding(CharEncoding.UTF_8); chain.doFilter(request, response); } @Override public void destroy() { // no-op } }); }
From source file:blackboard.sonar.plugins.css.rules.BlackboardCssProfile.java
@Override public RulesProfile createProfile(ValidationMessages validation) { Reader reader = new InputStreamReader( BlackboardCssProfile.class.getClassLoader().getResourceAsStream(ALL_RULES), Charset.forName(CharEncoding.UTF_8)); try {/*w w w .j a v a 2 s. c o m*/ RulesProfile profile = profileParser.parse(reader, validation); profile.setDefaultProfile(true); return profile; } finally { IOUtils.closeQuietly(reader); } }
From source file:cn.cuizuoli.gotour.config.WebAppInitializer.java
@Override protected Filter[] getServletFilters() { CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter(); encodingFilter.setEncoding(CharEncoding.UTF_8); encodingFilter.setForceEncoding(true); return new Filter[] { encodingFilter, new CommonsRequestLoggingFilter(), new HiddenHttpMethodFilter() }; }
From source file:net.ageto.gyrex.impex.common.steps.impl.writers.FileWriter.java
@Override protected StatusStep process() { try {/* w ww . j a v a 2s . c o m*/ String filename = (String) getInputParam(FileWriterDefinition.InputParamNames.OUTPUT_FILENAME.name()); if (StringUtils.isBlank(filename)) { processError("{0} missing input.", ID); return StatusStep.ERROR; } StringBuffer content = (StringBuffer) getInputParam( FileWriterDefinition.InputParamNames.INPUT_CONTENT.name()); FileWriterWithEncoding fw = new FileWriterWithEncoding(new File(filename), CharEncoding.UTF_8); fw.write(content.toString()); fw.flush(); } catch (IOException e) { processError("File could not be created."); } processInfo("{0} has been completed successfully.", ID); return StatusStep.OK; }