All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.spotnext.spring.web.util.RequestUtil Maven / Gradle / Ivy

There is a newer version: 1.0.21-BETA-20190513
Show newest version
package io.spotnext.spring.web.util;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * 

RequestUtil class.

* * @author mojo2012 * @version 1.0 * @since 1.0 */ public class RequestUtil { /** * Returns the current spring {@link javax.servlet.http.HttpServletRequest} or null. * * @return a {@link javax.servlet.http.HttpServletRequest} object. */ public static HttpServletRequest getCurrentHttpRequest() { final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); if (requestAttributes instanceof ServletRequestAttributes) { final HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest(); return request; } return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy