Example usage for javax.servlet.http HttpServletRequest getHeader

List of usage examples for javax.servlet.http HttpServletRequest getHeader

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getHeader.

Prototype

public String getHeader(String name);

Source Link

Document

Returns the value of the specified request header as a String.

Usage

From source file:com.glaf.core.web.filter.GZIPFilter.java

protected boolean isGZIPSupported(HttpServletRequest req) {
    String browserEncodings = req.getHeader("accept-encoding");
    boolean supported = ((browserEncodings != null) && (browserEncodings.indexOf("gzip") != -1));
    String userAgent = req.getHeader("user-agent");
    if ((userAgent != null) && userAgent.startsWith("httpunit")) {
        log.debug("httpunit detected, disabling filter...");
        return false;
    } else {/*from   w w  w  .j av  a2s  .  c o m*/
        return supported;
    }
}

From source file:com.wavemaker.commons.web.filter.EtagFilter.java

private boolean isRequestFromIeBrowser(HttpServletRequest request) {
    return request.getHeader("User-Agent") != null && (request.getHeader("User-Agent").contains("Trident")
            || request.getHeader("User-Agent").contains("MSIE"));
}

From source file:shiver.me.timbers.spring.security.jwt.AuthenticationRequestJwtTokenParser.java

private String findHeaderToken(HttpServletRequest request) {
    return request.getHeader(tokenName);
}

From source file:com.katropine.oauth.LogoutImpl.java

public void removeaccess(HttpServletRequest req) {

    String tokens = req.getHeader("Authorization");
    System.out.println(tokens);//  w  ww  .j a v  a 2s  . c  om
    String value = tokens.substring(tokens.indexOf(" ")).trim();
    DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken(value);
    System.out.println(token);
    tokenstore.removeAccessToken(value);
    System.out.println("\n\tAccess Token Removed Successfully!!!!!!!!");

}

From source file:eu.trentorise.smartcampus.aac.conf.OAuthTokenFilter.java

private Object extractToken(HttpServletRequest request) {
    String completeToken = request.getHeader(AUTHORIZATION);
    if (completeToken == null)
        return null;
    if (completeToken.toLowerCase().startsWith(BEARER_TYPE)) {
        completeToken = completeToken.substring(BEARER_TYPE.length());
    }/*  www. j  a v  a  2 s. c  om*/
    return completeToken;
}

From source file:org.owasp.webgoat.plugin.HttpBasicsInterceptRequest.java

@RequestMapping(method = RequestMethod.GET)
public @ResponseBody AttackResult completed(HttpServletRequest request) throws IOException {
    if (request.getHeader("x-request-intercepted").toLowerCase().equals("true")
            && request.getParameter("changeMe").equals("Requests are tampered easily")) {
        return trackProgress(success().feedback("http-proxies.intercept.success").build());
    } else {//from   w ww .j  av  a  2  s.c o  m
        return trackProgress(failed().feedback("http-proxies.intercept.failure").build());
    }
}

From source file:belajar.nfc.controller.OptionsController.java

@RequestMapping(method = RequestMethod.OPTIONS)
public void handleOptionsUser(HttpServletRequest request, HttpServletResponse response) {
    String host = request.getHeader("Host");
    String origin = request.getHeader("Origin");
    LOGGER.info("Options Controller URI [{}] method [{}] headers [{}] ipserver [{}]",
            new Object[] { request.getRequestURI(), request.getMethod(), origin, host });
}

From source file:com.dub.skoolie.web.controller.system.district.SystemDistrictController.java

@RequestMapping(value = "/system/districts", method = RequestMethod.POST)
public ModelAndView addDistrict(@Valid DistrictBean districtBean, BindingResult result, Model model,
        HttpServletRequest request) {
    String referrer = request.getHeader("Referer");
    if (result.hasErrors()) {
        if (!referrer.equals("/system/districts")) {
            return new ModelAndView("redirect:" + referrer);
        }/*from  w  w w .j  a  va  2  s  .c  o  m*/
        model.addAttribute("districtBean", districtBean);
        model.addAttribute("districts", uiDistrictServiceImpl.getDistricts());
        return new ModelAndView("system/district/districts");
    }
    uiDistrictServiceImpl.addDistrict(districtBean);
    return new ModelAndView("redirect:" + referrer);
}

From source file:com.thoughtworks.go.spark.SparkPreFilter.java

private String getAcceptHeader(HttpServletRequest req) {
    return req.getHeader("Accept");
}

From source file:com.dub.skoolie.web.controller.system.schedule.SystemGradingPeriodController.java

@RequestMapping(value = "/system/schedule/gradingperiod", method = RequestMethod.POST)
public ModelAndView addGradingPeriod(@Valid GradingPeriodBean gradingPeriodBean, BindingResult result,
        Model model, HttpServletRequest request) {
    String referrer = request.getHeader("Referer");
    if (result.hasErrors()) {
        if (!referrer.equals("/system/schedule/gradingperiod")) {
            return new ModelAndView("redirect:" + referrer);
        }//from   ww w  .j  av  a 2  s.c om
        model.addAttribute("gradingPeriodBeans", uiGradingPeriodServiceImpl.getGradingPeriods());
        model.addAttribute("gradingPeriodBean", gradingPeriodBean);
        model.addAttribute("schoolYears", uiGradingPeriodServiceImpl.getSchoolYears());
        return new ModelAndView("system/schedule/gradingperiod");
    }
    uiGradingPeriodServiceImpl.addGradingPeriod(gradingPeriodBean);
    return new ModelAndView("redirect:" + referrer);
}