Like I said we could do that though it still requires more than one line of
code in each function. We currently use init to determine resource available
and setting the allowed actions (i.e. allowPost) in the init which as far as
I know can only be done there.

On Fri, Dec 11, 2009 at 1:52 PM, Tim Peierls <tpeie...@gmail.com> wrote:

> Wouldn't it be just a matter of calling a single private method at the top
> of each of the method handlers?
>
> --tim
>
>
> On Fri, Dec 11, 2009 at 4:49 PM, Jean-Philippe Steinmetz <
> caskate...@gmail.com> wrote:
>
>> Good question. We use the init to verify the resource actually exists as
>> well as handling other bits. So the question is is mainly in interest of
>> finding an easier way to get it done that won't cause us to redo a lot of
>> boiler plate code all over the method handlers.
>>
>>
>> On Fri, Dec 11, 2009 at 12:37 PM, Tim Peierls <t...@peierls.net> wrote:
>>
>>> Why not move the functionality that you currently have in the init method
>>> into each of the HTTP method handlers (and remove this functionality and the
>>> @Transactional annotation from init)?
>>>
>>> --tim
>>>
>>>
>>> On Fri, Dec 11, 2009 at 2:57 PM, Jean-Philippe Steinmetz <
>>> caskate...@gmail.com> wrote:
>>>
>>>> Hello all,
>>>>
>>>> It's been a long time since i've last posted. Been pretty happily
>>>> working with restlet 1.1 for some time now. I've come across an
>>>> issue/optimization that i'm trying to solve that i'd like to get your
>>>> thoughts on.
>>>>
>>>> We are using Spring's AOP and Transaction Management to handle a lot of
>>>> our database access. This has greatly simplified our code and we're loving
>>>> it. Right now we apply the @Transactional annotation for each of the
>>>> functions in the resource class. Therefore the init function has it,
>>>> acceptRepresentation has it and so on. The init function will initially 
>>>> pull
>>>> the resource in one transaction and the subsequent method handlers
>>>> potentially open a second transaction to further process changes.
>>>>
>>>> The issue for us is that we are trying to keep the original select and
>>>> update calls in the same transaction to ensure transactional integrity. The
>>>> only way I know of to make this work is to put the @Transactional 
>>>> annotation
>>>> at a higher level so that the transaction is open for the entire life of 
>>>> the
>>>> resource handler execution. Unfortunately I have been unable to find a way
>>>> to do this with restlet. How can I make @Transactional to take affect at a
>>>> higher level than the resource? Is there a way to override the resource
>>>> router or is there some already built-in mechanism that I need to enable or
>>>> set up?
>>>>
>>>> Thanks in advance,
>>>>
>>>> Jean-Philippe Steinmetz
>>>>
>>>
>>>
>>
>

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

Reply via email to