Source:
<code>public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; PortalResponseWrapper wrapper = new PortalResponseWrapper(response); chain.doFilter(request, wrapper); <START> JsonArray alerts = Alert.getAlertsAsJson(request, response); <END> MenuFunctionality functionality = BennuPortalDispatcher.getSelectedFunctionality(request); if (functionality != null && wrapper.hasData() && request.getAttribute(SKIP_LAYOUT_INJECTION) == null) { PortalBackend backend = PortalBackendRegistry.getPortalBackend(functionality.getProvider()); if (backend.requiresServerSideLayout()) { String body = wrapper.getContent(); try { PortalConfiguration config = PortalConfiguration.getInstance(); Map<String, Object> ctx = new HashMap<>(); List<MenuItem> path = functionality.getPathFromRoot(); ctx.put("loggedUser", Authenticate.getUser()); ctx.put("body", body); ctx.put("functionality", functionality); ctx.put("config", config); ctx.put("topLevelMenu", config.getMenu().getUserMenuStream()); ctx.put("contextPath", request.getContextPath()); ctx.put("devMode", CoreConfiguration.getConfiguration().developmentMode()); ctx.put("pathFromRoot", path); ctx.put("selectedTopLevel", path.get(0)); ctx.put("locales", CoreConfiguration.supportedLocales()); ctx.put("currentLocale", I18N.getLocale()); ctx.put("alerts", alerts); PebbleTemplate template = engine.getTemplate(config.getTheme() + "/" + functionality.resolveLayout()); template.evaluate(response.getWriter(), ctx, I18N.getLocale()); } catch (PebbleException e) { throw new ServletException("Could not render template!", e); } } else { wrapper.flushBuffer(); } } else { wrapper.flushBuffer(); } }</code><technical_language>Please inline this variable</technical_language>

Target:
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; PortalResponseWrapper wrapper = new PortalResponseWrapper(response); chain.doFilter(request, wrapper); MenuFunctionality functionality = BennuPortalDispatcher.getSelectedFunctionality(request); if (functionality != null && wrapper.hasData() && request.getAttribute(SKIP_LAYOUT_INJECTION) == null) { PortalBackend backend = PortalBackendRegistry.getPortalBackend(functionality.getProvider()); if (backend.requiresServerSideLayout()) { String body = wrapper.getContent(); try { PortalConfiguration config = PortalConfiguration.getInstance(); Map<String, Object> ctx = new HashMap<>(); List<MenuItem> path = functionality.getPathFromRoot(); ctx.put("loggedUser", Authenticate.getUser()); ctx.put("body", body); ctx.put("functionality", functionality); ctx.put("config", config); ctx.put("topLevelMenu", config.getMenu().getUserMenuStream()); ctx.put("contextPath", request.getContextPath()); ctx.put("devMode", CoreConfiguration.getConfiguration().developmentMode()); ctx.put("pathFromRoot", path); ctx.put("selectedTopLevel", path.get(0)); ctx.put("locales", CoreConfiguration.supportedLocales()); ctx.put("currentLocale", I18N.getLocale()); ctx.put("alerts", Alert.getAlertsAsJson(request, response)); PebbleTemplate template = engine.getTemplate(config.getTheme() + "/" + functionality.resolveLayout()); template.evaluate(response.getWriter(), ctx, I18N.getLocale()); } catch (PebbleException e) { throw new ServletException("Could not render template!", e); } } else { wrapper.flushBuffer(); } } else { wrapper.flushBuffer(); } }