-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi, this looks very good!
Paul Sandoz wrote:
> First complete draft done:
>
> http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features
Trying to be the devils advocate with regard to the above document, I
came up with a few inputs:
1. Maybe some of the examples should be methods for a PUT or HEAD
request - just to show that they are treated the same?
2. An example of a a POST handling file upload would probably be a good
idea.
3. In the same way, maybe an example showing how to return a binary file
, something like:
@GET
@Path("/images/{image}")
@Produces("*/*")
public Response getImage(@PathParam("image") String image) {
File f = new File(image);
if (!f.exists()) {
// File is not present
log.error("No file " + f.getAbsolutePath() + "present in the
database");
throw new WebApplicationException(404);
}
String mt = null;
InputStream in = null;
try {
mt = new MimetypesFileTypeMap().getContentType(f);
in = new BufferedInputStream(new FileInputStream(f));
} catch (FileNotFoundException e) {
throw new WebApplicationException(404);
}
Response r = Response.ok(in).type(mt).build();
return r;
}
4. Is there a difference between @PATH("/test" and @PATH("/test/") and
@PATH("test/") ? If not, state that - and if there is explain it :)
Hmm, maybe there should be way to test anotations? Something like:
JerseyTest jersey = new JerseyTest(new myResource());
Response r = jersey.request(JerseyTest.GET, "/someurl");
? I'm not sure if it is a good idea, but right now annotations are a bit
like untestable code.
5. One thing I feel is missing is some hints on the relationship between
a representation and JAXB. This might be because I'm a JAXB newbie, but
that is an area where there is a lot of "magic" so to explain it fully
might be a good idea - probably with a small example like:
class User {
String username;
}
@PATH("/")
class MyResource {
@GET
User getUser(){}
@POST
User updateUser(User user) {}
}
...
+ an example of what the client may post to modify this user.
Ok, I guess this is quite a lot, but my last point is more general for a
lot of java documentation: The classes referenced in the text should be
links so that it is possible to quickly find the javadoc of a special
class.
Apart from that, good work !
I hope this isn't too overwhelming - also I might have missed something
in the docs.
Kind regards,
Tarjei
>
> Paul.
>
> On Sep 29, 2008, at 6:04 PM, Paul Sandoz wrote:
>
>> Hi,
>>
>> I have started filling out a brief overview of JAX-RS 1.0:
>>
>> http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features
>>
>> in preparation for the 1.0 release.
>>
>> I plan to do two more:
>>
>> 1) An over of advanced JAX-RS 1.0 features
>>
>> 2) An overview of Jersey features.
>>
>> Feel free to provide feedback. Do people find this sort of thing useful?
>>
>> Paul.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFI5LLIYVRKCnSvzfIRAmgYAJ4i+cfhmvbbjTWSOAmR2++upgz/VwCbBdwC
/C/QzP6dHoUGiSpPic30kq0=
=YlFU
-----END PGP SIGNATURE-----