we have legacy app and using the Jetty server. Now trying to upgrade our app to Java 17 with Jakarta. so we have to upgrade Jakarta 12.0.x to support java 17. when request comes we are passing the request objects to our custom filter in our current code.
before java 17:
@Override
public void handle(String target, Request baseRequest, HttpServletRequest hreq, HttpServletResponse
hresp)throws IOException, ServletException {
try {
fc.doFilter(hreq, hresp);
}catch (Exception e) {
basically doFilter method passes HttpServletRequest hreq, HttpServletResponse hresp objects
but new Jetty server 12.0.X, we do not have HttpServletRequest, HttpServletResponse objects inside handle method, below is the method signature.
after Java 17 and Jetty 12.0.x
@Override
public boolean handle(Request request, Response response, Callback callback) throws Exception {
doFilter method is from Jakarta and its signature is
void jakarta.servlet.FilterChain.doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException
Can you please guide me how to get the these object to pass to the jakarta filter
I tried using Jetty org.eclipse.jetty.server.Request object to get HttpServletRequest/Reponse but no methods are available in it
Jetty 12 core has no Servlet requirement.
Servlet exists only in the various environment layers.
Environments:
ee10,ee9, andee8.If you want to write against the
Handlerlayer in Jetty 12 Core, check the programming guide and jetty-examples projects.Since you apparently want Servlet filter like mechanisms, you should look at the
Handler.WrapperandRequest.Wrapperfacilities.See also