RE: Restlet vs. NetKernel?

2006-06-27 Thread Jerome Louvel

FYI, two interesting pointers talking about NetKernel:

"The 1060 REST microkernel and XML app server"
http://weblog.infoworld.com/udell/2004/02/26.html 

"A conversation with Peter Rodgers about the 1060 NetKernel"
http://weblog.infoworld.com/udell/2006/06/02.html#a1460

I'd also be interested to hear anyone who has experience on both frameworks.

Thanks,
Jerome

> -Message d'origine-
> De : John D. Mitchell [mailto:[EMAIL PROTECTED] 
> Envoyé : samedi 27 mai 2006 07:17
> À : discuss@restlet.tigris.org
> Objet : Restlet vs. NetKernel?
> 
> Anybody used NetKernel in production who can compare and contrast the
> Restlet approach with the approach taken by NetKernel?
> 
> Take care,
> John


RE: Restlet & AsyncWeb?

2006-06-27 Thread Jerome Louvel

Hi John,

FYI, a new HTTP server connector based on AsyncWeb was introduced in beta
15. This integration effort was done by Lars Heuer: thanks Lars :) Let us
know if it works well for you. 

We also discussed the development of a pure Mina-based HTTP connector that
would let us fully leverage the NIO aspects of the Restlet API, reduce the
number of dependencies and allow us to directly build the Restlet call
objects instead of having to convert them from the connector's own model.
Lars will be leading the development effort for this Min HTTP server
connector.

Thanks,
Jerome

> -Message d'origine-
> De : John D. Mitchell [mailto:[EMAIL PROTECTED] 
> Envoyé : samedi 27 mai 2006 07:15
> À : discuss@restlet.tigris.org
> Objet : Restlet & AsyncWeb?
> 
> Anybody played with AsyncWeb?  Seems like it might be a nice 
> fit with Restlet.
> 
> John


Re: Javascript Client Connector

2006-06-27 Thread Jerome Louvel

FYI, I've entered an issue to keep track of this feature request:
http://restlet.tigris.org/issues/show_bug.cgi?id=129

--
Jerome Louvel
http://www.restlet.org


RE: Name changes

2006-06-27 Thread Jerome Louvel

Now that beta 15 is out, let me explain the answers I gave to the
thoughts/questions I raised in this thread:

> 01) an IDENTIFIER references one and only one RESOURCE
Was already supported

> 02) a RESOURCE can be identified by one or more identifiers
Was already supported.

> 03) a REPRESENTATION can also be considered as a RESOURCE in itself
Supported in beta 15, the Representation interface now extends Resource.

> 04) a REPRESENTATION can therefore have IDENTIFIERs (used in HTTP)
Now supported becasue Representation extends Resource, see below.

> 05) the state of a RESOURCE contains a set of IDENTIFIERs and 
> REPRESENTATIONs
Supported in beta 15: added getIdentifier(), setIdentifier() and
getIdentifiers() methods to Resource interface. Also added getVariants()
method returning a modifiable list of variants.

> 06) i'm not sure if WORKERs should directly implement the 
> RESOURCE interface or only provide a way to 
> identify/instantiate RESOURCES
The concept of WORKER was generalized into the one of HANDLER, which is also
a super interface of ROUTER, FILTER and SCORER. It does contain a
findNext(Call) method returning the next Restlet. So, a Resource can be
returned because in beta 15, the Resource interface extends Restlet.

> 07) a REST call invokes a standardized METHOD on an 
> identified RESOURCE
Yes, and this contract is now fully supported by the Resource interface
which extends Restlet. Therefore any method can be handled by a Resource.
The AbstractResource class automatically implemented the GET method based on
the exposed variant representations (getVariants()), doing some content
negotiation.

> 08) the identification task is currently handled by a tree of 
> MAPLETs (or ROUTERs)
True, the renaming of MAPLET to ROUTER was done in beta 15.

> 09) a RESOURCE is stateful (owned by one thread)
False, it is up to the developer to decide on this. It is totally possible
to have stateless Resources, similar to EJB Session beans, for example for
POST processing purpose.

> 10) a CHAINLET (or FILTER) is stateless (shared by multiple threads)
True, this is now enforced by the Restlet API as class attachment was
removed in beta 15.

> 11) a MAPLET (or ROUTER) is stateless (shared by multiple threads)
True, this is now enforced by the Restlet API as class attachment was
removed in beta 15.

> 12) a WORKER would also be stateless (shared by multiple threads)
HANDLERs introduced in beta 15 are intended to be stateless.

