Set http response headers in fragment action method

What I want is to simply set a cookie header. In a page controller method this can be done with PageRequest.getResponse().addCookie(cookie);

But I’m not sure how to do that in a fragment action method. These are the allowed fragment action parameters mentioned on the wiki.

Fragment Action method parameters Any public method in a fragment controller class is accessible as a fragment action. Parameters Method parameters will be auto-set by type for these classes: org.openmrs.ui.framework.fragment.FragmentActionRequest

javax.servlet.http.HttpServletRequest javax.servlet.http.HttpSession org.openmrs.ui.framework.UiUtils org.openmrs.ui.framework.session.Session org.springframework.context.ApplicationContext javax.servlet.ServletContext

Any help is appreciated.

I’m not sure this is possible, given the current code.

You could try adding this feature to the UI Framework module, I guess starting from this line: https://github.com/openmrs/openmrs-module-uiframework/blob/master/omod/src/main/java/org/openmrs/module/uiframework/FragmentActionController.java#L143 (the response object is available, it’s just not passed along).

Hi Darius.

I’m pretty new here. May I create an issue in JIRA for this?

UPDATE– It seems it is already reported and is being fixed in UI Framework 3.7.

@gayanw the ticket you have linked to is about Fragment Controllers not about Fragment Actions, which is what I thought you were asking about.

You are welcome to create a JIRA ticket for this. But it’s most likely to get addressed if you work through it yourself. (We can help explain how!)

Fine I’ll create an issue and will work on it.