I have a need to detect if the request generated is an AJAX request or Full request. In JSF 2.0 this is easy and you can find many blog posts and forum discussions which have dealt with it. But as I am using ADF 11.1.1.6.0 which uses JSF 1.2 so none of those methods of detecting an AJAX request wouldn't work for me.
So I tried to find a way to detect if the request generated is an AJAX or not and what I found I am sharing with you. You can use any one of the following methods from your Utility class:
Note this is applicable for ADF 11.1.1.6.0. I haven't tested with other ADF versions.
Happy coding :-)
So I tried to find a way to detect if the request generated is an AJAX or not and what I found I am sharing with you. You can use any one of the following methods from your Utility class:
public static boolean isPprRequest(FacesContext context) { return isPprRequest(context.getExternalContext()); } public static boolean isPprRequest(ExternalContext ec) { return (("true".equals(ec.getRequestHeaderMap().get("Adf-Rich-Message"))) || ("true".equals(ec.getRequestParameterMap().get("Adf-Rich-Message")))); } public static boolean isPprRequest(HttpServletRequest req) { return (("true".equals(req.getHeader("Adf-Rich-Message"))) || ("true".equals(req.getParameter("Adf-Rich-Message")))); }
Note this is applicable for ADF 11.1.1.6.0. I haven't tested with other ADF versions.
Happy coding :-)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.