, PrimeFaces Dialog Framework /WEB-INF . . POST, , JSF/PrimeFaces oncomplete script URL- (public!) JavaScript/jQuery, , , <iframe>, URL- URL- , , , . 2 , - URL- , - URL- <iframe>.
/WEB-INF, "" <p:dialog> JS/CSS. , <iframe>, . - referer, .
pfdlgcid ( Constants.DIALOG_FRAMEWORK.CONVERSATION_PARAM), . PrimeFaces, , , " " URL- . , /dialogs, . , HTTP 400 /dialogs/* pfdlgcid.
@WebFilter("/dialogs/*")
public class DialogFilter implements Filter {
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
String id = request.getParameter(Constants.DIALOG_FRAMEWORK.CONVERSATION_PARAM);
if (id != null) {
chain.doFilter(req, res);
}
else {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
}
}
}
pfdlgcid - . pfdlgcid . PrimeFaces DialogNavigationHandler, , , PrimeFaces . DialogNavigationHandler, pfdlgcid , , , .
DialogFilter:
public static Set<String> getIds(HttpServletRequest request) {
HttpSession session = request.getSession();
Set<String> ids = (Set<String>) session.getAttribute(getClass().getName());
if (ids == null) {
ids = new HashSet<>();
session.setAttribute(getClass().getName(), ids);
}
return ids;
}
PrimeFaces DialogNavigationHandler 62:
DialogFilter.getIds((HttpServletRequest) context.getExternalContext().getRequest()).add(pfdlgcid);
<navigation-handler> faces-config.xml .
, if DialogFilter#doFilter() :
if (getIds(request).contains(id)) {
}
. , URL <iframe> . , PrimeFaces, . pfdlgcid , - . , JS, .
, , , "" <p:dialog>.