Search in sources :

Example 26 with ServletRequest

use of jakarta.servlet.ServletRequest in project spring-framework by spring-projects.

the class AbstractDataBoundFormElementTag method processFieldValue.

/**
 * Process the given form field through a {@link RequestDataValueProcessor}
 * instance if one is configured or otherwise returns the same value.
 */
protected final String processFieldValue(@Nullable String name, String value, String type) {
    RequestDataValueProcessor processor = getRequestContext().getRequestDataValueProcessor();
    ServletRequest request = this.pageContext.getRequest();
    if (processor != null && request instanceof HttpServletRequest) {
        value = processor.processFormFieldValue((HttpServletRequest) request, name, value, type);
    }
    return value;
}
Also used : HttpServletRequest(jakarta.servlet.http.HttpServletRequest) ServletRequest(jakarta.servlet.ServletRequest) HttpServletRequest(jakarta.servlet.http.HttpServletRequest) RequestDataValueProcessor(org.springframework.web.servlet.support.RequestDataValueProcessor)

Example 27 with ServletRequest

use of jakarta.servlet.ServletRequest in project spring-framework by spring-projects.

the class AbstractHttpSockJsSession method disableShallowEtagHeaderFilter.

private void disableShallowEtagHeaderFilter(ServerHttpRequest request) {
    if (request instanceof ServletServerHttpRequest) {
        ServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
        ShallowEtagHeaderFilter.disableContentCaching(servletRequest);
    }
}
Also used : ServletServerHttpRequest(org.springframework.http.server.ServletServerHttpRequest) ServletRequest(jakarta.servlet.ServletRequest)

Example 28 with ServletRequest

use of jakarta.servlet.ServletRequest in project spring-framework by spring-projects.

the class ServletRequestMethodArgumentResolverTests method setup.

@BeforeEach
public void setup() throws Exception {
    resolver = new ServletRequestMethodArgumentResolver();
    mavContainer = new ModelAndViewContainer();
    servletRequest = new MockHttpServletRequest("GET", "");
    webRequest = new ServletWebRequest(servletRequest, new MockHttpServletResponse());
    method = getClass().getMethod("supportedParams", ServletRequest.class, MultipartRequest.class, HttpSession.class, Principal.class, Locale.class, InputStream.class, Reader.class, WebRequest.class, TimeZone.class, ZoneId.class, HttpMethod.class, PushBuilder.class);
}
Also used : Locale(java.util.Locale) ServletRequest(jakarta.servlet.ServletRequest) MockHttpServletRequest(org.springframework.web.testfixture.servlet.MockHttpServletRequest) ZoneId(java.time.ZoneId) MockHttpServletRequest(org.springframework.web.testfixture.servlet.MockHttpServletRequest) HttpSession(jakarta.servlet.http.HttpSession) MockHttpSession(org.springframework.web.testfixture.servlet.MockHttpSession) InputStream(java.io.InputStream) Reader(java.io.Reader) TimeZone(java.util.TimeZone) ModelAndViewContainer(org.springframework.web.method.support.ModelAndViewContainer) WebRequest(org.springframework.web.context.request.WebRequest) ServletWebRequest(org.springframework.web.context.request.ServletWebRequest) MultipartRequest(org.springframework.web.multipart.MultipartRequest) PushBuilder(jakarta.servlet.http.PushBuilder) ServletWebRequest(org.springframework.web.context.request.ServletWebRequest) MockHttpServletResponse(org.springframework.web.testfixture.servlet.MockHttpServletResponse) Principal(java.security.Principal) HttpMethod(org.springframework.http.HttpMethod) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ServletRequest (jakarta.servlet.ServletRequest)28 HttpServletRequest (jakarta.servlet.http.HttpServletRequest)17 ServletResponse (jakarta.servlet.ServletResponse)13 HttpServletResponse (jakarta.servlet.http.HttpServletResponse)12 ServletException (jakarta.servlet.ServletException)9 IOException (java.io.IOException)8 Test (org.junit.jupiter.api.Test)5 Request (org.apache.catalina.connector.Request)4 MockFilterChain (org.springframework.mock.web.MockFilterChain)4 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)4 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)4 MockHttpServletRequest (org.springframework.web.testfixture.servlet.MockHttpServletRequest)4 MockHttpServletResponse (org.springframework.web.testfixture.servlet.MockHttpServletResponse)4 ServletRequestWrapper (jakarta.servlet.ServletRequestWrapper)3 RequestDataValueProcessor (org.springframework.web.servlet.support.RequestDataValueProcessor)3 Principal (java.security.Principal)2 HashMap (java.util.HashMap)2 Properties (java.util.Properties)2 Context (org.apache.catalina.Context)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2