In portalLib you have getContent and getComponent that is usable anywhere inside an execution context. I’m trying to get something similar for the request object that is passed to the initial get
entry function. This is so to avoid having to always pass req as a function param everywhere. A function may get req as a param when it is only used by a function a lot further down the chain.
This java class almost does the job:
import com.enonic.xp.script.bean.BeanContext;
import com.enonic.xp.script.bean.ScriptBean;
import com.enonic.xp.portal.PortalRequest;
import com.enonic.xp.portal.impl.mapper.PortalRequestMapper;
public final class Request implements ScriptBean {
private PortalRequest request;
public PortalRequestMapper getRequest( ) {
final PortalRequestMapper requestMapper = new PortalRequestMapper( request );
return requestMapper;
}
@Override
public void initialize( final BeanContext context )
{
this.request = context.getBinding( PortalRequest.class ).get();
}
}
But it is dependent on the PortalRequestMapper from impl. Is there another way to do this except using PortalRequestMapper?
This can also be considered a feature request for a getRequest function in portal lib.