> 13) can't we merge WORKER with ROUTERs so that we could 
> directly attach RESOURCEs (class) to them?
No because, there is often the need to provide some custom logic to
(re-)instantiate the target Resource, especially if it is statefull. Like if
a database request is required. So, frequently there will be a
ResourceHandler between the Router and the target Resource, responsible for
this lookup/instantiation.

> 14) should we rename REPRESENTATION into CONTENT or ENTITY 
> and add a new REPRESENTATION interface that would extend both 
> CONTENT and RESOURCE (to support the idea that a 
> REPRESENTATION is a RESOURCE while keeping a clean/simple 
> interface to deal with content).
Instead of separation, the Representation was merged with
RepresentationMetadata, but there is a more precise contract (new methods)
to deal with the actual content of the representation which can be served
fresh multiple times (when technically possible). See "transient"
properties/methods added in beta 15 on Representation.

> 15) in order to support the "vary" header for content 
> negotiation, we need to add a way to know/tell the variant 
> dimensions (language, encoding, media type, client address, 
> user agent, custom, etc.)
Added an issue to bugs database.

> 16) support the "Content-location" header by identifying 
> output REPRESENTATIONS
The "outputRef" property ends up in this "content-location" header for HTTP
server connectors.

> 17) support the HTTP status 300 (multiple choices) when the 
> content negotiation is not applied (or can't be applied)
Added an issue to bugs database.

> 18) if we refactor REPRESENTATION as proposed above, we could 
> add a property for the parent/represented RESOURCE
Was already present in beta 14!

> 19) should we rename REFERENCE into IDENTIFIER to be more 
> consistent with the REST terminology or keep the current term 
> which is used by the URI standard?
No we'll keep the current approach, a REFERENCE is different as it may
contain extra information, like a fragment part. However, the related
methods on Resource interface are named using the "identifier" root.

> 20) should we rename "redirectionRef" into "contentRef" or 
> better "outputRef" to support specifying the IDENTIFIER of 
> all REPRESENTATIONs, and not just for redirections? No need 
> for that if we allow the setting of a REFERENCE or IDENTIFIER 
> for each REPRESENTATION
"redirectionRef" was renamed to "outputRef" in beta 15. We also have to
ability to set identifiers for Representations in beta 

RE: Hierarchical Path Components without contextMatches?

2006-06-27 Thread Jerome Louvel

Hi Evan,

> I'm working on converting my code over to use the new 1.0B15 (about 
> which I am quite excited). I had previously built up 
> hierarchical URIs 
> using chained Maplets and custom Call implementations, which 
> worked out 
> like this:
> 
> /users/([EMAIL PROTECTED])[/]? was handled by UserMaplet, which, in its 
> handle(Call) method, wrapped the original call with a UserCall (which 
> contained the user corresponding to the matched part of the 
> path), and 
> called super.handle(Call).

To store the user name you could also rely on call attributes:
call.getAttributes().put("user", userName);

That would remove the need to subclass Call. However if you need some custom
logic or to override/extend the default behavior or state, then using
WrapperCall is the way to go.

> /users/([EMAIL PROTECTED])[/]?/sections/([A-Za-z0-9-]+)[/]? was handled by a 
> SectionMaplet chained on to a UserMaplet. It wrapped incoming 
> calls in a 
> UserCall subclass, which added a section (corresponding to the second 
> regexp group) based on the user passed in through the UserCall.

OK

> I'm not quite sure how to handle this in 1.0B15. Was my original 
> approach flawed? I would be very grateful to hear any ideas about the 
> best way to implement this kind of structure!

It seems that you complicate yourself with slashes. What about something
like:

  Builders.buildContainer()
.addServer("EvanServer", Protocols.HTTP, 8182)
  .attachLog("EvanServer")
.attachStatus(true, "[EMAIL PROTECTED]", "http://www.mysite.org";)
  .attachHost(8182)
.attachRouter("/users")
  .attachRouter("/[EMAIL PROTECTED]")
.attach("$", userHandler).upRouter()
.attachRouter("/sections")
  .attachRouter("/[A-Za-z0-9-]+")
.attach("$", sectionHandler).owner().start();

Now in UserHandler and SectionHandler, you should rely on the following
approach to get your user name and section name:
call.getResourceRef().getLastSegment();

In case in need a segment that was higher in the hierarchy, you also have:
call.getResourceRef().getSegments() : List

Let me know if that works for you!

Thanks,
Jerome

PS: The attachRouter() method in RouterBuilder is named attachPath() instead
of attachRouter() in beta 15. Will be fixed in beta 16.