本文整理汇总了Java中org.ofbiz.webapp.website.WebSiteWorker类的典型用法代码示例。如果您正苦于以下问题:Java WebSiteWorker类的具体用法?Java WebSiteWorker怎么用?Java WebSiteWorker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebSiteWorker类属于org.ofbiz.webapp.website包,在下文中一共展示了WebSiteWorker类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDescriptors
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public static Map<String, Object> getDescriptors(DispatchContext dctx, Map<String, ?> context) {
Map<String, Object> result = ServiceUtil.returnSuccess();
Delegator delegator = dctx.getDelegator();
String webSiteId = WebSiteWorker.getWebSiteId((ServletRequest) context.get("request"));
List<CmsPageTemplate> pageTemplates = CmsPageTemplate.getWorker().findAll(delegator, UtilMisc.toMap("webSiteId", webSiteId),
UtilMisc.toList("templateName ASC"), false);
result.put("pageTemplates", pageTemplates);
List<CmsAssetTemplate> assetTemplates = CmsAssetTemplate.getWorker().findAll(delegator, UtilMisc.toMap("webSiteId", webSiteId),
UtilMisc.toList("templateName ASC"), false);
result.put("assetTemplates", assetTemplates);
List<CmsPage> pages = CmsPage.getWorker().findAll(delegator, UtilMisc.toMap("webSiteId", webSiteId), UtilMisc.toList("pageName ASC"), false);
result.put("pages", pages);
return result;
}
示例2: appendContentPrefix
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
/**
* Appends content prefix to buffer.
* <p>
* SCIPIO: Modified to support an explicit webSiteId
*/
public static void appendContentPrefix(HttpServletRequest request, Appendable urlBuffer, String webSiteId) throws IOException {
if (request == null) {
Debug.logWarning("Request was null in appendContentPrefix; this probably means this was used where it shouldn't be, like using ofbizContentUrl in a screen rendered through a service; using best-bet behavior: standard prefix from url.properties (no WebSite or security setting known)", module);
String prefix = UtilProperties.getPropertyValue("url", "content.url.prefix.standard");
if (prefix != null) {
urlBuffer.append(prefix.trim());
}
return;
}
// SCIPIO: if webSiteId, get that specific one
//GenericValue webSite = WebSiteWorker.getWebSite(request);
GenericValue webSite;
if (webSiteId != null && webSiteId.length() > 0) {
webSite = WebSiteWorker.findWebSite((Delegator) request.getAttribute("delegator"), webSiteId);
} else {
webSite = WebSiteWorker.getWebSite(request);
}
// SCIPIO: 2017-11-18: Factored out dispersed secure checks into RequestLinkUtil:
appendContentPrefix(webSite, RequestLinkUtil.isEffectiveSecure(request), urlBuffer);
}
示例3: getProductConfigWrapper
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public static ProductConfigWrapper getProductConfigWrapper(String productId, String currencyUomId, HttpServletRequest request) {
ProductConfigWrapper configWrapper = null;
String catalogId = CatalogWorker.getCurrentCatalogId(request);
String webSiteId = WebSiteWorker.getWebSiteId(request);
String productStoreId = ProductStoreWorker.getProductStoreId(request);
GenericValue autoUserLogin = (GenericValue)request.getSession().getAttribute("autoUserLogin");
try {
/* caching: there is one cache created, "product.config" Each product's config wrapper is cached with a key of
* productId::catalogId::webSiteId::currencyUomId, or whatever the SEPARATOR is defined above to be.
*/
String cacheKey = productId + SEPARATOR + productStoreId + SEPARATOR + catalogId + SEPARATOR + webSiteId + SEPARATOR + currencyUomId;
configWrapper = productConfigCache.get(cacheKey);
if (configWrapper == null) {
configWrapper = new ProductConfigWrapper((Delegator)request.getAttribute("delegator"),
(LocalDispatcher)request.getAttribute("dispatcher"),
productId, productStoreId, catalogId, webSiteId,
currencyUomId, UtilHttp.getLocale(request),
autoUserLogin);
configWrapper = productConfigCache.putIfAbsentAndGet(cacheKey, new ProductConfigWrapper(configWrapper));
} else {
configWrapper = new ProductConfigWrapper(configWrapper);
}
} catch (ProductConfigWrapperException we) {
configWrapper = null;
} catch (Exception e) {
Debug.logWarning(e.getMessage(), module);
}
return configWrapper;
}
示例4: getProductStoreId
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public static String getProductStoreId(ServletRequest request) {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpSession session = httpRequest.getSession(false);
if (session != null && session.getAttribute("productStoreId") != null) {
return (String) session.getAttribute("productStoreId");
} else {
GenericValue webSite = WebSiteWorker.getWebSite(httpRequest);
if (webSite != null) {
String productStoreId = webSite.getString("productStoreId");
// might be nice to do this, but not needed and has a problem with dependencies: setSessionProductStore(productStoreId, httpRequest);
return productStoreId;
}
}
return null;
}
示例5: makeCategoryUrl
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public String makeCategoryUrl(HttpServletRequest request, Locale locale, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
List<String> trail = CategoryWorker.getTrail(request);
return makeCategoryUrl(delegator, dispatcher, locale, trail,
WebSiteWorker.getWebSiteId(request), request.getContextPath(), CatalogWorker.getCurrentCatalogId(request),
previousCategoryId, productCategoryId, productId, viewSize, viewIndex, viewSort, searchString);
}
示例6: makeProductUrl
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public String makeProductUrl(HttpServletRequest request, Locale locale, String previousCategoryId, String productCategoryId, String productId) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
List<String> trail = CategoryWorker.getTrail(request);
return makeProductUrl(delegator, dispatcher, locale, trail,
WebSiteWorker.getWebSiteId(request), request.getContextPath(), CatalogWorker.getCurrentCatalogId(request),
previousCategoryId, productCategoryId, productId);
}
示例7: WebShoppingCart
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public WebShoppingCart(HttpServletRequest request, Locale locale, String currencyUom) {
// for purchase orders, bill to customer partyId must be set - otherwise, no way to know who we're purchasing for. supplierPartyId is furnished
// by order manager for PO entry.
// TODO: refactor constructor and the getCartObject method which calls them to multiple constructors for different types of orders
super((Delegator)request.getAttribute("delegator"), ProductStoreWorker.getProductStoreId(request),
WebSiteWorker.getWebSiteId(request), (locale != null ? locale : ProductStoreWorker.getStoreLocale(request)),
(currencyUom != null ? currencyUom : ProductStoreWorker.getStoreCurrencyUomId(request)),
request.getParameter("billToCustomerPartyId"),
(request.getParameter("supplierPartyId") != null ? request.getParameter("supplierPartyId") : request.getParameter("billFromVendorPartyId")));
HttpSession session = request.getSession(true);
this.userLogin = (GenericValue) session.getAttribute("userLogin");
this.autoUserLogin = (GenericValue) session.getAttribute("autoUserLogin");
this.orderPartyId = (String) session.getAttribute("orderPartyId");
}
示例8: getWebSiteIdForControl
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
/**
* Special webSiteId lookup for filters which may run early in a chain; in this case,
* WebSiteWorker.getWebSiteId(request) may not return a value.
* May also be useful elsewhere (view handler, just in case).
*/
public static String getWebSiteIdForControl(HttpServletRequest request, ServletContext servletContext) {
// Try WebSiteWorker first
String webSiteId = WebSiteWorker.getWebSiteId(request);
if (UtilValidate.isEmpty(webSiteId) && servletContext != null) {
webSiteId = (String) servletContext.getAttribute("webSiteId");
}
return webSiteId;
}
示例9: makeFromRequestContext
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
private static CmsPageContext makeFromRequestContext(Map<String, ?> context, RendererType rendererType) {
HttpServletRequest request = (HttpServletRequest) context.get("request");
HttpServletResponse response = (HttpServletResponse) context.get("response");
ServletContext servletContext = request.getServletContext();
boolean preview = Boolean.TRUE.equals(context.get("cmsIsPreview"));
String webSiteId = WebSiteWorker.getWebSiteId(request);
return new CmsPageContext(request, response, servletContext, webSiteId, preview, rendererType);
}
示例10: appendContentPrefix
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public static void appendContentPrefix(HttpServletRequest request, Appendable urlBuffer) throws IOException {
if (request == null) {
Debug.logWarning("WARNING: request was null in appendContentPrefix; this probably means this was used where it shouldn't be, like using ofbizContentUrl in a screen rendered through a service; using best-bet behavior: standard prefix from url.properties (no WebSite or security setting known)", module);
String prefix = UtilProperties.getPropertyValue("url", "content.url.prefix.standard");
if (prefix != null) {
urlBuffer.append(prefix.trim());
}
return;
}
GenericValue webSite = WebSiteWorker.getWebSite(request);
String forwardedProto = request.getHeader("X-Forwarded-Proto");
boolean isForwardedSecure = UtilValidate.isNotEmpty(forwardedProto) && "HTTPS".equals(forwardedProto.toUpperCase());
boolean isSecure = request.isSecure() || isForwardedSecure;
appendContentPrefix(webSite, isSecure, urlBuffer);
}
示例11: getWebSiteId
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
/**
* @deprecated - Use WebSiteWorker.getWebSiteId(ServletRequest) instead
*/
@Deprecated
public static String getWebSiteId(ServletRequest request) {
return WebSiteWorker.getWebSiteId(request);
}
示例12: getWebSite
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
/**
* @deprecated - Use WebSiteWorker.getWebSite(ServletRequest) instead
*/
@Deprecated
public static GenericValue getWebSite(ServletRequest request) {
return WebSiteWorker.getWebSite(request);
}
示例13: matchInboundSeoCatalogUrl
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public SeoCatalogUrlInfo matchInboundSeoCatalogUrl(HttpServletRequest request, Delegator delegator, String matchablePath) {
return urlWorker.matchInboundSeoCatalogUrl(delegator, matchablePath, request.getContextPath(),
WebSiteWorker.getWebSiteId(request), CatalogWorker.getCurrentCatalogId(request));
}
示例14: createOrder
import org.ofbiz.webapp.website.WebSiteWorker; //导入依赖的package包/类
public static String createOrder(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
Delegator delegator = (Delegator) request.getAttribute("delegator");
GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
Map<String, Object> callResult;
if (UtilValidate.isEmpty(userLogin)) {
userLogin = cart.getUserLogin();
session.setAttribute("userLogin", userLogin);
}
// remove this whenever creating an order so quick reorder cache will refresh/recalc
session.removeAttribute("_QUICK_REORDER_PRODUCTS_");
boolean areOrderItemsExploded = explodeOrderItems(delegator, cart);
//get the TrackingCodeOrder List
List<GenericValue> trackingCodeOrders = TrackingCodeEvents.makeTrackingCodeOrders(request);
String distributorId = (String) session.getAttribute("_DISTRIBUTOR_ID_");
String affiliateId = (String) session.getAttribute("_AFFILIATE_ID_");
String visitId = VisitHandler.getVisitId(session);
String webSiteId = WebSiteWorker.getWebSiteId(request);
callResult = checkOutHelper.createOrder(userLogin, distributorId, affiliateId, trackingCodeOrders, areOrderItemsExploded, visitId, webSiteId);
if (callResult != null) {
ServiceUtil.getMessages(request, callResult, null);
if (ServiceUtil.isError(callResult)) {
// messages already setup with the getMessages call, just return the error response code
return "error";
}
if (callResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_SUCCESS)) {
// set the orderId for use by chained events
String orderId = cart.getOrderId();
request.setAttribute("orderId", orderId);
request.setAttribute("orderAdditionalEmails", cart.getOrderAdditionalEmails());
}
}
String issuerId = request.getParameter("issuerId");
if (UtilValidate.isNotEmpty(issuerId)) {
request.setAttribute("issuerId", issuerId);
}
return cart.getOrderType().toLowerCase();
}