is HttpServletRequest Ajax - Java javax.servlet.http

Java examples for javax.servlet.http:HttpServletRequest

Description

is HttpServletRequest Ajax

Demo Code


import javax.servlet.http.HttpServletRequest;

public class Main{
    /* w w  w  .jav a  2s .  co  m*/
    public static boolean isAjax(HttpServletRequest request) {
        if (request != null
                && ("XMLHttpRequest".equalsIgnoreCase(request
                        .getHeader("X-Requested-With")) || request
                        .getParameter("ajax") != null))
            return true;
        return false;
    }
}

Related Tutorials