#504 - Parsing links now supports all rel formats defined in RFC5988.

This commit is contained in:
Oliver Gierke
2016-10-28 11:30:00 +02:00
parent 304585f83d
commit 1f57378b84
2 changed files with 22 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
public class Link implements Serializable {
private static final long serialVersionUID = -9037755944661782121L;
private static final String URI_PATTERN = "(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
public static final String ATOM_NAMESPACE = "http://www.w3.org/2005/Atom";
@@ -282,7 +283,7 @@ public class Link implements Serializable {
}
Map<String, String> attributes = new HashMap<String, String>();
Pattern keyAndValue = Pattern.compile("(\\w+)=\\\"(\\p{Alnum}*)\"");
Pattern keyAndValue = Pattern.compile("(\\w+)=\"(\\p{Lower}[\\p{Lower}\\p{Digit}\\.\\-]*|" + URI_PATTERN + ")\"");
Matcher matcher = keyAndValue.matcher(source);
while (matcher.find()) {