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:io.neba.spring.mvc.SlingMultipartResolver.java

private static boolean isMultipartContent(HttpServletRequest request) {
    return equalsIgnoreCase(request.getMethod(), "POST")
            && startsWithIgnoreCase(request.getContentType(), "multipart/");
}

From source file:net.jadler.stubbing.server.jetty.RequestUtils.java

public static Request convert(HttpServletRequest source) throws IOException {
    String method = source.getMethod();
    URI requestUri = URI.create(source.getRequestURL() + getQueryString(source));
    InputStream body = source.getInputStream();
    InetSocketAddress localAddress = new InetSocketAddress(source.getLocalAddr(), source.getLocalPort());
    InetSocketAddress remoteAddress = new InetSocketAddress(source.getRemoteAddr(), source.getRemotePort());
    String encoding = source.getCharacterEncoding();
    Map<String, List<String>> headers = converHeaders(source);
    return new Request(method, requestUri, headers, body, localAddress, remoteAddress, encoding);
}

From source file:nl.dtls.fairdatapoint.api.controller.utils.LoggerUtils.java

/**
 * Log the request./*from   w w w .  j av a 2s . c  o  m*/
 * 
 * Log message pattern [Time\t IP\t requestMethod\t requestedURL]
 * @param logger    Class logger
 * @param request   Client request
 * @param response  Server response
 */
public static void logRequest(Logger logger, HttpServletRequest request, HttpServletResponse response) {
    ThreadContext.put("requestMethod", request.getMethod());
    ThreadContext.put("requestURI", request.getRequestURI());
    ThreadContext.put("requestProtocol", request.getProtocol());
    ThreadContext.put("responseStatus", String.valueOf(response.getStatus()));
    String contentLength = response.getHeader(HttpHeaders.CONTENT_LENGTH);
    ThreadContext.put("contentSize", contentLength);
    logger.log(Level.getLevel("API-REQUEST"), "");
}

From source file:com.enonic.cms.web.portal.instanttrace.InstantTraceRequestInspector.java

public static boolean isAuthenticationSubmitted(final HttpServletRequest request) {
    if (!"POST".equalsIgnoreCase(request.getMethod())) {
        return false;
    }//from  w ww.  j  a  v  a2 s.c o m

    String userName = request.getParameter("_itrace_username");
    String password = request.getParameter("_itrace_password");
    if (userName != null && password != null) {
        return true;
    }
    return false;
}

From source file:org.ow2.chameleon.everest.servlet.HttpUtils.java

public static boolean isGet(HttpServletRequest req) {
    return "GET".equals(req.getMethod());
}

From source file:org.ow2.chameleon.everest.servlet.HttpUtils.java

public static boolean isPut(HttpServletRequest req) {
    return "PUT".equals(req.getMethod());
}

From source file:org.ow2.chameleon.everest.servlet.HttpUtils.java

public static boolean isHead(HttpServletRequest req) {
    return "HEAD".equals(req.getMethod());
}

From source file:org.ow2.chameleon.everest.servlet.HttpUtils.java

public static boolean isPost(HttpServletRequest req) {
    return "POST".equals(req.getMethod());
}

From source file:org.ow2.chameleon.everest.servlet.HttpUtils.java

public static boolean isDelete(HttpServletRequest req) {
    return "DELETE".equals(req.getMethod());
}

From source file:com.comcast.cdn.traffic_control.traffic_router.api.util.APIAccessRecord.java

public static void log(final HttpServletRequest request) {
    ACCESS.info(String.format(ACCESS_FORMAT, FORMATTER.format(new Date()), request.getRemoteAddr(),
            request.getMethod(), getUrl(request)));
}