Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withLink() example backwards? #34

Closed
jamesladd opened this issue Jun 19, 2012 · 2 comments
Closed

withLink() example backwards? #34

jamesladd opened this issue Jun 19, 2012 · 2 comments

Comments

@jamesladd
Copy link

In the README there is the example:

Resource owner = resourceFactory.newResource("http://example.com/mike")
.withLink("td:friend", "http://example.com/mamund")

When I run this the resulting JSON looks like this:

{
"_links":
{
"self":
{
"href":"http://localhost/api/..."
},
"http://example.com/mamund":
{
"href":"td:friend"
}
}
}

This looks wrong. However, when I switch the parameters around like this:

.withLink("http://example.com/mamund", "td:friend")

Then I get a namespace error because 'td' is not defined.

When I remove the namespace prefix td: then all is ok.

So is the examples parameters around the wrong way??

  • James.
@talios
Copy link
Owner

talios commented Jun 19, 2012

Hey James,

Good spotting. Some time ago I switched the order of the parameters
around and guess I missed some examples ( I fixed the tests but missed
the README ).

I'm tempted to switch them over to taking a URL/URI rather than just a
String, to make it more specific - thoughts?

Mark

On 19/06/12 4:42 PM, James Ladd wrote:

In the README there is the example:

Resource owner = resourceFactory.newResource("http://example.com/mike")
.withLink("td:friend", "http://example.com/mamund")

When I run this the resulting JSON looks like this:

{
"_links":
{
"self":
{
"href":"http://localhost/api/..."
},
"http://example.com/mamund":
{
"href":"td:friend"
}
}
}

This looks wrong. However, when I switch the parameters around like this:

.withLink("http://example.com/mamund", "td:friend")

Then I get a namespace error because 'td' is not defined.

When I remove the namespace prefix td: then all is ok.

So is the examples parameters around the wrong way??

  • James.

Reply to this email directly or view it on GitHub:
#34

@jamesladd
Copy link
Author

Hi Mark,

I really like where you are going with the HalBuilder and it has got me off
to a good start with my project. Thanks!

I think a withLink(); that takes a URI/URL is useful - however I find that
since you do
such a good job handling relative URL's the use of URI/URL might be more
painful
than a String.

That being said, you are building a library so supporting both would be the
most useful,
although more work.

Rgs, James.

On Tue, Jun 19, 2012 at 2:58 PM, Mark Derricutt <
reply@reply.github.com

wrote:

Hey James,

Good spotting. Some time ago I switched the order of the parameters
around and guess I missed some examples ( I fixed the tests but missed
the README ).

I'm tempted to switch them over to taking a URL/URI rather than just a
String, to make it more specific - thoughts?

Mark

On 19/06/12 4:42 PM, James Ladd wrote:

In the README there is the example:

Resource owner = resourceFactory.newResource("http://example.com/mike")
.withLink("td:friend", "http://example.com/mamund")

When I run this the resulting JSON looks like this:

{
"_links":
{
"self":
{
"href":"http://localhost/api/..."
},
"http://example.com/mamund":
{
"href":"td:friend"
}
}
}

This looks wrong. However, when I switch the parameters around like this:

.withLink("http://example.com/mamund", "td:friend")

Then I get a namespace error because 'td' is not defined.

When I remove the namespace prefix td: then all is ok.

So is the examples parameters around the wrong way??

  • James.

Reply to this email directly or view it on GitHub:
#34


Reply to this email directly or view it on GitHub:
#34 (comment)

@talios talios closed this as completed in 91d1624 Jun 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants