@Test public void parsesBasicAuthorizationFields(){ AuthorizationField field = AuthorizationField.parse("Basic fdsfds"); Assert.assertEquals(new AuthorizationField(WWWAuthenticateField.Method.Basic, "fdsfds"), field); }
public static AuthorizationField parse(String s) throws ParsingException { String fValue = s.trim(); StringTokenizer tokens = new StringTokenizer(fValue); if (tokens.countTokens() < 2) throw new ParsingException(ParsingException.Failure.MISSING_SCHEME); Method method; try { method = Method.valueOf(tokens.nextToken()); } catch (IllegalArgumentException ex) { throw new ParsingException(ParsingException.Failure.UNSUPPORTED_SCHEME); } AuthorizationField f = new AuthorizationField(method, tokens.nextToken()); return f; }
AuthorizationField extends HeaderField { public static AuthorizationField parse(String s) throws ParsingException { String fValue = s.trim(); StringTokenizer tokens = new StringTokenizer(fValue); if (tokens.countTokens() < 2) throw new ParsingException(ParsingException.Failure.MISSING_SCHEME); Method method; try { method = Method.valueOf(tokens.nextToken()); } catch (IllegalArgumentException ex) { throw new ParsingException(ParsingException.Failure.UNSUPPORTED_SCHEME); } AuthorizationField f = new AuthorizationField(method, tokens.nextToken()); return f; } }
AuthorizationField extends HeaderField { public static AuthorizationField parse(String s) throws ParsingException { String fValue = s.trim(); StringTokenizer tokens = new StringTokenizer(fValue); if (tokens.countTokens() < 2) throw new ParsingException(ParsingException.Failure.MISSING_SCHEME); Method method; try { method = Method.valueOf(tokens.nextToken()); } catch (IllegalArgumentException ex) { throw new ParsingException(ParsingException.Failure.UNSUPPORTED_SCHEME); } AuthorizationField f = new AuthorizationField(method, tokens.nextToken()); return f; } AuthorizationField(Method method, String rawCredentials); }
AuthorizationField extends HeaderField { public static AuthorizationField parse(String s) throws ParsingException { String fValue = s.trim(); StringTokenizer tokens = new StringTokenizer(fValue); if (tokens.countTokens() < 2) throw new ParsingException(ParsingException.Failure.MISSING_SCHEME); Method method; try { method = Method.valueOf(tokens.nextToken()); } catch (IllegalArgumentException ex) { throw new ParsingException(ParsingException.Failure.UNSUPPORTED_SCHEME); } AuthorizationField f = new AuthorizationField(method, tokens.nextToken()); return f; } AuthorizationField(Method method, String rawCredentials); static AuthorizationField parse(String s); @Override T accept(HeaderFieldVisitor<T> visitor); WWWAuthenticateField.Method method(); String rawCredentials(); String credentialsString(); BasicCredentials basicCredentials(); @Override String name(); @Override String value(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
AuthorizationField extends HeaderField { public static AuthorizationField parse(String s) throws ParsingException { String fValue = s.trim(); StringTokenizer tokens = new StringTokenizer(fValue); if (tokens.countTokens() < 2) throw new ParsingException(ParsingException.Failure.MISSING_SCHEME); Method method; try { method = Method.valueOf(tokens.nextToken()); } catch (IllegalArgumentException ex) { throw new ParsingException(ParsingException.Failure.UNSUPPORTED_SCHEME); } AuthorizationField f = new AuthorizationField(method, tokens.nextToken()); return f; } AuthorizationField(Method method, String rawCredentials); static AuthorizationField parse(String s); @Override T accept(HeaderFieldVisitor<T> visitor); WWWAuthenticateField.Method method(); String rawCredentials(); String credentialsString(); BasicCredentials basicCredentials(); @Override String name(); @Override String value(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }