本文整理匯總了Java中org.springframework.web.util.UriUtils.encodePathSegment方法的典型用法代碼示例。如果您正苦於以下問題:Java UriUtils.encodePathSegment方法的具體用法?Java UriUtils.encodePathSegment怎麽用?Java UriUtils.encodePathSegment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.web.util.UriUtils
的用法示例。
在下文中一共展示了UriUtils.encodePathSegment方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
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));
}
}
示例2: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
/**
* helper function for encoding paths
* @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));
}
}
示例3: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
/**
* Helper method that encodes a string
* @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));
}
}
示例4: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
/**
* Encodes a string path suing the httpServletRequest Character Encoding
* @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));
}
}
示例5: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
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;
}
示例6: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
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;
}
示例7: encodePathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
private String encodePathSegment(final String pathSegment) {
try {
return UriUtils.encodePathSegment(pathSegment, "UTF-8");
} catch (UnsupportedEncodingException e) {
// the best we can do without messing up all caller signatures :/ MK.
return pathSegment;
}
}
示例8: encodePathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
private static String encodePathSegment(String pathSegment)
{
try
{
return UriUtils.encodePathSegment(pathSegment, UTF_8.name());
}
catch (UnsupportedEncodingException e)
{
throw new MolgenisRuntimeException(e);
}
}
示例9: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
protected String encodeUrlPathSegment(String pathSegment, HttpServletRequest request) {
String enc = request.getCharacterEncoding();
if (enc == null) {
enc = WebUtils.DEFAULT_CHARACTER_ENCODING;
}
try {
pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
}
catch (UnsupportedEncodingException uee) {}
return pathSegment;
}
示例10: encodeUrlPathSegment
import org.springframework.web.util.UriUtils; //導入方法依賴的package包/類
public static String encodeUrlPathSegment(String pathSegment, HttpServletRequest request)
{
String enc = request.getCharacterEncoding();
if (enc == null) {
enc = WebUtils.DEFAULT_CHARACTER_ENCODING;
}
try {
pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
}
catch (UnsupportedEncodingException uee) {}
return pathSegment;
}