requestBuilder.setHeader( "accept", "text/plain" );
requestBuilder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
requestBuilder.sendRequest( null, new RequestCallback() {
public void onError( Request request, final Throwable caught ) {
MessageDialogBox errBox =
new MessageDialogBox(
Messages.getString( "loginError" ), Messages.getString( "authFailed" ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
errBox.setCallback( new IDialogCallback() {
public void cancelPressed() {
}
public void okPressed() {
outerCallback.onFailure( caught );
}
} );
errBox.show();
}
public void onResponseReceived( Request request, Response response ) {
if ( "true".equalsIgnoreCase( response.getText() ) ) {
long year = 1000 * 60 * 60 * 24 * 365;
// one year into the future
Date expirationDate = new Date( System.currentTimeMillis() + year );
Cookies.setCookie( "loginNewWindowChecked", "" + newWindowChk.getValue(), expirationDate ); //$NON-NLS-1$ //$NON-NLS-2$
outerCallback.onSuccess( newWindowChk != null && newWindowChk.getValue() );
} else {
outerCallback.onFailure( new Throwable( Messages.getString( "authFailed" ) ) ); //$NON-NLS-1$
}
}
} );
} catch ( final RequestException e ) {
MessageDialogBox errBox =
new MessageDialogBox(
Messages.getString( "loginError" ), Messages.getString( "authFailed" ), false, false, true ); //$NON-NLS-1$ //$NON-NLS-2$
errBox.setCallback( new IDialogCallback() {
public void cancelPressed() {
}
public void okPressed() {
outerCallback.onFailure( e );
}
} );
errBox.show();
}
}
};
try {
String username = userTextBox.getText();