Search in sources :

Example 1 with Dataset

use of uk.nhs.digital.ps.beans.Dataset in project hippo by NHS-digital-website.

the class DatasetComponent method doBeforeRender.

@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
    super.doBeforeRender(request, response);
    final HstRequestContext ctx = request.getRequestContext();
    Dataset dataset = (Dataset) ctx.getContentBean();
    if (!dataset.isPubliclyAccessible()) {
        try {
            response.forward("/error/404");
        } catch (IOException ioException) {
            throw new HstComponentException("forward failed", ioException);
        }
        return;
    }
    request.setAttribute("dataset", dataset);
}
Also used : Dataset(uk.nhs.digital.ps.beans.Dataset) IOException(java.io.IOException) HstComponentException(org.hippoecm.hst.core.component.HstComponentException) HstRequestContext(org.hippoecm.hst.core.request.HstRequestContext)

Aggregations

IOException (java.io.IOException)1 HstComponentException (org.hippoecm.hst.core.component.HstComponentException)1 HstRequestContext (org.hippoecm.hst.core.request.HstRequestContext)1 Dataset (uk.nhs.digital.ps.beans.Dataset)1