on 2023 May 04 2:14 PM
Hi,
I need to use XSSFilterUtil from acceleratorstorefrontcommons in CustomController.java which is present in my customoccaddon. The customoccaddon is installed on commercewebservices extension. When I am triggering build getting following errors :
1. ERROR in D:\******\core-customize\hybris\bin\modules\commerce-services\commercewebservices\web\addonsrc\customoccaddon\com\*****\controllers\CustomController.java (at line 5)
import de.hybris.platform.acceleratorstorefrontcommons.util.XSSFilterUtil;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import de.hybris.platform.acceleratorstorefrontcommons.util cannot be resolved
----------
2. ERROR in D:\******\core-customize\hybris\bin\modules\commerce-services\commercewebservices\web\addonsrc\customoccaddon\com\*****\controllers\CustomController.java (at line 255)
XSSFilterUtil.filter(commentData.getText());
^^^^^^^^^^^^^
XSSFilterUtil cannot be resolved
----------
2 problems (2 errors)
Following Solutions I have tried till now and getting same error :
1- Adding acceleratorstorefrontcommons as required extension in extensionsinfo.xml in my customoccaddon.
2- Adding acceleratorstorefrontcommons to buildPath of customoccaddon [Just for resolving eclipse import issue].
3- Installing acceleratorstorefrontcommons addon on commercewebservices extension.
Creating custom XSSFilterUtil will work, but i want to use OOTB one. Please assist.
Request clarification before answering.
acceleratorstorefrontcommons is not an addon, so installing it will not work.
Adding it to requires extension of commercewebservices will not work either, because the class is located inside commonweb/src instead of web/src
Here's how to make OCC Controller/Add-on controller be able to access XSSFilterUtil (and other class in acceleratorstorefrontcommons/commonweb/src/)
<macrodef name="extensioncommercewebservices_before_build">
<sequential>
<echo message="extensioncommercewebservices_before_build"/>
<foreachext>
<do>
<if>
<available file="${ext.@{extname}.path}/commonweb"/>
<then>
<echo message="Found commonweb extension: @{extname}"/>
<copyCommonWebToExtension commonwebextension="@{extname}" commonwebresource="/src" target="extensioncommercewebservices"/>
</then>
</if>
</do>
</foreachext>
</sequential>
</macrodef>
Now controller of OCC extension can access class from acceleratorstorefrontcommons
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.