package nl.iprofs.components;
import org.hippoecm.hst.component.support.bean.BaseHstComponent;
import org.hippoecm.hst.content.beans.standard.HippoBean;
import org.hippoecm.hst.core.component.HstComponentException;
import org.hippoecm.hst.core.component.HstRequest;
import org.hippoecm.hst.core.component.HstResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Detail extends BaseHstComponent {
public static final Logger log = LoggerFactory.getLogger(Detail.class);
@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
HippoBean doc = getContentBean(request);
if (doc == null) {
log.warn("Did not find a content bean for relative content path '{}' for pathInfo '{}'",
request.getRequestContext().getResolvedSiteMapItem().getRelativeContentPath(),
request.getRequestContext().getResolvedSiteMapItem().getPathInfo());
response.setStatus(404);
return;
}
request.setAttribute("document",doc);
}
}