@Override protected Boolean parse( Request<Boolean, AuthData> request, HttpResponse response, Document document) throws Exception { String sessionID, error; sessionID = parserSessionID(document); if (sessionID == null) { error = parserError(document); if (error != null) { if (error.contains("學號應為九碼半形數字") || error.contains("請輸入正確學號") || error.contains("密碼長度過長或過短") || error.contains("您輸入的密碼有誤")) { throw new Exception(Exceptions.ID_PASS_WRONG); } else { throw new Exception("未知錯誤 : " + error); } } throw new Exception(Exceptions.UNKONWN_FAIL); } KikiSource.storageSession(getContext(), sessionID); return true; }
@Override public void initHTTPRequest(Request<Course[], SemesterData> request) { super.initHTTPRequest(request); SemesterData semesterData = request.args; HTTPParameter parameter = httpParameter(request); if (semesterData.year > 0 && semesterData.term > 0) { parameter.queryStrings("year", String.valueOf(semesterData.year)); parameter.queryStrings("term", String.valueOf(semesterData.term)); } }