1

This is insane, but which package (artifact) holds org.apache.catalina.servlet4preview.http.HttServletResponse? Is it obsolete? I can import org.apache.catalina.servlet4preview.http.HttpServletRequest just fine.

I already have as dependencies (trying them one at a time in a desperate hope)

org.apache.tomcat.tomcat-catalina

org.apache.tomcat.tomcat-servlet-api

org.apache.tomcat.tomcat-coyote

org.apache.tomcat.tomcat-util

org.apache.catalina.catalina

org.apache.tomcat.tomcat-annotations-api

EDIT:

I would like to implement a HandlerInterceptorAdapter in order to execute custom logic on each request and potentially redirect. The preHandle() method accepts HttpServletResponse as a second argument. The javax one is not accepted (the method doesn't override its super class counterpart in this case).

import org.apache.catalina.servlet4preview.http.HttpServletRequest;
//import org.apache.catalina.servlet4preview.http.HttServletResponse; //cannot find symbol
import org.apache.catalina.servlet4preview.http.ServletMapping;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public boolean preHandle(HttpServletRequest request,
                         HttpServletResponse response,
                         Object handler) throws Exception {
Community
  • 1
  • 1
Tihomir Mitkov
  • 846
  • 1
  • 11
  • 20
  • Based on the name I'd suspect it's some preview version for a Servlet 4.0 specification class. Yup. [Provides early access to some parts of the Servlet 4.0 API](http://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/servlet4preview/http/HttpServletRequest.html). What do you need it for? – Kayaman Mar 21 '20 at 08:38
  • Seems there's no preview interface for `HttpResponse`, presumably there's no new functionality for the response. But you should not be using that interface anyway, why aren't you using the standard `javax.*` interfaces? – Kayaman Mar 21 '20 at 11:03
  • Method preHandle() is defined with org.apache.catalina.servlet4preview. What interface do you think I can use instead of HandlerInterceptorAdapter – Tihomir Mitkov Mar 21 '20 at 11:08
  • 1
    No it isn't. Spring would never use an internal Tomcat interface. I don't know how you stumbled upon importing that package, but you should be using the `javax.*` packages. – Kayaman Mar 21 '20 at 11:11

0 Answers0