spring-hateoas-ext/src/main/java/de/escalon/hypermedia/spring/ForwardedHeader.java
public static ForwardedHeader of(String source) {

		if (!StringUtils.hasText(source)) {
			return NO_HEADER;
		}

		Map<String, String> elements = new HashMap<String, String>();

		for (String part : source.split(";")) {

			String[] keyValue = part.split("=");

			if (keyValue.length != 2) {
				continue;
			}

			elements.put(keyValue[0].trim(), keyValue[1].trim());
		}

		Assert.notNull(elements, "Forwarded elements must not be null!");
		Assert.isTrue(!elements.isEmpty(), "At least one forwarded element needs to be present!");

		return new ForwardedHeader(elements);
	}
public static ForwardedHeader of(String source) {

		if (!StringUtils.hasText(source)) {
			return NO_HEADER;
		}

		Map<String, String> elements = new HashMap<String, String>();

		for (String part : source.split(";")) {

			String[] keyValue = part.split("=");

			if (keyValue.length != 2) {
				continue;
			}

			elements.put(keyValue[0].trim(), keyValue[1].trim());
		}

		Assert.notNull(elements, "Forwarded elements must not be null!");
		Assert.isTrue(!elements.isEmpty(), "At least one forwarded element needs to be present!");

		return new ForwardedHeader(elements);
	}
public static ForwardedHeader of ( String source ) { if ( ! StringUtils . hasText ( source ) ) { return NO_HEADER ; } Map < String , String > elements = new HashMap < String , String > ( ) ; for ( String part : source . split ( ";" ) ) { String [ ] keyValue = part . split ( "=" ) ; if ( keyValue . length != 2 ) { continue ; } elements . put ( keyValue [ 0 ] . trim ( ) , keyValue [ 1 ] . trim ( ) ) ; } Assert . notNull ( elements , "Forwarded elements must not be null!" ) ; Assert . isTrue ( ! elements . isEmpty ( ) , "At least one forwarded element needs to be present!" ) ; return new ForwardedHeader ( elements ) ; }
Creates a new {@link ForwardedHeader} from the given source.

@param source can be {@literal null}.
@return
Creates a new { @link ForwardedHeader } from the given source .