當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtil.utf8HexEncode方法代碼示例

本文整理匯總了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);
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:17,代碼來源:UrlTag.java

示例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));
}
 
開發者ID:FutureSonic,項目名稱:FutureSonic-Server,代碼行數:20,代碼來源:NowPlayingController.java

示例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;
    }
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:11,代碼來源:UserDao.java

示例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;
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:21,代碼來源:PlayerService.java

示例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);
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:9,代碼來源:SettingsService.java

示例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;
}
 
開發者ID:FutureSonic,項目名稱:FutureSonic-Server,代碼行數:21,代碼來源:PlayerService.java


注:本文中的net.sourceforge.subsonic.util.StringUtil.utf8HexEncode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。