hi,
> Hi,
>
> (I retransmit it because the transmission did not reach well)
>
> Currently, HTTP routing and implementation are separated. Example:
>
> ------------------------------
> class SampleApiApp(app_manager.RyuApp):
> \x85.
> def __init__(self, *args, **kwargs):
> \x85.
> wsgi = kwargs['wsgi']
> mapper = wsgi.mapper
> mapper.connect('sample', '/sample/{dpid}',
> controller=SampleController,
> action='sample_get',
> conditions=dict(method=['GET']),
> requirements={'dpid':
> dpidlib.DPID_PATTERN})
> \x85.
> class SampleController(ControllerBase):
> \x85.
> def sample_get(self, req, **_kwargs):
> \x85.
> ------------------------------
>
> By this design, the application needs to know the structure (method name)
> of the controller. And if the controller is changed, a change will become
> necessary for the application.
>
> Therefore I would like to propose decoration based API. Example:
>
> ------------------------------
> class SampleApiApp(app_manager.RyuApp):
> \x85.
> def __init__(self, *args, **kwargs):
> \x85.
> wsgi = kwargs['wsgi']
> wsgi.register(SampleController)
> \x85.
> class SampleController(ControllerBase):
>
> @route('sample', '/sample/{dpid}',
> methods=['GET'], requirements={'dpid': dpidlib.DPID_PATTERN})
> def sample_get(self, req, dpid, **_kwargs):
> \x85.
> ------------------------------
>
> It is not necessary to change the application even if the controller is
> changed. And readability increases because there are routing and
> implementation in the same place. Furthermore, this will conceal Routes API.
>
> This idea was inspired from Flask and Bottle of Python and JAX-RS of Java.
i like the idea.
YAMAMOTO Takashi
>
> Thanks,
> Satoshi
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel