Example usage for javax.servlet.http HttpServletRequest getMethod

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

Introduction

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

Prototype

public String getMethod();

Source Link

Document

Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.

Usage

From source file:com.erudika.para.security.SimpleAuthenticationEntryPoint.java

/**
 * Checks if this is a X-domain pre-flight request.
 * @param request request/*ww w .j a v a2  s .  com*/
 * @return true if preflight
 */
private boolean isPreflight(HttpServletRequest request) {
    return HttpMethod.OPTIONS.equals(request.getMethod());
}

From source file:org.openmhealth.dsu.controller.GenericExceptionHandlingControllerAdvice.java

@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public void handleException(Exception e, HttpServletRequest request) {

    log.warn("A {} request for '{}' failed.", request.getMethod(), request.getPathInfo(), e);
}

From source file:com.nec.harvest.security.HarvestLoginUrlAuthenticationEntryPoint.java

/**
 * Checks if this is a X-domain pre-flight request.
 * /*w  w  w .j a  v a 2  s .c o  m*/
 * @param request
 * @return
 */
private boolean isPreflight(HttpServletRequest request) {
    return "OPTIONS".equals(request.getMethod());
}

From source file:org.italiangrid.storm.webdav.authz.util.MethodRequestMatcher.java

@Override
public boolean matches(HttpServletRequest request) {

    for (String m : methods) {

        if (request.getMethod().matches(m)) {
            return true;
        }//from   www .  j a v  a 2s.c  om
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Request not matched by this matcher: method {} not in {}.", request.getMethod(), methods);
    }
    return false;
}

From source file:com.intel.podm.rest.ServletCommunicationCoordinator.java

private boolean isGetRequest(HttpServletRequest servletRequest) {
    return GET.equalsIgnoreCase(servletRequest.getMethod());
}

From source file:com.acc.storefront.util.CSRFHandlerInterceptor.java

protected boolean shouldCheckCSRFTokenForRequest(final HttpServletRequest request) {
    return ("POST").equalsIgnoreCase(request.getMethod()) && !isCSRFExemptUrl(request.getServletPath());
}

From source file:no.dusken.barweb.admin.PluginStoreController.java

protected boolean isFormSubmission(HttpServletRequest request) {
    return "POST".equals(request.getMethod());
}

From source file:org.openmhealth.dsu.controller.GenericExceptionHandlingControllerAdvice.java

@ExceptionHandler(AuthenticationCredentialsNotFoundException.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public void handleAuthenticationCredentialsNotFoundException(Exception e, HttpServletRequest request) {

    log.debug("A {} request for '{}' failed authentication.", request.getMethod(), request.getPathInfo(), e);
}

From source file:org.shredzone.commons.captcha.CaptchaServlet.java

@Override
protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception {
    if (!request.getMethod().equals("GET")) {
        response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, request.getMethod() + " is not accepted");
    }/*from  w  w  w  .j av a2 s  . com*/

    // Prepare header
    response.setDateHeader("Date", System.currentTimeMillis());
    response.setHeader("Cache-Control", "no-store");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", 0);
    response.setContentType("image/png");

    // Write captcha image
    CaptchaService cs = getWebApplicationContext().getBean("captchaService", CaptchaService.class);
    BufferedImage challenge = cs.createCaptcha(request.getSession());
    ImageIO.write(challenge, "png", response.getOutputStream());
}

From source file:com.acc.storefront.interceptors.beforecontroller.SetLanguageBeforeControllerHandler.java

protected boolean isGetMethod(final HttpServletRequest request) {
    return RequestMethod.GET.name().equalsIgnoreCase(request.getMethod());
}