本文介绍了如何规范Hybris中的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在用户界面中搜索类别和产品时,我的URL看起来像
When I search categories and products in User Interface, my URL looks broken like
�, // c//p/010
如何摆脱这些字符?
Hybris中有任何现成的解决方案吗?
how can I get rid of this characters?
Is there any out of box solution in Hybris?
推荐答案
Hybris在类别,产品和内容页面URL中做了很多转义特殊字符.为此,请考虑de.hybris.platform.commerceservices.url.impl.AbstractUrlResolver和所有子类.
Hybris does a lot of escaping special characters in category and product and content page URLs. Consider de.hybris.platform.commerceservices.url.impl.AbstractUrlResolver and all subclasses for that purpose.
最常见的是:
- DefaultCategoryModelUrlResolver
- DefaultProductModelUrlResolver
- DefaultContentPageUrlResolver
像这样使用它们:
...
@Resource(name = "productModelUrlResolver")
private UrlResolver<ProductModel> productModelUrlResolver;
...
ProductModel product = productService.getProductForCode("myProduct");
String url = productModelUrlResolver.resolve(product);
这篇关于如何规范Hybris中的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!