⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serverimpl.java

📁 j2me 校园手机客户端上载传输程序
💻 JAVA
字号:
package com.enterprisej2me.iFeedBack.singlesignon; import java.util.*;import java.rmi.*; import javax.xml.rpc.server.*;import javax.xml.rpc.JAXRPCException; public class ServerImpl implements ServiceLifecycle, Server {  // Some canned data  private String [] usernames =             {"test01", "test02", "test03"};  private String [] passwords =             {"pass01", "pass02", "pass03"};  private String [] userIDs =             {"001", "002", "003"};  private String [] randompass =             {"111", "222", "333"};  public void init( Object context ) throws JAXRPCException {  }  public void destroy () {  }  public boolean authenticate( String token )                      throws RemoteException {    try {      StringTokenizer st = new StringTokenizer(                            token, ":");      String uid = st.nextToken();      String upass = st.nextToken();      for (int i=0; i < userIDs.length; i++) {        if ( uid.equals(userIDs[i]) &&             upass.equals(randompass[i]) ) {          return true;        }      }      return false;    } catch (Exception e) {      e.printStackTrace();      return false;    }  }  public String getToken( String username,                          String password )                      throws RemoteException {    for (int i=0; i < usernames.length; i++) {      if ( username.equals(usernames[i]) &&           password.equals(passwords[i]) ) {        return userIDs[i] + ":" + randompass[i];      }    }       return "-1:-1";  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -