I’m having a very strange problem -It may be a configuration issue with Apache or Tomcat rather than Vaadin, but I don’t see how and I don’t know where to start looking…
I have written a web app using Vaadin and installed the war file on a server in a Tomcat container that is front-ended by an Apache web server. And it works just fine.
Now I have installed a new server and installed Apache and Tomcat on it and dropped the war file into the Tomcat directory. When I point my browser (Chrome, Firefox, Safari) at the new system, it brings up my login screen and lets me enter a username and password. And then - nothing… Firebug doesn’t show a message being sent to the server, there are no errors in the httpd log files or the tomcat log file - just nothing. The login button blinks the tab on my browser but it doesn’t seem to call the onLogin() function.
This is the same war file - byte for byte identical - that runs fine on my original testbed. So what would cause this?
Here is a stripped down version of the login page - I won’t guarantee it will compile as shown, but I have not touched any of the html code or the beginning of the onLogin() function.
Note that when the login screen is displayed, the message ‘Start Login Screen…’ shows up in my log file. But the message ‘User: username’ never prints…
One other thing to note - the login screen has a second button called ‘Report Problem’ (not shown in the code snippet below). If I click that button, it brings up
a different page in the application, so the basic button functionality is still working…
Any help you can give me would be appreciated… Thanks in advance,
nbc
public class LoginScreen extends VRSN_LoginScreen {
private static final long serialVersionUID = 1L;
private static final VRSNLogger Logger = VRSNLogger.getLogger(LoginScreen.class);
public LoginScreen(JART_Application app){
super(app);
Logger.info("Start Login Screen...");
// The application caption is shown in the caption bar of the
// browser window. We set it here and not in the application
// init() to make switching language easier.
getApp().getMainWindow().setCaption("JART");
setSizeFull();
addComponent(new VRSN_PageHeader(getApp().getAppTitle()));
Panel loginPanel = new Panel("Enter Userid/Password to log in");
loginPanel.setWidth("500px");
LoginForm loginForm = new LoginForm() {
private static final long serialVersionUID = -1175293455878477596L;
@Override
protected byte[] getLoginHTML() {
String appUri = getApplication().getURL().toString()
+ getWindow().getName() + "/";
return ("<!DOCTYPE html PUBLIC \"-//W3C//DTD "
+ "XHTML 1.0 Transitional//EN\" "
+ "\"http://www.w3.org/TR/xhtml1/"
+ "DTD/xhtml1-transitional.dtd\">\n" + "<html>"
+ "<head><script type='text/javascript'>"
+ "var setTarget = function() {" + "var uri = '"
+ appUri
+ "loginHandler"
+ "'; var f = document.getElementById('loginf');"
+ "document.forms[0]
.action = uri;document.forms[0]
.username.focus();};"
+ ""
+ "var styles = window.parent.document.styleSheets;"
+ "for(var j = 0; j < styles.length; j++) {\n"
+ "if(styles[j]
.href) {"
+ "var stylesheet = document.createElement('link');\n"
+ "stylesheet.setAttribute('rel', 'stylesheet');\n"
+ "stylesheet.setAttribute('type', 'text/css');\n"
+ "stylesheet.setAttribute('href', styles[j]
.href);\n"
+ "document.getElementsByTagName('head')[0]
.appendChild(stylesheet);\n"
+ "}"
+ "}\n"
+ "function submitOnEnter(e) { var keycode = e.keyCode || e.which;"
+ " if (keycode == 13) {document.forms[0]
.submit();} } \n"
+ "</script>"
+ "</head><body onload='setTarget();' style='margin:0;padding:0; background:transparent;' class=\""
+ ApplicationConnection.GENERATED_BODY_CLASSNAME
+ "\">"
+ "<div class='v-app v-app-loginpage' style=\"background:transparent;\">"
+ "<iframe name='logintarget' style='width:0;height:0;"
+ "border:0;margin:0;padding:0;'></iframe>"
+ "<form id='loginf' target='logintarget' onkeypress=\"submitOnEnter(event)\" method=\"post\">"
+ "<table>"
+ "<tr><td>" + "Username: " + "</td>"
+ "<td><input class='v-textfield' style='display:block;' type='text' name='username'></td></tr>"
+ "<tr><td>" + "Password: " + "</td>"
+ "<td><input class='v-textfield' style='display:block;' type='password' name='password'></td></tr>"
+ "</table>"
+ "<div><div onclick=\"document.forms[0]
.submit();\" tabindex=\"0\" class=\"v-button\" role=\"button\" ><span class=\"v-button-wrap\"><span class=\"v-button-caption\">" + "Login" + "</span></span></div></div></form></div>" + "</body></html>")
.getBytes();
}
};
loginForm.addListener(new LoginListener() {
private static final long serialVersionUID = -4471412876480488624L;
public void onLogin(LoginEvent event) {
dbManager_JART dbMgr = null;
String username = event.getLoginParameter("username");
String password = event.getLoginParameter("password");
User u = null;
boolean b = false;
int idx = 0;
Logger.info("User: " + username);
dbMgr = getApp().getDbMgr();
u = dbMgr.validateUser(username, password);
... lots more code here....
}
});
loginForm.setHeight("100px");
loginPanel.addComponent(loginForm);
addComponent(loginPanel);
setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
HorizontalLayout footer = new HorizontalLayout();
footer.setHeight("50px");
addComponent(footer);
}
}