search
HomeJavaHow to migrate from embedded jetty 10 to jetty 12 ee8?

Question content

I try to port from jetty 10.x to jetty 12.x ee8. After I changed the dependencies according to this list https://download.eclipse.org/tools/orbit/simrel/maven-jetty/release/12.0.6/. I'm getting some compiler errors while using embedded jetty.

There seems to be no ee8 server class, I use org.eclipse.jetty.server.server. This class extends from org.eclipse.jetty.server.handler.wrapper.

But the handler for jetty-ee8-nested extends from org.eclipse.jetty.ee8.nested.handlerwrapper, which is incompatible. For example org.eclipse.jetty.ee8.nested.inetaccesshandler. One expects org.eclipse.jetty.server.handler and the other org.eclipse.jetty.ee8.nested.handler

Is there another implementer of the server I oversee? Where can I find it? What about class names?

Or do I have to modify my code? For example, how do I change the following line?

InetAccessHandler ipaccess = new InetAccessHandler();
ipaccess.setHandler( getHandler() );
setHandler( ipaccess );

Correct answer


First, there is a migration guide from jetty 11 to jetty 12: https:// eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-migration-11-to-12

It shows many of the things you asked about.

Ignore Classes in the org.eclipse.jetty.ee8.nested.* package, these are internal classes of the ee8 layer.

Use org.eclipse.jetty.server.handler.inetaccesshandler.

You can wrap it around any handler, for example: org.eclipse.jetty.server.handler.sequence, org.eclipse.jetty.ee8.webappwebappcontext, etc. ...

InetAccessHandler inetAccessHandler = new InetAccessHandler();
// allow only http clients from localhost IPv4 or IPv6
inetAccessHandler.include("127.0.0.1", "::1");
server.setHandler(inetAccessHandler);

Handler.Sequence handlers = new Handler.Sequence();
inetAccessHandler.setHandler(handlers);

WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar(warPath.toUri().toASCIIString());

handlers.addHandler(webapp);

This snippet comes from https:// /github.com/jetty/jetty-examples/tree/12.0.x/embedded/ee8-webapp-context

The above is the detailed content of How to migrate from embedded jetty 10 to jetty 12 ee8?. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:stackoverflow. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool