/** The handler for the clicked event of the OK button. */ private void btnOK_Clicked() { boolean bResult = false; try { String sServerURL = (String) getPropSet("txtServerURL").getPropertyValue("Text"); String sUserName = (String) getPropSet("txtUsername").getPropertyValue("Text"); String sPassword = (String) getPropSet("txtPassword").getPropertyValue("Text"); Short nState = (Short) getPropSet("chkRemember").getPropertyValue("State"); if (sServerURL.endsWith("/")) sServerURL = sServerURL.substring(0, sServerURL.length() - 1); XWikiExtension xWikiExtension = XWikiExtension.getInstance(); ConnectionSettings set = xWikiExtension.getSettings(); set.setServerURL(sServerURL); xWikiExtension.resetClient(); set.setUsername(sUserName); set.setPassword(sPassword); if (nState == 0) { LoginData loginData = new LoginData(); loginData.clearCredentials(); } else if (nState == 1) { String new_credentials[] = { sServerURL, sUserName, sPassword, xWikiExtension.getSettings().getWikiURL(), xWikiExtension.getSettings().getXmlRpcURL() }; LoginData loginData = new LoginData(); loginData.writeCredentials(new_credentials); } XWikiXmlRpcClient client = xWikiExtension.getClient(); if (client != null) { bResult = xWikiExtension.doLogin(); } if (bResult) { m_xDialog.endExecute(); xWikiExtension.getExtensionStatus().setLoginStatus(true); Utils.ShowMessage( m_xContext, m_xDialog, Constants.TITLE_XWIKI, Constants.MESS_LOGINSUCC, Constants.TYPE_INFO, false); } else { Utils.ShowMessage( m_xContext, m_xDialog, Constants.TITLE_ERROR, Constants.ERROR_LOGINFAILED, Constants.TYPE_ERROR, false); } } catch (UnknownPropertyException e) { e.printStackTrace(); } catch (WrappedTargetException e) { e.printStackTrace(); } }