arturobernalg commented on code in PR #544: URL: https://github.com/apache/httpcomponents-client/pull/544#discussion_r1472471707
########## httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/BasicScheme.java: ########## @@ -232,27 +228,47 @@ public String generateAuthResponse( return StandardAuthScheme.BASIC + " " + new String(encodedCreds, 0, encodedCreds.length, StandardCharsets.US_ASCII); } - private void writeObject(final ObjectOutputStream out) throws IOException { - out.defaultWriteObject(); - out.writeUTF(this.defaultCharset.name()); - } - - @SuppressWarnings("unchecked") - private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { - in.defaultReadObject(); - try { - this.defaultCharset = Charset.forName(in.readUTF()); - } catch (final UnsupportedCharsetException ex) { - this.defaultCharset = StandardCharsets.UTF_8; + @Override + public State store() { + if (complete) { + return new State(new HashMap<>(paramMap), credentials); + } else { + return null; } } - private void readObjectNoData() { + @Override + public void restore(final State state) { + if (state != null) { + paramMap.clear(); + paramMap.putAll(state.params); + credentials = state.credentials; + complete = true; + } } @Override public String toString() { return getName() + this.paramMap; } + @Internal + public static class State { + + final Map<String, String> params; Review Comment: I assume this variables are not private due to its internal scope. ########## httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/BearerScheme.java: ########## @@ -161,9 +163,49 @@ public String generateAuthResponse( return StandardAuthScheme.BEARER + " " + bearerToken.getToken(); } + @Override + public State store() { + if (complete) { + return new State(new HashMap<>(paramMap), bearerToken); + } else { + return null; + } + } + + @Override + public void restore(final State state) { + if (state != null) { + paramMap.clear(); + paramMap.putAll(state.params); + bearerToken = state.bearerToken; + complete = true; + } + } + @Override public String toString() { return getName() + this.paramMap; } + @Internal + public static class State { + + final Map<String, String> params; Review Comment: I assume this variables are not private due to its internal scope. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org