本文整理匯總了Java中org.ofbiz.base.util.StringUtil.StringWrapper類的典型用法代碼示例。如果您正苦於以下問題:Java StringWrapper類的具體用法?Java StringWrapper怎麽用?Java StringWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StringWrapper類屬於org.ofbiz.base.util.StringUtil包,在下文中一共展示了StringWrapper類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: makeLoginUrl
import org.ofbiz.base.util.StringUtil.StringWrapper; //導入依賴的package包/類
public static StringWrapper makeLoginUrl(HttpServletRequest request, String requestName) {
Map<String, Object> urlParams = UtilHttp.getUrlOnlyParameterMap(request);
String queryString = UtilHttp.urlEncodeArgs(urlParams);
String currentView = UtilFormatOut.checkNull((String) request.getAttribute("_CURRENT_VIEW_"));
String loginUrl = "/" + requestName;
if ("login".equals(currentView)) {
return StringUtil.wrapString(loginUrl);
}
if (UtilValidate.isNotEmpty(currentView)) {
loginUrl += "/" + currentView;
}
if (UtilValidate.isNotEmpty(queryString)) {
loginUrl += "?" + queryString;
}
return StringUtil.wrapString(loginUrl);
}
示例2: makeProductUrl
import org.ofbiz.base.util.StringUtil.StringWrapper; //導入依賴的package包/類
public static String makeProductUrl(Delegator delegator, ProductContentWrapper wrapper,List<String> trail, String contextPath, String previousCategoryId, String productCategoryId, String productId) {
String url = "";
StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL");
if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(contextPath);
if (urlBuilder.length() == 0 || urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
urlBuilder.append("/");
}
// append alternative URL
url = UrlServletHelper.invalidCharacter(alternativeUrl.toString());
urlBuilder.append(url);
if (UtilValidate.isNotEmpty(productId)) {
urlBuilder.append("-");
urlBuilder.append(productId);
urlBuilder.append("-p");
}
url = urlBuilder.toString();
} else {
if(UtilValidate.isEmpty(trail)){
trail = FastList.newInstance();
}
url = CatalogUrlServlet.makeCatalogUrl(contextPath, trail, productId, productCategoryId, previousCategoryId);
}
return url;
}
示例3: makeProductUrl
import org.ofbiz.base.util.StringUtil.StringWrapper; //導入依賴的package包/類
public static String makeProductUrl(Delegator delegator, ProductContentWrapper wrapper,List<String> trail, String contextPath, String previousCategoryId, String productCategoryId, String productId) {
String url = "";
StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL");
if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(contextPath);
if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
urlBuilder.append("/");
}
// append alternative URL
url = UrlServletHelper.invalidCharacter(alternativeUrl.toString());
urlBuilder.append(url);
if (UtilValidate.isNotEmpty(productId)) {
urlBuilder.append("-");
urlBuilder.append(productId);
urlBuilder.append("-p");
}
url = urlBuilder.toString();
} else {
if(UtilValidate.isEmpty(trail)){
trail = FastList.newInstance();
}
url = CatalogUrlServlet.makeCatalogUrl(contextPath, trail, productId, productCategoryId, previousCategoryId);
}
return url;
}
示例4: makeCategoryUrl
import org.ofbiz.base.util.StringUtil.StringWrapper; //導入依賴的package包/類
public static String makeCategoryUrl(Delegator delegator, CategoryContentWrapper wrapper, List<String> trail, String contextPath, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) {
String url = "";
StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL");
if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(contextPath);
if (urlBuilder.length() == 0 || urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
urlBuilder.append("/");
}
// append alternative URL
url = UrlServletHelper.invalidCharacter(alternativeUrl.toString());
urlBuilder.append(url);
if (UtilValidate.isNotEmpty(productCategoryId)) {
urlBuilder.append("-");
urlBuilder.append(productCategoryId);
urlBuilder.append("-c");
}
// append view index
if (UtilValidate.isNotEmpty(viewIndex)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("viewIndex=" + viewIndex + "&");
}
// append view size
if (UtilValidate.isNotEmpty(viewSize)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("viewSize=" + viewSize + "&");
}
// append view sort
if (UtilValidate.isNotEmpty(viewSort)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("viewSort=" + viewSort + "&");
}
// append search string
if (UtilValidate.isNotEmpty(searchString)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("searchString=" + searchString + "&");
}
if (urlBuilder.toString().endsWith("&")) {
return urlBuilder.toString().substring(0, urlBuilder.toString().length()-1);
}
url = urlBuilder.toString();
} else {
if(UtilValidate.isEmpty(trail)){
trail = FastList.newInstance();
}
url = CatalogUrlServlet.makeCatalogUrl(contextPath, trail, productId, productCategoryId, previousCategoryId);
}
return url;
}
示例5: makeCategoryUrl
import org.ofbiz.base.util.StringUtil.StringWrapper; //導入依賴的package包/類
public static String makeCategoryUrl(Delegator delegator, CategoryContentWrapper wrapper, List<String> trail, String contextPath, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) {
String url = "";
StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL");
if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(contextPath);
if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') {
urlBuilder.append("/");
}
// append alternative URL
url = UrlServletHelper.invalidCharacter(alternativeUrl.toString());
urlBuilder.append(url);
if (UtilValidate.isNotEmpty(productCategoryId)) {
urlBuilder.append("-");
urlBuilder.append(productCategoryId);
urlBuilder.append("-c");
}
// append view index
if (UtilValidate.isNotEmpty(viewIndex)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("viewIndex=" + viewIndex + "&");
}
// append view size
if (UtilValidate.isNotEmpty(viewSize)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("viewSize=" + viewSize + "&");
}
// append view sort
if (UtilValidate.isNotEmpty(viewSort)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("viewSort=" + viewSort + "&");
}
// append search string
if (UtilValidate.isNotEmpty(searchString)) {
if (!urlBuilder.toString().endsWith("?") && !urlBuilder.toString().endsWith("&")) {
urlBuilder.append("?");
}
urlBuilder.append("searchString=" + searchString + "&");
}
if (urlBuilder.toString().endsWith("&")) {
return urlBuilder.toString().substring(0, urlBuilder.toString().length()-1);
}
url = urlBuilder.toString();
} else {
if(UtilValidate.isEmpty(trail)){
trail = FastList.newInstance();
}
url = CatalogUrlServlet.makeCatalogUrl(contextPath, trail, productId, productCategoryId, previousCategoryId);
}
return url;
}