@Override public Undoer execute(final List<VertexRef> targets, final OperationContext operationContext) { final Collection<VertexRef> availableNodes = m_geoAssetProvider.getNodesWithCoordinates(); final StringBuilder sb = new StringBuilder(); sb.append(VaadinServlet.getCurrent().getServletContext().getContextPath()); sb.append("/node-maps#search/nodeId%20in%20"); final List<String> nodeIds = new ArrayList<String>(); for (final VertexRef ref : targets) { if (availableNodes.contains(ref)) { nodeIds.add(ref.getId()); } } final Iterator<String> i = nodeIds.iterator(); while (i.hasNext()) { sb.append(i.next()); if (i.hasNext()) { sb.append(","); } } final String redirectUrl = sb.toString(); LOG.info("redirecting to: " + redirectUrl); final UI ui = operationContext.getMainWindow(); ui.getPage().getJavaScript().execute("window.location = '" + redirectUrl + "';"); return null; }
@Override protected void init(VaadinRequest request) { // for mobile, set yet another theme if (VaadinServlet.getCurrent() instanceof TouchKitServlet) { setTheme("touchkitexex"); } super.init(request); }
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); getService() .addSessionInitListener( new SessionInitListener() { /** */ private static final long serialVersionUID = -8279023207169735541L; @Override public void sessionInit(SessionInitEvent event) throws ServiceException { event.getSession().addUIProvider(uiProvider); } }); }
// NOTE - Copied from VAADIN CDI Example @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /** * Repository URL - https://github.com/mstahv/vaadin-cdi-jaas-jbossas-example /blob/workaround * /src/main/java/com/vaadin/cdi/example/Servlet.java */ /* * This haxi is only needed for app servers that for some reason lose * request type on FORDARD. * * Works (without): JBoss 7.1, Glassfish 4 Broken: Wildfly, TomEE */ if (request.getDispatcherType() == DispatcherType.FORWARD && request.getRequestURI().contains("login")) { Object page = request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI); request.getSession(true).setAttribute(AUTH_ORIGINALPAGE, page); response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); response.setHeader("Location", request.getRequestURI()); } else { super.service(request, response); } }
public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); getService().addSessionInitListener(sessionInitListener); }
@Override protected void servletInitialized() throws ServletException { super.servletInitialized(); }