users@jersey.java.net

Re: [Jersey] Documentation for 1.0

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 02 Oct 2008 12:56:05 +0100

On Oct 2, 2008, at 12:45 PM, tarjei wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
> I actually forgot one point.
>
> The section on query params is generally very good, but what happens
> if
> you do not define a default for a queryparam?
>
> public String getSomething(@QueryParam("test") Integer test) {
> // what is the value of test now?
> }
>

Good point. I will mention that briefly and point to the JavaDoc or
specification for more details.

Paul.

> Regards,
> Tarjei
> tarjei wrote:
>> 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
>>
>>
>
> -
> ---------------------------------------------------------------------
> 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
>
> iD8DBQFI5LRsYVRKCnSvzfIRAis0AJ42A4kbyZrOWrO0RVUr9/25TLtBugCguYSS
> 2HDo2bJ5rBPyRKxIUZuh/dY=
> =ntKG
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>