You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Davanum Srinivas (JIRA)" <ji...@apache.org> on 2010/01/27 17:00:34 UTC
[jira] Created: (WINK-246) Problem(?) with JAXB based sub resource
Problem(?) with JAXB based sub resource
---------------------------------------
Key: WINK-246
URL: https://issues.apache.org/jira/browse/WINK-246
Project: Wink
Issue Type: Bug
Reporter: Davanum Srinivas
With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
{code:title=Hello.java|borderStyle=solid}
package org.apache.wink;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/helloservice")
public class Hello {
@GET
@Path("/hello")
@Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
public World getClichedMessage() {
World world = new World();
world.setName("Earth");
world.setId(0);
return world;
}
}
{code}
{code:title=World.java|borderStyle=solid}
package org.apache.wink;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "World")
public class World {
private long id;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@GET
@Path("/name")
@Produces(MediaType.APPLICATION_XML)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
{code}
{noformat}
220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
{noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WINK-246) Problem(?) with JAXB based sub resource
Posted by "Bryant Luk (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryant Luk resolved WINK-246.
-----------------------------
Resolution: Invalid
Dims, I'll mark this invalid unless you believe we should do something differently or my interpretation is wrong. For this issue, I do not believe we should go against the spec because it can lead to unpredictable situations. For instance, some users could re-use the same class in a sub resource locator and also in a subresource method and could be counting on the JAX-RS spec behavior.
> Problem(?) with JAXB based sub resource
> ---------------------------------------
>
> Key: WINK-246
> URL: https://issues.apache.org/jira/browse/WINK-246
> Project: Wink
> Issue Type: Bug
> Reporter: Davanum Srinivas
> Assignee: Bryant Luk
>
> With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
> {code:title=Hello.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> @Path("/helloservice")
> public class Hello {
> @GET
> @Path("/hello")
> @Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
> public World getClichedMessage() {
> World world = new World();
> world.setName("Earth");
> world.setId(0);
> return world;
> }
> }
> {code}
> {code:title=World.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
> import javax.xml.bind.annotation.XmlRootElement;
> @XmlRootElement(name = "World")
> public class World {
> private long id;
> private String name;
> public long getId() {
> return id;
> }
> public void setId(long id) {
> this.id = id;
> }
> @GET
> @Path("/name")
> @Produces(MediaType.TEXT_PLAIN)
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> }
> {code}
> {noformat}
> 220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
> 220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (WINK-246) Problem(?) with JAXB based sub resource
Posted by "Bryant Luk (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryant Luk reassigned WINK-246:
-------------------------------
Assignee: Bryant Luk
> Problem(?) with JAXB based sub resource
> ---------------------------------------
>
> Key: WINK-246
> URL: https://issues.apache.org/jira/browse/WINK-246
> Project: Wink
> Issue Type: Bug
> Reporter: Davanum Srinivas
> Assignee: Bryant Luk
>
> With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
> {code:title=Hello.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> @Path("/helloservice")
> public class Hello {
> @GET
> @Path("/hello")
> @Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
> public World getClichedMessage() {
> World world = new World();
> world.setName("Earth");
> world.setId(0);
> return world;
> }
> }
> {code}
> {code:title=World.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
> import javax.xml.bind.annotation.XmlRootElement;
> @XmlRootElement(name = "World")
> public class World {
> private long id;
> private String name;
> public long getId() {
> return id;
> }
> public void setId(long id) {
> this.id = id;
> }
> @GET
> @Path("/name")
> @Produces(MediaType.TEXT_PLAIN)
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> }
> {code}
> {noformat}
> 220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
> 220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WINK-246) Problem(?) with JAXB based sub
resource
Posted by "Bryant Luk (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805561#action_12805561 ]
Bryant Luk commented on WINK-246:
---------------------------------
I don't believe this is an issue from the JAX-RS 1.0 spec point of view. Basically the request method matching stops because you have an @GET on the getClichedMessage(). If on the other hand, you had something like:
{code}
@Path("/helloservice")
public class Hello {
@Path("/hello")
public World getClichedMesage() {
.....
return world;
}
}
{code}
{code}
public class World {
......
@GET
public World get() {
return this;
}
@GET
@Path("/name")
@Produces("text/plain")
public String getName() {
.....
}
}
{code}
that might work a bit better for you.
>From a JAX-RS spec point of view (3.7.2 Request Matching) for the 404 request, assume step 1 is complete. step 2(c)i adds in "getClichedMessage" as a possible sub-resource *method* (i.e. not locator since you have the @GET). step 2(d) second bullet removes "getClichedMessage" from the list of possible methods. Step 2(e) then gives you the 404.
> Problem(?) with JAXB based sub resource
> ---------------------------------------
>
> Key: WINK-246
> URL: https://issues.apache.org/jira/browse/WINK-246
> Project: Wink
> Issue Type: Bug
> Reporter: Davanum Srinivas
>
> With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
> {code:title=Hello.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> @Path("/helloservice")
> public class Hello {
> @GET
> @Path("/hello")
> @Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
> public World getClichedMessage() {
> World world = new World();
> world.setName("Earth");
> world.setId(0);
> return world;
> }
> }
> {code}
> {code:title=World.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
> import javax.xml.bind.annotation.XmlRootElement;
> @XmlRootElement(name = "World")
> public class World {
> private long id;
> private String name;
> public long getId() {
> return id;
> }
> public void setId(long id) {
> this.id = id;
> }
> @GET
> @Path("/name")
> @Produces(MediaType.TEXT_PLAIN)
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> }
> {code}
> {noformat}
> 220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
> 220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WINK-246) Problem(?) with JAXB based sub resource
Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-246?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Davanum Srinivas updated WINK-246:
----------------------------------
Description:
With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
{code:title=Hello.java|borderStyle=solid}
package org.apache.wink;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/helloservice")
public class Hello {
@GET
@Path("/hello")
@Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
public World getClichedMessage() {
World world = new World();
world.setName("Earth");
world.setId(0);
return world;
}
}
{code}
{code:title=World.java|borderStyle=solid}
package org.apache.wink;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "World")
public class World {
private long id;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@GET
@Path("/name")
@Produces(MediaType.TEXT_PLAIN)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
{code}
{noformat}
220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
{noformat}
was:
With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
{code:title=Hello.java|borderStyle=solid}
package org.apache.wink;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/helloservice")
public class Hello {
@GET
@Path("/hello")
@Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
public World getClichedMessage() {
World world = new World();
world.setName("Earth");
world.setId(0);
return world;
}
}
{code}
{code:title=World.java|borderStyle=solid}
package org.apache.wink;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "World")
public class World {
private long id;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@GET
@Path("/name")
@Produces(MediaType.APPLICATION_XML)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
{code}
{noformat}
220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
{noformat}
> Problem(?) with JAXB based sub resource
> ---------------------------------------
>
> Key: WINK-246
> URL: https://issues.apache.org/jira/browse/WINK-246
> Project: Wink
> Issue Type: Bug
> Reporter: Davanum Srinivas
>
> With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
> {code:title=Hello.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> @Path("/helloservice")
> public class Hello {
> @GET
> @Path("/hello")
> @Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
> public World getClichedMessage() {
> World world = new World();
> world.setName("Earth");
> world.setId(0);
> return world;
> }
> }
> {code}
> {code:title=World.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
> import javax.xml.bind.annotation.XmlRootElement;
> @XmlRootElement(name = "World")
> public class World {
> private long id;
> private String name;
> public long getId() {
> return id;
> }
> public void setId(long id) {
> this.id = id;
> }
> @GET
> @Path("/name")
> @Produces(MediaType.TEXT_PLAIN)
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> }
> {code}
> {noformat}
> 220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
> 220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WINK-246) Problem(?) with JAXB based sub
resource
Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805785#action_12805785 ]
Davanum Srinivas commented on WINK-246:
---------------------------------------
thanks Bryant. that's fine with me. i'll try it out when i get a chance and re-open the bug if needed.
-- dims
> Problem(?) with JAXB based sub resource
> ---------------------------------------
>
> Key: WINK-246
> URL: https://issues.apache.org/jira/browse/WINK-246
> Project: Wink
> Issue Type: Bug
> Reporter: Davanum Srinivas
> Assignee: Bryant Luk
>
> With this sample, http://localhost:8080/jaxb-wink/rest/helloservice/hello shows me the xml i expect, but http://localhost:8080/jaxb-wink/rest/helloservice/hello/name fails with logs below.
> {code:title=Hello.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> @Path("/helloservice")
> public class Hello {
> @GET
> @Path("/hello")
> @Produces(javax.ws.rs.core.MediaType.APPLICATION_XML)
> public World getClichedMessage() {
> World world = new World();
> world.setName("Earth");
> world.setId(0);
> return world;
> }
> }
> {code}
> {code:title=World.java|borderStyle=solid}
> package org.apache.wink;
> import javax.ws.rs.GET;
> import javax.ws.rs.Path;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
> import javax.xml.bind.annotation.XmlRootElement;
> @XmlRootElement(name = "World")
> public class World {
> private long id;
> private String name;
> public long getId() {
> return id;
> }
> public void setId(long id) {
> this.id = id;
> }
> @GET
> @Path("/name")
> @Produces(MediaType.TEXT_PLAIN)
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
> }
> {code}
> {noformat}
> 220361 [http-8080-1] INFO org.apache.wink.server.internal.RequestProcessor - WebApplicationException (404 - Not Found) occured during the handlers chain invocation
> 220362 [http-8080-1] INFO org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler - Content-Type not specified via Response object or via @Produces annotation so automatically setting via generic-type compatible MessageBodyWriter providers
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.