is Mozilla from HttpServletRequest - Java javax.servlet.http

Java examples for javax.servlet.http:HttpServletRequest

Description

is Mozilla from HttpServletRequest

Demo Code


import javax.servlet.http.HttpServletRequest;

public class Main{
    //  w w w . java2s.c o  m
    public static boolean isMozilla(HttpServletRequest request) {
        String agent = getAgent(request);
        if (null != agent && -1 != agent.indexOf("Mozilla")) {
            return true;
        }
        return false;
    }
    
    public static String getAgent(HttpServletRequest request) {
        return request.getHeader("USER-AGENT");
    }
}

Related Tutorials