[
https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566173#action_12566173
]
Remy Gendron commented on ABDERA-101:
-------------------------------------
Following Dan's suggestion, I changed my servlet/abdera configuration to:
servlet context: /imdb
provider base: /feed/
adapter: actor
Things work somewhat better now. The service document now correctly lists the
collection path as /feed/actors.
BUT... collection.getResolvedHref() now returns an invalid URI, where the
servlet context (/imdb) part is missing (http://localhost:9002/feed/actors).
collection.getResolvedBaseUri() returns the correct value
(http://localhost:9002/imdb/feed/).
collection.getHref() returns the correct value (/feed/actors).
However, collection._resolve() , which calls IRI.resolve(), does not provide
the correct result:
* There is a strange, probably conflicting usage of both IRI.isAbsolute() and
IRI.isPathAbsolute(). This prevents IRI.resolve(String, String) from being
called.
* Even if IRI.resolve(String, String) was called, the logic assumes that the
collection base path does not end with a "/".
I am stuck. I cannot specify a base path ending with a "/", and at the same
time I cannot set the collection href (in the provider) to start with a "/" as
the resolving process would assume it is an absolute path and discard the base
path.
Thanks for looking into this.
> Issue with collection resolved href?
> ------------------------------------
>
> Key: ABDERA-101
> URL: https://issues.apache.org/jira/browse/ABDERA-101
> Project: Abdera
> Issue Type: Bug
> Affects Versions: 0.3.0
> Reporter: Remy Gendron
>
> Hi all,
> Am I missing something here? I'm setting up an example project for the
> development team....
> I initialize my provider with a base of "/", which is the default value
> anyway.
> My adapters are given a relative href (setHref()) when initialized in the
> provider. (eg "actors")
> I start Jetty in my unit tests with an application context of "/imdb".
> The following unit test fails because when I retrieve the HREF property for
> the actors collection it is now an absolute path ("/actors").
> When IRI.resolve(IRI b, IRI c) is called, c is absolute. My collection thus
> returns an href of http://localhost:9002/actors instead of
> http://localhost:9002/imdb/actors.
> Here's the thread stack:
> Thread [main] (Suspended)
> IRI.resolve(IRI, IRI) line: 442
> IRI.resolve(IRI) line: 555
> FOMCollection(FOMElement)._resolve(IRI, IRI) line: 337
> FOMCollection.getResolvedHref() line: 138
> ImdbRestTest.testGetService() line: 43
> And the unit test:
> public class ImdbRestTest extends AbstractRestTest {
> @Test
> public void testGetService() throws IOException {
> ClientResponse resp = client.get(getTestBaseURI());
> assertNotNull(resp);
> try {
> assertEquals(200, resp.getStatus());
> assertEquals(ResponseType.SUCCESS, resp.getType());
>
> assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(),
> Constants.APP_MEDIA_TYPE));
> Document<Service> doc = resp.getDocument();
> try {
> // prettyPrint(doc);
> } catch (Exception e) {
> }
> Service service = doc.getRoot();
> // prettyPrint(service);
> assertEquals(1, service.getWorkspaces().size());
> Workspace workspace = service.getWorkspaces().get(0);
> assertEquals(3, workspace.getCollections().size());
> for (Collection collection : workspace.getCollections()) {
> if
> (collection.getTitle().startsWith(ImdbConstants.ACTORS_FEED)) {
> assertEquals(getTestBaseURI() + "/" +
> ImdbConstants.ACTORS_FEED, collection.getResolvedHref().toString());
> }
> }
> } finally {
> resp.release();
> }
> }
> }
> Rémy
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.