On my reference app module, I have a get controller:
public void get(PageModel pageModel,HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @RequestParam("patientId") Patient patient, @RequestParam(value="visitId", required = false) Visit visit, ){....
The issue is: the httpServletResponse always return null inside this controller. I have tried several things, and still, it remains thesame. Is there any suggested work-around for this?
Thanks.
darius
(Darius Jazayeri)
March 11, 2016, 2:21pm
2
According to the documentation , this is not (currently) supported.
You should be able to add support for this within the UI Framework module with one-liners at these points in the code:
return output;
}
/**
* Invokes the appropriate method on the controller to handle this page request
*
* NB. If you change the supported parameter classes, make sure to update the documentation on the wiki
* @param context the page context
* @return the controller output
* @throws PageAction
*/
private Object handleRequestWithController(PageContext context) throws PageAction {
Map<Class<?>, Object> possibleArguments = new HashMap<Class<?>, Object>();
possibleArguments.put(PageContext.class, context);
possibleArguments.put(PageModel.class, context.getModel());
possibleArguments.put(Model.class, context.getModel());
possibleArguments.put(Map.class, context.getModel());
possibleArguments.put(PageRequest.class, context.getRequest());
possibleArguments.put(HttpServletRequest.class, context.getRequest().getRequest());
possibleArguments.put(HttpSession.class, context.getRequest().getRequest().getSession());
possibleArguments.put(HttpServletResponse.class, context.getRequest().getResponse());
* @param original
*/
private void avoidDuplicateDecoration(FragmentRequest replacement, FragmentRequest original) {
if (replacement.getConfiguration() != null && replacement.getConfiguration() == original.getConfiguration()) {
FragmentConfiguration newConfig = new FragmentConfiguration(replacement.getConfiguration());
newConfig.remove("decorator");
replacement.setConfiguration(newConfig);
}
}
// if you change the supported parameter classes, make sure to update the documentation on the wiki
private Object handleRequestWithController(FragmentContext context) throws PageAction {
Map<Class<?>, Object> possibleArguments = new LinkedHashMap<Class<?>, Object>();
possibleArguments.put(FragmentContext.class, context);
possibleArguments.put(PageContext.class, context.getPageContext());
possibleArguments.put(FragmentConfiguration.class, context.getRequest().getConfiguration());
possibleArguments.put(FragmentModel.class, context.getModel());
possibleArguments.put(PageModel.class, context.getPageContext().getModel());
possibleArguments.put(FragmentRequest.class, context.getRequest());
possibleArguments.put(PageRequest.class, context.getPageContext().getRequest());
possibleArguments.put(HttpServletRequest.class, context.getPageContext().getRequest().getRequest());
Go ahead and create a ticket and send a pull request for this.
1 Like