I created a skeleton servlet sling like this ...
@SlingServlet(paths = "/bin/foo/bar", methods = "POST")
public class FooBarServlet extends SlingAllMethodsServlet {
private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
response.setHeader("Content-Type", "text/plain");
response.getWriter().write("foo bar");
LOGGER.info("hello world");
}
}
I created an editing configuration for my component
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:EditConfig">
<cq:listeners jcr:primaryType="cq:EditListenersConfig"
afteredit="myapp.components.foobar" />
</jcr:root>
I created cq:ClientLibraryFolderand added this js to it
var myapp = { components : {} };
myapp.components.foobar = function(component, reloadPage) {
var oncomplete = function(success) {
if (success) {
if (reloadPage) document.location.reload();
else component.refreshSelf();
} else
console.log('could not foobar on component ' + component.path);
};
CQ.HTTP.post('/bin/boo/bar', oncomplete, { path : component.path });
};
My page is loading, my components are loading, my clientlib js is loading, I do not see errors in the console. I edit my component and click OK. My servlet hit, I take the server side of the logs and see no errors. I see no errors on the client side when I open the console for tracking. My answer is 200 ok. All perfectly! Except that I keep getting "Unspecified Error" in the upper right corner of the browser

Does anyone know where I am even starting to fix this problem, given that I see no errors in the log on the server side and no errors on the client side?
Update
@rakhi4110 CQ.HTTP. -
, suppressErrorMsg
CQ.HTTP.post('/bin/foo/bar', oncomplete, { path : component.path }, null, true);
, , :
{
"headers" :
{
"Status":200,
"Message":"foo bar"
}
}
.
, CQ.HTTP api, , CQ.shared.HTTP. post , ,
CQ.shared.HTTP.post('/bin/foo/bar', oncomplete, { path : component.path });
№ 3, json.