0
votes

Here I'm using Oracle ADF 12c. I'm using Filter for session expiration handling.

If session expired then redirecting to login page as following:

response.sendRedirect("/myapp/faces/login.jsp");

But if the request from browser is a PPR(Partial Page Rendering) request then the above specified redirect is not working.

To resolve this I have tried the solution specified in the following post.

Now redirect is working fine for PPR requests. But it is not working for regular request because of special partial response xml.

To differentiate the PPR requests and regular requests I've added the below check as specified in the above post.

if ("partial/ajax".equals(request.getHeader("Faces-Request"))) {
// It's a JSF ajax request.
} 

But ADF PPR request is not sending the request header "Faces-Request". So all the requests including PPR requests are treating as regular requests.

How to differentiate ADF PPR request from regular request ?

1

1 Answers

3
votes

The indicator for partial response in ADF is the presence of the key "Adf-Rich-Message" in either request headers or request parameters. The key has existed since 11g and is not new to 12c.

In a filter you do not have FacesContext object, hence lookup for the key directly on the ServletRequest.

boolean isPartialRequest = "true".equals(request.getParameter("Adf-Rich-Message")) || "true".equals(request.getHeader("Adf-Rich-Message"));

If you are implementing the check post JSF context initialization, the following check should work:

FacesContext.getPartialViewContext().isAjaxRequest()

or

    ExternalContext ec = FacesContext.getExternalContext();

    boolean isPartialRequest = "true".equals(ec.getRequestHeaderMap().get("Adf-Rich-Message")) || "true".equals(ec.getRequestParameterMap().get("Adf-Rich-Message"))

which is the same as above.