Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RESTful Web Service Discoverability with Spring MVC 3.1, part 4 - the HTTP Header utils
public static List< String > parseLinkHeader( String linkHeader ){
Preconditions.checkNotNull( linkHeader );
List< String > linkHeaders = Lists.newArrayList();
String[] links = linkHeader.split( ", " );
for( final String link : links ){
int positionOfSeparator = link.indexOf( ';' );
linkHeaders.add( link.substring( 1, positionOfSeparator - 1 ) );
}
return linkHeaders;
}
public static String parseSingleLinkHeader( String linkHeader ){
Preconditions.checkNotNull( linkHeader );
int positionOfSeparator = linkHeader.indexOf( ';' );
return linkHeader.substring( 1, positionOfSeparator - 1 );
}
@eugenp

This comment has been minimized.

Copy link
Owner Author

commented Nov 6, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.