You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Kaloyan Kolev (JIRA)" <ji...@apache.org> on 2010/09/03 16:32:33 UTC

[jira] Created: (WINK-311) Resource Locator's @PathParam resolution is not correct.

Resource Locator's @PathParam resolution is not correct.
--------------------------------------------------------

                 Key: WINK-311
                 URL: https://issues.apache.org/jira/browse/WINK-311
             Project: Wink
          Issue Type: Bug
          Components: Server
    Affects Versions: 1.0
         Environment: Recreated with a JUnit test.
            Reporter: Kaloyan Kolev
            Priority: Critical


I have the following resource:
{code}
@Path("/root")
public static class TestApp {
	private String name;
	private TestApp child;

	@GET
	@Produces(MediaType.TEXT_PLAIN)
	public String getNextChild() {
		return child == null ? null : child.name;
	}

	@Path("{child}")
	public Object getChild(@PathParam("child") String c) {
		if (child != null && child.name.equals(c)) {
			return child;
			} else {
				return new NotFound();
			}
		}
	}
}

public static class NotFound {
	@GET
	public Response notFound() {
		return Response.status(Status.NOT_FOUND).build();
	}
}
{code}

Which is registered like this:
{code}
@Override
public Set<Object> getSingletons() {
	Set<Object> set = new HashSet<Object>();
	TestApp test1 = new TestApp("test1", new TestApp("level1", new TestApp("level2", new TestApp("level3", null))));
	set.add(test1);
	return set;
}
{code}

When I do GET: http://localhos/root/level1/level2/level3

I get 404 File Not Found. The reason for this is because the "c" variable passed on the getChild method is always "level1" when it should change to "level2", "level3" after each call to getChild. 

Let me know if anything else is needed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WINK-311) Resource Locator's @PathParam resolution is not correct.

Posted by "Kaloyan Kolev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kaloyan Kolev updated WINK-311:
-------------------------------

    Attachment: RecursiveTreeTraversalTest.java

Here is the JUnit test I reproduce this with.

> Resource Locator's @PathParam resolution is not correct.
> --------------------------------------------------------
>
>                 Key: WINK-311
>                 URL: https://issues.apache.org/jira/browse/WINK-311
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.0
>         Environment: Recreated with a JUnit test.
>            Reporter: Kaloyan Kolev
>            Priority: Critical
>         Attachments: RecursiveTreeTraversalTest.java
>
>
> I have the following resource:
> {code}
> @Path("/root")
> public static class TestApp {
> 	private String name;
> 	private TestApp child;
> 	@GET
> 	@Produces(MediaType.TEXT_PLAIN)
> 	public String getNextChild() {
> 		return child == null ? null : child.name;
> 	}
> 	@Path("{child}")
> 	public Object getChild(@PathParam("child") String c) {
> 		if (child != null && child.name.equals(c)) {
> 			return child;
> 			} else {
> 				return new NotFound();
> 			}
> 		}
> 	}
> }
> public static class NotFound {
> 	@GET
> 	public Response notFound() {
> 		return Response.status(Status.NOT_FOUND).build();
> 	}
> }
> {code}
> Which is registered like this:
> {code}
> @Override
> public Set<Object> getSingletons() {
> 	Set<Object> set = new HashSet<Object>();
> 	TestApp test1 = new TestApp("test1", new TestApp("level1", new TestApp("level2", new TestApp("level3", null))));
> 	set.add(test1);
> 	return set;
> }
> {code}
> When I do GET: http://localhos/root/level1/level2/level3
> I get 404 File Not Found. The reason for this is because the "c" variable passed on the getChild method is always "level1" when it should change to "level2", "level3" after each call to getChild. 
> Let me know if anything else is needed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WINK-311) Resource Locator's @PathParam resolution is not correct.

Posted by "Kaloyan Kolev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kaloyan Kolev closed WINK-311.
------------------------------


Thank you for the quick fix. I was able to verify the problem is now resolved.

PS: Sorry for the copyright, I should have removed it.

> Resource Locator's @PathParam resolution is not correct.
> --------------------------------------------------------
>
>                 Key: WINK-311
>                 URL: https://issues.apache.org/jira/browse/WINK-311
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.0
>         Environment: Recreated with a JUnit test.
>            Reporter: Kaloyan Kolev
>            Assignee: Bryant Luk
>            Priority: Critical
>             Fix For: 1.1.2
>
>         Attachments: RecursiveTreeTraversalTest.java
>
>
> I have the following resource:
> {code}
> @Path("/root")
> public static class TestApp {
> 	private String name;
> 	private TestApp child;
> 	@GET
> 	@Produces(MediaType.TEXT_PLAIN)
> 	public String getNextChild() {
> 		return child == null ? null : child.name;
> 	}
> 	@Path("{child}")
> 	public Object getChild(@PathParam("child") String c) {
> 		if (child != null && child.name.equals(c)) {
> 			return child;
> 			} else {
> 				return new NotFound();
> 			}
> 		}
> 	}
> }
> public static class NotFound {
> 	@GET
> 	public Response notFound() {
> 		return Response.status(Status.NOT_FOUND).build();
> 	}
> }
> {code}
> Which is registered like this:
> {code}
> @Override
> public Set<Object> getSingletons() {
> 	Set<Object> set = new HashSet<Object>();
> 	TestApp test1 = new TestApp("test1", new TestApp("level1", new TestApp("level2", new TestApp("level3", null))));
> 	set.add(test1);
> 	return set;
> }
> {code}
> When I do GET: http://localhos/root/level1/level2/level3
> I get 404 File Not Found. The reason for this is because the "c" variable passed on the getChild method is always "level1" when it should change to "level2", "level3" after each call to getChild. 
> Let me know if anything else is needed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WINK-311) Resource Locator's @PathParam resolution is not correct.

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909975#action_12909975 ] 

Hudson commented on WINK-311:
-----------------------------

Integrated in Wink-Trunk-JDK1.5 #383 (See [https://hudson.apache.org/hudson/job/Wink-Trunk-JDK1.5/383/])
    Fix issue with PathParam not resolving last value

Thanks to Kaloyan Kolev for reporting the issue with test.

Thanks to Mike Rheinheimer for helping fix this issue.

See [WINK-311]


> Resource Locator's @PathParam resolution is not correct.
> --------------------------------------------------------
>
>                 Key: WINK-311
>                 URL: https://issues.apache.org/jira/browse/WINK-311
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.0
>         Environment: Recreated with a JUnit test.
>            Reporter: Kaloyan Kolev
>            Assignee: Bryant Luk
>            Priority: Critical
>             Fix For: 1.1.2
>
>         Attachments: RecursiveTreeTraversalTest.java
>
>
> I have the following resource:
> {code}
> @Path("/root")
> public static class TestApp {
> 	private String name;
> 	private TestApp child;
> 	@GET
> 	@Produces(MediaType.TEXT_PLAIN)
> 	public String getNextChild() {
> 		return child == null ? null : child.name;
> 	}
> 	@Path("{child}")
> 	public Object getChild(@PathParam("child") String c) {
> 		if (child != null && child.name.equals(c)) {
> 			return child;
> 			} else {
> 				return new NotFound();
> 			}
> 		}
> 	}
> }
> public static class NotFound {
> 	@GET
> 	public Response notFound() {
> 		return Response.status(Status.NOT_FOUND).build();
> 	}
> }
> {code}
> Which is registered like this:
> {code}
> @Override
> public Set<Object> getSingletons() {
> 	Set<Object> set = new HashSet<Object>();
> 	TestApp test1 = new TestApp("test1", new TestApp("level1", new TestApp("level2", new TestApp("level3", null))));
> 	set.add(test1);
> 	return set;
> }
> {code}
> When I do GET: http://localhos/root/level1/level2/level3
> I get 404 File Not Found. The reason for this is because the "c" variable passed on the getChild method is always "level1" when it should change to "level2", "level3" after each call to getChild. 
> Let me know if anything else is needed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WINK-311) Resource Locator's @PathParam resolution is not correct.

