I'm a new RESTlet user and I was wondering if it's possible to route 
dynamically based on templates retrieved from a database in order to allow new 
templates to be added without changing any code? My plan is to have a table of 
URL templates together with their mappings, per request type, to stored 
procedure calls. The resource would then construct the stored procedure call 
based on which template was matched and map the parameters in the template to 
the procedure parameters.

For example:

URL                     Request         Stored Procedure
/customers              GET             CustomersGet()
                        POST            CustomerCreate(name...)
/customers/{cus}        GET             CustomersGetById(cus)
/invoices               GET             InvoicesGet()
/invoices/{inv}         GET             InvoicesGetById(inv)

I wanted to have a single resource class that would be called for all templates 
that could, based on the template that matched and the request, look-up the 
stored procedure and construct the call to it dynamically by taking the 
parameters extracted by the framework and any supplied in the request body and 
matching them to the stored procedure parameters. Unfortunately I couldn't find 
a way to get the template that was matched.

The background behind this is that I am trying to create a system whereby new 
web applications can be developed without changing any Java code, simply by 
implementing the relevant stored procedures in the database and changing the 
configuration (it's not a problem if a server restart is required). All 
resources, such as HTML pages, JPEGs, Freemarker templates etc. are stored in 
the backend database as BLOBs are are served from there so that they can be 
easily modified and new ones uploaded.

Thanks in advance,

Tim.

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

Reply via email to