404 error for Product Details page resourceapi

Hi Team,

I have requirement to return 404 error(Not 404 page configured with any to provide pageNotFound content) for Product Details pages when a document is not found under the folder of list of Product’s documents through resourceapi.
Right now I get 200 response with only component details without document data.

Thank you

Hello, this depends on how your sitemap is set up so might need a bit more detail here, but if you have a component that looks up documents, and you want to set 404 on the request if the document is not found, then take a look at org.onehippo.cms7.essentials.components.CommonComponent#setContentBeanWith404() method.

You can still have a document to your 404 page, if you want to return 404 error, try this:
response.setStatus(HttpServletResponse.SC_NOT_FOUND);