What is the Session interface really doing for you? It doesn't look as
though the abstract method is used in an essential way.

Thought experiment: Comment out the abstract createSession method and put
@Post in front of each concrete implementation of createSession. Still
works, right? So there's no need for the method signatures to be the same.
They don't even need to use the same name. You might as well use more
specific signatures, especially in the case of Form, for which Restlet
provides nice automatic conversion.

--tim


On Mon, Aug 8, 2011 at 7:06 PM, Paul Morris <[email protected]> wrote:

> The interface is part of a very generic API for managing sessions and it's
> meant to support a wide variety of implementations, different session
> provisioners, etc.
>
> public interface Session {
>    @Post abstract Representation createSession(Representation entity);
>    // Other methods.
> }
>
> So my implementation supports webform params as in:
>
> username=pmorris&password=pmorrispmorris
>
> as well as HTTP Basic Authentication (details in the Auth header, null
> entity body)
>
> But some other developer implementing the interface may pass in some other
> Representation like JSON or XML, something that you wouldn't be consuming by
> casting to it a Form. Like:
>
> { "username" : "pmorris", "password" : "pmorrispmorris" }
>
> With Representation he can pass in whatever he wants and work out the
> details in his concrete implementation.
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2812646

Reply via email to