abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remy Gendron (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ABDERA-101) Issue with collection resolved href?
Date Wed, 06 Feb 2008 18:17:08 GMT

    [ https://issues.apache.org/jira/browse/ABDERA-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566249#action_12566249
] 

Remy Gendron commented on ABDERA-101:
-------------------------------------

The patch did not solve the issue. The servlet context is still removed. The simplest way
to reproduce is to modify the CustomerAdapterTest to deploy in Jetty with a servlet context
other than root (/). For instance, my demo project uses /imdb.

My tests run fine when I deploy in the root context.

Again, I use:

app ctx: /imdb
provider base: /:feed/
adapter href: actors

The service document correctly report the collection's href to be /imdb/actors. However, calling
collection.getResolvedHref() returns http://localhost:9002/feed/actors (imdb ctx missing).

I believe the issue is at IRI.resolve(IRI, IRI) [line 458]. Shouldn't isAbsolute() be called
instead of isPathAbsolute()? The latter has it that c is returned normalized instead of resolving
the adapter path (c) against the provider base (b).

If base is the root context, we are lucky. However, deploying in a specific context breaks
the IRI resolution.

> 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.


Mime
View raw message