Posted by "Bryant Luk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryant Luk resolved WINK-311.
-----------------------------

    Fix Version/s: 1.1.2
       Resolution: Fixed

Thanks for reporting the issue.  I didn't use your testcase (created some different ones) because your file contained a copyright header, and it wasn't exactly immediately compatible with the existing Wink tests.  However, I think the fix should resolve your issue.  Michael Rheinheimer also helped create the fix.

> Resource Locator's @PathParam resolution is not correct.
> --------------------------------------------------------
>
>                 Key: WINK-311
>                 URL: https://issues.apache.org/jira/browse/WINK-311
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.0
>         Environment: Recreated with a JUnit test.
>            Reporter: Kaloyan Kolev
>            Assignee: Bryant Luk
>            Priority: Critical
>             Fix For: 1.1.2
>
>         Attachments: RecursiveTreeTraversalTest.java
>
>
> I have the following resource:
> {code}
> @Path("/root")
> public static class TestApp {
> 	private String name;
> 	private TestApp child;
> 	@GET
> 	@Produces(MediaType.TEXT_PLAIN)
> 	public String getNextChild() {
> 		return child == null ? null : child.name;
> 	}
> 	@Path("{child}")
> 	public Object getChild(@PathParam("child") String c) {
> 		if (child != null && child.name.equals(c)) {
> 			return child;
> 			} else {
> 				return new NotFound();
> 			}
> 		}
> 	}
> }
> public static class NotFound {
> 	@GET
> 	public Response notFound() {
> 		return Response.status(Status.NOT_FOUND).build();
> 	}
> }
> {code}
> Which is registered like this:
> {code}
> @Override
> public Set<Object> getSingletons() {
> 	Set<Object> set = new HashSet<Object>();
> 	TestApp test1 = new TestApp("test1", new TestApp("level1", new TestApp("level2", new TestApp("level3", null))));
> 	set.add(test1);
> 	return set;
> }
> {code}
> When I do GET: http://localhos/root/level1/level2/level3
> I get 404 File Not Found. The reason for this is because the "c" variable passed on the getChild method is always "level1" when it should change to "level2", "level3" after each call to getChild. 
> Let me know if anything else is needed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WINK-311) Resource Locator's @PathParam resolution is not correct.

Posted by "Bryant Luk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WINK-311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryant Luk reassigned WINK-311:
-------------------------------

    Assignee: Bryant Luk

> Resource Locator's @PathParam resolution is not correct.
> --------------------------------------------------------
>
>                 Key: WINK-311
>                 URL: https://issues.apache.org/jira/browse/WINK-311
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.0
>         Environment: Recreated with a JUnit test.
>            Reporter: Kaloyan Kolev
>            Assignee: Bryant Luk
>            Priority: Critical
>         Attachments: RecursiveTreeTraversalTest.java
>
>
> I have the following resource:
> {code}
> @Path("/root")
> public static class TestApp {
> 	private String name;
> 	private TestApp child;
> 	@GET
> 	@Produces(MediaType.TEXT_PLAIN)
> 	public String getNextChild() {
> 		return child == null ? null : child.name;
> 	}
> 	@Path("{child}")
> 	public Object getChild(@PathParam("child") String c) {
> 		if (child != null && child.name.equals(c)) {
> 			return child;
> 			} else {
> 				return new NotFound();
> 			}
> 		}
> 	}
> }
> public static class NotFound {
> 	@GET
> 	public Response notFound() {
> 		return Response.status(Status.NOT_FOUND).build();
> 	}
> }
> {code}
> Which is registered like this:
> {code}
> @Override
> public Set<Object> getSingletons() {
> 	Set<Object> set = new HashSet<Object>();
> 	TestApp test1 = new TestApp("test1", new TestApp("level1", new TestApp("level2", new TestApp("level3", null))));
> 	set.add(test1);
> 	return set;
> }
> {code}
> When I do GET: http://localhos/root/level1/level2/level3
> I get 404 File Not Found. The reason for this is because the "c" variable passed on the getChild method is always "level1" when it should change to "level2", "level3" after each call to getChild. 
> Let me know if anything else is needed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.