if (http.getResponseCode() == 303) {
// everything is fine
return true;
- } else if (http.getResponseCode() == 200) {
+ }
+ else if (http.getResponseCode() == 200) {
// get the new cookie
{
Pattern reSessionCookie = Pattern.compile("_SESSION=([^;]+);.*");
if (m.matches()) {
session = m.group(1);
Log.d("network", "new session is " + session);
- } else {
+ }
+ else {
Log.d("network", "set-cookie: " + cookie);
- Log.w("network", "Response Set-Cookie headers is not a _SESSION one");
+ Log.w("network",
+ "Response Set-Cookie headers is not a _SESSION one");
}
- } else {
+ }
+ else {
Log.w("network", "Response has no Set-Cookie header");
}
}
// the token needs to be updated
BufferedReader reader = new BufferedReader(new InputStreamReader(resp));
- Pattern re = Pattern.compile("<input type=\"hidden\" name=\"_token\" value=\"([^\"]+)\">");
+ Pattern re = Pattern.compile(
+ "<input type=\"hidden\" name=\"_token\" value=\"([^\"]+)\">");
String line;
while ((line = reader.readLine()) != null) {
//Log.d("dump", line);
}
}
throw new IOException("Can't find _token string");
- } else {
- throw new IOException(String.format("Error response code %d", http.getResponseCode()));
+ }
+ else {
+ throw new IOException(
+ String.format("Error response code %d", http.getResponseCode()));
}
}
}
public String getName() {
return name;
}
- public void setName(CharSequence text) {
- setName(String.valueOf(text));
- }
public void setName(String name) {
this.name = name;
}
+ public void setName(CharSequence text) {
+ setName(String.valueOf(text));
+ }
public String getUrl() {
return url;
}
- public void setUrl(CharSequence text) {
- setUrl(String.valueOf(text));
- }
public void setUrl(String url) {
this.url = url;
}
+ public void setUrl(CharSequence text) {
+ setUrl(String.valueOf(text));
+ }
public boolean isAuthEnabled() {
return authEnabled;
}
public String getAuthUserName() {
return authUserName;
}
- public void setAuthUserName(CharSequence text) {
- setAuthUserName(String.valueOf(text));
- }
public void setAuthUserName(String authUserName) {
this.authUserName = authUserName;
}
+ public void setAuthUserName(CharSequence text) {
+ setAuthUserName(String.valueOf(text));
+ }
public String getAuthPassword() {
return authPassword;
}
- public void setAuthPassword(CharSequence text) {
- setAuthPassword(String.valueOf(text));
- }
public void setAuthPassword(String authPassword) {
this.authPassword = authPassword;
}
+ public void setAuthPassword(CharSequence text) {
+ setAuthPassword(String.valueOf(text));
+ }
public void storeInDB() {
SQLiteDatabase db = MLDB.getWritableDatabase();
db.beginTransaction();