本文整理匯總了Java中net.sourceforge.subsonic.util.StringUtil.utf8HexEncode方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtil.utf8HexEncode方法的具體用法?Java StringUtil.utf8HexEncode怎麽用?Java StringUtil.utf8HexEncode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.sourceforge.subsonic.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.utf8HexEncode方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encode
import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
private String encode(String s) throws UnsupportedEncodingException {
if (isUtf8Hex()) {
if (isAsciiAlphaNumeric(s)) {
return s;
}
try {
return StringUtil.utf8HexEncode(s);
} catch (Exception x) {
LOG.error("Failed to utf8hex-encode the string '" + s + "'.", x);
return s;
}
}
return URLEncoder.encode(s, encoding);
}
示例2: handleRequestInternal
import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
Player player = playerService.getPlayer(request, response);
List<TransferStatus> statuses = statusService.getStreamStatusesForPlayer(player);
MediaFile current = statuses.isEmpty() ? null : mediaFileService.getMediaFile(statuses.get(0).getFile());
MediaFile dir = current == null ? null : mediaFileService.getParentOf(current);
String url;
if (dir != null && !mediaFileService.isRoot(dir)) {
url = "main.view?path" + ParameterDecodingFilter.PARAM_SUFFIX + "=" +
StringUtil.utf8HexEncode(dir.getPath()) + "&updateNowPlaying=true";
} else {
url = "home.view";
}
return new ModelAndView(new RedirectView(url));
}
示例3: encrypt
import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
private static String encrypt(String s) {
if (s == null) {
return null;
}
try {
return "enc:" + StringUtil.utf8HexEncode(s);
} catch (Exception e) {
return s;
}
}
示例4: getPlayerIdFromCookie
import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
/**
* Reads the player ID from the cookie in the HTTP request.
*
* @param request The HTTP request.
* @param username The name of the current user.
* @return The player ID embedded in the cookie, or <code>null</code> if cookie is not present.
*/
private String getPlayerIdFromCookie(HttpServletRequest request, String username) {
Cookie[] cookies = request.getCookies();
if (cookies == null) {
return null;
}
String cookieName = COOKIE_NAME + "-" + StringUtil.utf8HexEncode(username);
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
return StringUtils.trimToNull(cookie.getValue());
}
}
return null;
}
示例5: setLdapManagerPassword
import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
public void setLdapManagerPassword(String ldapManagerPassword) {
try {
ldapManagerPassword = StringUtil.utf8HexEncode(ldapManagerPassword);
} catch (Exception x) {
LOG.warn("Failed to encode LDAP manager password.", x);
}
properties.setProperty(KEY_LDAP_MANAGER_PASSWORD, ldapManagerPassword);
}
示例6: getPlayerIdFromCookie
import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
/**
* Reads the player ID from the cookie in the HTTP request.
*
* @param request The HTTP request.
* @param username The name of the current user.
* @return The player ID embedded in the cookie, or <code>null</code> if cookie is not present.
*/
private String getPlayerIdFromCookie(HttpServletRequest request, String username) {
Cookie[] cookies = request.getCookies();
if (cookies == null) {
return null;
}
String cookieName = COOKIE_NAME + "-" + StringUtil.utf8HexEncode(username);
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
return cookie.getValue();
}
}
return null;
}