List of usage examples for com.vaadin.server VaadinResponse setCacheTime
public void setCacheTime(long milliseconds);
From source file:com.ejt.vaadin.loginform.LoginForm.java
License:Apache License
private void init() { if (initialized) { return;/* w ww . ja va2 s . com*/ } LoginFormState state = getState(); state.userNameFieldConnector = createUserNameField(); state.passwordFieldConnector = createPasswordField(); state.loginButtonConnector = createLoginButton(); String contextPath = VaadinService.getCurrentRequest().getContextPath(); if (contextPath.endsWith("/")) { contextPath = contextPath.substring(0, contextPath.length() - 1); } state.contextPath = contextPath; VaadinSession.getCurrent().addRequestHandler(new RequestHandler() { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { if (LoginFormConnector.LOGIN_URL.equals(request.getPathInfo())) { response.setContentType("text/html; charset=utf-8"); response.setCacheTime(-1); PrintWriter writer = response.getWriter(); writer.append("<html>Success</html>"); return true; } else { return false; } } }); registerRpc(new LoginFormRpc() { @Override public void submitCompleted() { login(); } }); initialized = true; setContent(createContent(getUserNameField(), getPasswordField(), getLoginButton())); }