📄 authenticate.java
字号:
package com.bv.api;import java.io.IOException;import java.net.MalformedURLException;import java.util.Vector;import com.bv.api.response.AuthenticateResponse;public class Authenticate extends ParamCall { public Authenticate() { super(); url = "/api/authenticate"; } protected boolean checkParams(String uaid) throws ParamNotPresentException, InvalidParameterException { Vector<String> unsetParams = new Vector<String>(); System.out.println("UAID: " +uaid); if (uaid == null || uaid.equals("")) { unsetParams.add("uaid"); } else if (uaid.length() != 36) { throw new InvalidParameterException("UAID"); } if (unsetParams.size() > 0) { throw new ParamNotPresentException(unsetParams); } else { return true; } } protected String constructParameterString(String uaid) throws InvalidParameterException{ String parameters = ""; parameters += getEncodedParams("uaid", uaid); return parameters; } public AuthenticateResponse execute(String uaid, String serverURL) throws ParamNotPresentException, InvalidParameterException { try { String response = connect(uaid, serverURL); AuthenticateResponse authResponse = new AuthenticateResponse(); return authResponse.processResponse(response); } catch (MalformedURLException mue) { return new AuthenticateResponse(Error.ConnectionError, "Invalid server URL"); } catch (IOException ioe) { return new AuthenticateResponse(Error.ConnectionError); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -