Table of Contents
Correct answer
Home Java How to migrate from embedded jetty 10 to jetty 12 ee8?

How to migrate from embedded jetty 10 to jetty 12 ee8?

Feb 05, 2024 am 11:56 AM

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 );
Copy after login


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);
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1659
14
PHP Tutorial
1257
29
C# Tutorial
1231
24