I have the following snippet and I have some unresolved classes - mainly, Base64
String auth = username + ":" + password;
byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
String authHeader = "Basic " + new String(encodedAuth);
request.setHeader(HttpHeaders.AUTHORIZATION, authHeader);
I've tried to import the commons-codec maven repository but in Eclipse it still says cannot resolve class:
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
We're kinda stuck for now using JDK7 which may be the issue. Is this Base64 class only available from Java 8? Otherwise, how do I import it into my application?