Communication problem on browser refresh

Hi,
I have an application with a login form and a main page. On Firefox and IE if I log in to the application then click the browser refresh button I get a “Communication Problem” message. It seems to work fine with Opera.

I’m using Vaadin 6.4.9. I’ve tried taking all of the content out of the main page, but it didn’t make any difference. Once I’ve clicked the “click here to continue” link on the error message the application works fine and there are no more problems with the browser refresh. It’s only happening immediately after login.

Below is the code I’m using. Any help would be greatly appreciated.

	@Override
	public void init()
	{
		if ( getUser() == null )
		{
			showLoginWindow();
		}
		else
		{
			showMainWindow();
		}
	}

	private void showLoginWindow()
	{
		if ( mainWindow == null )
		{
			mainWindow = new Window();
		}
		else
		{
			mainWindow.removeAllComponents();
		}
		mainWindow.setCaption( "Please login" );

		FormLayout formLayout = new FormLayout();
		final TextField userField = new TextField( "Username" );
		final TextField passwordField = new TextField( "Password" );
		passwordField.setSecret( true );
		Button login = new Button( "login" );
		login.setClickShortcut( KeyCode.ENTER );
		formLayout.addComponent( userField );
		formLayout.addComponent( passwordField );
		formLayout.addComponent( login );
		mainWindow.setContent( formLayout );

		login.addListener( new ClickListener()
		{
			@Override
			public void buttonClick( final ClickEvent event )
			{
				String username = ( String ) userField.getValue();
				String password = ( String ) passwordField.getValue();
... authentication...
							setUser( user );
							showMainWindow();
			}
		} );

		setMainWindow( mainWindow );
	}

	private void showMainWindow()
	{
		if ( mainWindow == null )
		{
			mainWindow = new Window();
		}
		else
		{
			mainWindow.removeAllComponents();
		}
		VerticalLayout root = new VerticalLayout();
		root.addComponent( createHeader() );
		
... application code, commented out...

		mainWindow.addComponent( root );
	}
	
	private Component createHeader()
	{
		HorizontalLayout header = new HorizontalLayout();
		header.addStyleName( "header-background" );
		Label title = new Label( "...Title..." );
		title.addStyleName( "header-title" );
		header.addComponent( title );
		Button logout = new Button( "Logout" );
		logout.addListener( new ClickListener()
		{
			@Override
			public void buttonClick( final ClickEvent event )
			{
				setUser( null );
				showLoginWindow();
			}

		} );
		header.addComponent( logout );
		Embedded image = new Embedded( null, logo );
		image.addStyleName( "header-logo" );
		header.addComponent( image );
		return header;
	}

Thanks,

Nick

A little more information:

The last HTTP request from Firefox is

URL: http://localhost:5080/admin/UIDL?repaintAll=1&sh=1050&sw=1680&cw=1438&ch=342&vw=1438&vh=342&fr=
Content: init
Reponse: for(;;);[{“Vaadin-Security-Key”:“b141a3a7-5b9c-4007-9d65-762d798bacc5”,“changes”:[

On the server side I get the message:

Warning: Ignoring variable change for non-existent component, VAR_PID=PID4

Hi,

I tested your code using the latest 6.5 nightly and 6.4.9 and did not get any “Communication Problem” message with either version. If it “works” in Opera it is most likely related to the request sent when unloading the page, before the refresh takes place. Opera does not send any events when you refresh the page. Still there should be no communication error on refresh.

I think I’ve tracked the problem down to the password field in combination with the “setClickShortcut” on the login button. If I enter the login details and press enter I get the problem. If I click the login button instead it works fine.

Indeed, it is only reproducable when you press enter to login, not when you click the login button.

I did some more digging and found two issues that cause this: #6315 and #6316. Basically the password field sends an update to the server when it should not results in a CommunicationError.

Thanks Artur. I’ll disable the keyboard shortcut until those are fixed.
Regards,

Nick