Created
February 13, 2012 21:41
-
-
Save msosvi/1820713 to your computer and use it in GitHub Desktop.
Ajax handler for Apache Trinidad.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.enlosdetalles.spring; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import org.springframework.js.ajax.SpringJavascriptAjaxHandler; | |
/** | |
* Ajax handler for Apache Trinidad. | |
* | |
*/ | |
public class ApacheTrinidadAjaxHandler extends SpringJavascriptAjaxHandler { | |
@Override | |
protected boolean isAjaxRequestInternal(HttpServletRequest request, HttpServletResponse response) { | |
String trXHRMessageHeader = request.getHeader("Tr-XHR-Message"); //Trinidad 1.x header | |
String facesRequestHeader = request.getHeader("Faces-Request"); //Trinidad 2.x header | |
if ((trXHRMessageHeader!=null && trXHRMessageHeader.equals("true")) || | |
(facesRequestHeader!=null && facesRequestHeader.equals("partial/ajax"))) { | |
return true; | |
} else { | |
return super.isAjaxRequestInternal(request, response); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment