From 3bc93463d95a8a433f120ca470d187566f9ac6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leif=20=C3=85strand?= Date: Thu, 9 Aug 2018 10:33:24 +0300 Subject: [PATCH] Use FaviconHandler only for servlets (#4495) Fixes #4426 # Conflicts: # flow-server/src/main/java/com/vaadin/flow/server/VaadinServletService.java --- .../com/vaadin/flow/server/VaadinService.java | 15 +++++++-------- .../vaadin/flow/server/VaadinServletService.java | 7 +++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java b/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java index 1bf42cf67a7..c1f3efaed54 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java @@ -16,9 +16,8 @@ package com.vaadin.flow.server; -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletResponse; +import static java.nio.charset.StandardCharsets.UTF_8; + import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; @@ -47,6 +46,10 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import javax.servlet.Servlet; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletResponse; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +63,6 @@ import com.vaadin.flow.router.Router; import com.vaadin.flow.server.ServletHelper.RequestType; import com.vaadin.flow.server.communication.AtmospherePushConnection; -import com.vaadin.flow.server.communication.FaviconHandler; import com.vaadin.flow.server.communication.HeartbeatHandler; import com.vaadin.flow.server.communication.SessionRequestHandler; import com.vaadin.flow.server.communication.StreamRequestHandler; @@ -76,7 +78,6 @@ import elemental.json.JsonException; import elemental.json.JsonObject; import elemental.json.impl.JsonUtil; -import static java.nio.charset.StandardCharsets.UTF_8; /** * An abstraction of the underlying technology, e.g. servlets, for handling @@ -285,7 +286,6 @@ public void init() throws ServiceException { protected List createRequestHandlers() throws ServiceException { List handlers = new ArrayList<>(); - handlers.add(new FaviconHandler()); handlers.add(new SessionRequestHandler()); handlers.add(new HeartbeatHandler()); handlers.add(new UidlRequestHandler()); @@ -1309,8 +1309,7 @@ private int getHeartbeatTimeout() { */ private int getUidlRequestTimeout(VaadinSession session) { return getDeploymentConfiguration().isCloseIdleSessions() - ? session.getSession().getMaxInactiveInterval() - : -1; + ? session.getSession().getMaxInactiveInterval() : -1; } /** diff --git a/flow-server/src/main/java/com/vaadin/flow/server/VaadinServletService.java b/flow-server/src/main/java/com/vaadin/flow/server/VaadinServletService.java index 01b4e223727..765ce69db35 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/VaadinServletService.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/VaadinServletService.java @@ -16,8 +16,6 @@ package com.vaadin.flow.server; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; @@ -25,10 +23,14 @@ import java.util.Objects; import java.util.Optional; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.vaadin.flow.function.DeploymentConfiguration; +import com.vaadin.flow.server.communication.FaviconHandler; import com.vaadin.flow.server.communication.PushRequestHandler; import com.vaadin.flow.server.startup.RouteRegistry; import com.vaadin.flow.shared.ApplicationConstants; @@ -76,6 +78,7 @@ protected VaadinServletService() { protected List createRequestHandlers() throws ServiceException { List handlers = super.createRequestHandlers(); + handlers.add(0, new FaviconHandler()); handlers.add(0, new BootstrapHandler()); if (isAtmosphereAvailable()) { try {