Currently I supply my own RequestListener. This listener does almost
the same thing as the HttpKernel; it resolves to a controller (or
service in my case) in the "Service" directory of a bundle. And
executes the method described by the JSON-RPC request.

So why not reuse the framework for this? It has a very convenient
ControllerResolverInterface for this. The request -> controller ->
response flow can benefit from all those wonderful features Symfony2
has to offer?

Modifying the ControllerResolver or the service definition causes the
project to fork, which I consider a bad thing. Should I create a
feature request for a resolve event?

On Dec 27, 6:08 pm, Lukas Kahwe Smith <[email protected]> wrote:
> On 27.12.2010, at 18:00, Martijn wrote:
>
>
>
> > First of all ParamConverters look very nice but don't help my cause.
> > The view is used to create the response but the problem is at the
> > request. This is how it should work:
>
> > 1. HTTP client sends "json/application" POST request with this body
> > data: {"jsonrpc": "2.0", "method": "calculator.subtract", "params":
> > [42, 23], "id": 1}
> > 2. The HttpKernel asks the resolver to return a controller and
> > arguments.
> > 3. "ServiceResolver::getController" returns "HelloBundle\Service
> > \Calculator::substractAction" method.
> > 4. "ServiceResolver::getArguments" returns the parameters 42 and 23
> > (or parameter object? parameters can be named in some transport
> > protocols such as JSON-RPC)
> > 5. The service controller method "HelloBundle\Service
> > \Calculator::substractAction" returns the response object (possibly
> > helped by Twig or a JSON-RPC response builder)
>
> > The problem here is the resolver. How can I swap it for my own
> > implementation?
>
> I guess you could do this via a simple forward from a generic controller. 
> Similar to what I did for the MultiplexBundle [1].
>
> But sure the "cleaner" solution would be to override the resolver. But what 
> makes you believe you can't do this?
>
>         <parameter 
> key="controller_resolver.class">Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver</parameter>
>
>         <service id="controller_resolver" class="%controller_resolver.class%">
>             <argument type="service" id="service_container" />
>             <argument type="service" id="controller_name_converter" />
>             <argument type="service" id="logger" on-invalid="ignore" />
>         </service>
>
> Seems like you should be able to adjust either just the class or the entire 
> definition of the service.
>
> regards,
> Lukas Kahwe Smith
> [email protected]
>
> [1]https://github.com/liip/MultiplexBundle

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to