Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Embedded Jetty 6 mit 2 unterschiedlichen Context Einheiten

Empfohlene Antworten

Veröffentlicht

Moin Moin,

ich hab gerade eine Anwendung entwickelt in der ich mit Java Grafikfiles generiere und dieses dann über ein servlet ausgeben möchte bzw. die html seite mit den <img > Tags generieren.

Funktioniert auch alles bisher, nur werden die Bilder nicht angezeugt, da der Jetty Server anscheinend nicht weiss, wo die Bilder liegen.

In Jetty 5 brauchte man dazu einen zweiten http Context um die Bilder auszugeben:

HttpContext imageContext = new HttpContext();

imageContext.setContextPath("/images");

imageContext.setResourceBase(".");

imageContext.addHandler(new ResourceHandler());

server.addContext(imageContext);

Das ist ein Codefragment aus einem Jetty5 Programm. In Jetty 6 finde ich allerdings keine Möglichkeit den zweiten Context zu implementieren.

Das erstellen des Servers sieht bisher so aus:

public static void main(String[] args) throws Exception {

Server server = new Server(8080);

Context context = new Context(server,"/",Context.SESSIONS);

context.addServlet(new ServletHolder(new WebGenerator()), "/");

server.start();

server.join();

}

Vielleicht hat hier ja schonmal jmd Jetty genutzt und weiss wie man dort den zweiten Context anlegen kann.

Schöne Grüße

Grinarn

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.