List of usage examples for javax.servlet.http HttpServletRequest getMethod
public String getMethod();
From source file:love.sola.netsupport.api.stuff.ToolsCheck.java
@Override protected Object process(HttpServletRequest req, WxSession session) throws Exception { if (req.getMethod().equals("GET")) { return query(req, session); } else if (req.getMethod().equals("POST")) { return submit(req, session); }// w w w .ja va2s . c o m return null; }
From source file:com.isalnikov.config.auth.UserAuthorizationFilter.java
@Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; if (RequestMethod.POST.name().equals(request.getMethod())) { super.doFilter(req, resp, chain); } else {/*from ww w .j av a 2s. co m*/ chain.doFilter(req, resp); } }
From source file:fr.putnami.pwt.plugin.ajaxbot.filter.DeleteCacheFilter.java
@Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; if (HttpMethod.GET.toString().equals(request.getMethod()) && null != request.getParameter(QUERY_PARAM_RESET_FILTER)) { this.resetCache(); }/*from w ww.jav a 2 s . co m*/ chain.doFilter(req, resp); }
From source file:com.intel.podm.rest.HttpServletRequestValidator.java
private String getRequestLine(HttpServletRequest servletRequest) { return format("%s %s HTTP/1.1\n\r", servletRequest.getMethod(), servletRequest.getRequestURL()); }
From source file:com.microsoft.applicationinsights.web.spring.RequestNameHandlerInterceptorAdapterTests.java
@Test public void testAdapterSetRequestNameCorrectly() throws Exception { HttpServletRequest request = mock(HttpServletRequest.class); when(request.getMethod()).thenReturn(HttpMethods.GET); interceptorAdapter.preHandle(request, null, handlerMethod); String requestName = ThreadContext.getRequestTelemetryContext().getHttpRequestTelemetry().getName(); String expectedRequestName = String.format("%s %s/%s", HttpMethods.GET, DEFAULT_CONTROLLER_NAME, DEFAULT_ACTION_NAME);/*from w w w . ja v a2s . com*/ Assert.assertEquals(expectedRequestName, requestName); }
From source file:AIR.Common.Web.Session.HttpRequestLoggerInitializerFilter.java
@SuppressWarnings("unchecked") private void addRequestDetailsToLoggers(HttpServletRequest request) { final String method = request.getMethod(); logger.debug("========================== Request Logging Start ==================================="); logger.debug("Method: " + method); logger.debug("Request URI: " + request.getRequestURI()); logger.debug("Received at: " + MDC.get("requestTime")); logger.debug("Query String: " + request.getQueryString()); logger.debug("<<<<<<<<< Headers start >>>>>>>>>>"); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = headerNames.nextElement(); String headerValue = request.getHeader(headerName); logger.debug(headerName + " : " + headerValue); }//from w w w . j av a 2s. c o m logger.debug("<<<<<<<<< Headers end >>>>>>>>>>"); }
From source file:org.openmhealth.dsu.controller.GenericExceptionHandlingControllerAdvice.java
@ExceptionHandler(MissingServletRequestParameterException.class) @ResponseStatus(HttpStatus.BAD_REQUEST)/*w w w. j ava 2 s . c o m*/ public void handleMissingServletRequestParameterException(MissingServletRequestParameterException e, HttpServletRequest request) { log.debug("A {} request for '{}' failed because parameter '{}' is missing.", request.getMethod(), request.getPathInfo(), e.getParameterName(), e); }
From source file:net.sourceforge.subsonic.controller.AccessSettingsController.java
/** * Determine if the given request represents a form submission. * * @param request current HTTP request/*from ww w . j a v a2 s . com*/ * @return if the request represents a form submission */ private boolean isFormSubmission(HttpServletRequest request) { return "POST".equals(request.getMethod()); }
From source file:com.enonic.cms.web.CmsDispatcherServlet.java
protected void doService(HttpServletRequest req, HttpServletResponse res) throws Exception { final HttpMethod requestMethod = HttpMethod.valueOf(req.getMethod()); if (!ALLOWED_HTTP_METHODS.contains(requestMethod)) { res.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); return;// w w w .ja v a 2 s . c o m } ServletRequestAccessor.setRequest(req); OriginalUrlResolver.resolveOriginalUrl(req); super.doService(req, res); }