
Originally Posted by
bmgreeley
To simplify the questions, how does an AJAX request actually trigger a transition? I would assume it would be the "_eventId=" argument. But I may be wrong.
Atleast FlowAjaxTilesView uses SpringJavascriptAjaxHandler, which requires that there is either a parameter with name "ajaxSource" (value doesn't matter) or the content type of the request must be "text/html;type=ajax".
Code:
/**
* The accept header value that signifies an Ajax request.
*/
public static final String AJAX_ACCEPT_CONTENT_TYPE = "text/html;type=ajax";
/**
* Alternate request parameter to indicate an Ajax request for cases when control of the header is not available.
*/
public static final String AJAX_SOURCE_PARAM = "ajaxSource";
public boolean isAjaxRequest(HttpServletRequest request, HttpServletResponse response) {
String acceptHeader = request.getHeader("Accept");
String ajaxParam = request.getParameter(AJAX_SOURCE_PARAM);
if (AJAX_ACCEPT_CONTENT_TYPE.equals(acceptHeader) || StringUtils.hasText(ajaxParam)) {
return true;
} else {
return false;
}
}