Is it possible to get the json data from a restService using code instead of using the pathinfo?
looking for something like: getComponent("restService1").get...
<xe:restService id="restService1" pathInfo="rest">
<xe:this.service>
<xe:jdbcQueryJsonService connectionName="mssql" contentType="application/json">
<xe:this.sqlQuery><![CDATA[SELECT * FROM Order]]></xe:this.sqlQuery>
</xe:jdbcQueryJsonService>
</xe:this.service>
</xe:restService>
I don't think that this is possible without deeply hacking into the core ExtLib REST services.
In these services, the output is generated and written to the defined output stream, which is normally the one from the HttpResponse.
You have two options for this:
For both options I don't think that this is worth the effort. It's a lot easier to create your own JDBC connection to the SQL server and transform the result to JSON by your own.
EDIT:
Don't forget that you are accessing a component. A component doesn't know something about the output, which is generated by the renderer depending of the current state of the component. While the ExtLib REST Services are a little bit different of the JSF concepts (their output is generated by a servlet), the pattern is the same.
That's why no XPages / JSF component has such a method.