Problem to construct a link using the LinkBuilders for a resource with a path
param that contains ":"
-----------------------------------------------------------------------------------------------------
Key: WINK-264
URL: https://issues.apache.org/jira/browse/WINK-264
Project: Wink
Issue Type: Bug
Components: Server
Affects Versions: 1.1
Reporter: Shay Tsadok
+Assuming we got a resource "MyResource" with the path template:+
{noformat}"/myResource/{entity_id: [0-9]+}"{noformat}
+When coming to use the LinkBuilders and build a link for this resource (code
example):+
{code}
@Context
private LinkBuilders linkBuilders;
linkBuilders.createSingleLinkBuilder().resource(myResource).pathParam("entity_id","3").rel("myRel").build(syndLinks);
{code}
+We will get the exception:+
{noformat}
java.lang.IllegalArgumentException: Syntax error: '/myResource/{entity_id:/'
contains invalid template form
at
org.apache.wink.common.internal.uritemplate.UriTemplateProcessor$Literal.assertValid(UriTemplateProcessor.java:379)
at
org.apache.wink.common.internal.uritemplate.UriTemplateProcessor$Literal.<init>(UriTemplateProcessor.java:368)
at
org.apache.wink.common.internal.uritemplate.UriTemplateProcessor$AbstractPatternBuilder.literal(UriTemplateProcessor.java:601)
at
org.apache.wink.common.internal.uritemplate.JaxRsUriTemplateProcessor$JaxRsPatternBuilder.literal(JaxRsUriTemplateProcessor.java:239)
at
org.apache.wink.common.internal.uritemplate.UriTemplateProcessor$AbstractPatternBuilder.endCompile(UriTemplateProcessor.java:609)
at
org.apache.wink.common.internal.uritemplate.JaxRsUriTemplateProcessor.compile(JaxRsUriTemplateProcessor.java:138)
at
org.apache.wink.common.internal.uritemplate.JaxRsUriTemplateProcessor.compile(JaxRsUriTemplateProcessor.java:92)
at
org.apache.wink.common.internal.uritemplate.JaxRsUriTemplateProcessor.<init>(JaxRsUriTemplateProcessor.java:81)
at
org.apache.wink.common.internal.UriBuilderImpl.getVariableNamesList(UriBuilderImpl.java:144)
at
org.apache.wink.common.internal.UriBuilderImpl.buildFromMap(UriBuilderImpl.java:402)
at
org.apache.wink.common.internal.UriBuilderImpl.buildFromEncodedMap(UriBuilderImpl.java:394)
at
org.apache.wink.server.internal.utils.SingleLinkBuilderImpl.build(SingleLinkBuilderImpl.java:86)
at
org.apache.wink.server.internal.utils.SingleLinkBuilderImpl.build(SingleLinkBuilderImpl.java:76)
at...
{noformat}
After debugging the framework I found out that *the core problem is in
UrlBuilderImpl.path(String path)*.
This method tries to extract the schema from the path (although that in the
above case the path is relative), and that's by looking for ":", in the case
above we've got the *":"* but as part of the "path param" and not as the schema
delimiter...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.