Why don't you pass the relevant information in the HTTP payload? You can
define a Java bean that contains all the information you need to pass and
then use that as a method parameter.

On Tue, Mar 29, 2016 at 10:49 AM, Himasha Guruge <himas...@wso2.com> wrote:

> Hi Hasitha,
>
> Thanks for the provided suggestions. I tested the suggested approaches and
> we can go ahead with HttpRequest injection and the usage of @QueryParam.
>
>
> Regards,
> Himasha
>
> On Fri, Mar 25, 2016 at 11:02 AM, Hasitha Aravinda <hasi...@wso2.com>
> wrote:
>
>> Hi team,
>>
>> Please find my comments inline.
>>
>> On Fri, Mar 25, 2016 at 10:27 AM, Himasha Guruge <himas...@wso2.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> I'm in the process of rewriting our existing BPMN REST API for C5, with
>>> msf4j in place. While checking the used annotations in the code,  I came
>>> across the use of @Context annotation in order to inject UserInfo [1]
>>>  interface which provides access to application and request URI
>>> information. We have used following two methods of this interface
>>> throughout the code.
>>>
>>> (1) QueryParameters()
>>> (2) getBaseUri()
>>>
>>
>> Do we have an equlent for
>> ​
>> uriInfo.getBaseUri in MSF4J supported annotation ? Can't we use
>> io.netty.handler.codec.http.HttpRequest.getUri()
>> ​ ​
>>
>> ​?​
>>
>>
>> I tested if it's possible to inject UriInfo interface in msf4j by
>>> deploying a simple microservice sample (which uses @Context UriInfo info)
>>>  which failed with an error in executing the request, which means the
>>> injection of it is not possible with current msf4j implementation. [2]
>>>
>>> In [2] it is mentioned that there is @QueryParam annotation support in
>>> msf4j which we can use alternatively where we would have to pass the query
>>> parameter to the method in the same way we use @PathParam. See usage in [3].
>>>
>>> However, issues arise in following scenarios.
>>>
>>>  For example, In ModelService[4] we have a large  range of allowed
>>>  query params (name,nameLike,category,categoryLike etc) for a method, and
>>> based on the query params that the user has  passed (by using
>>> uriInfo.getQueryParameters()) we process the request accordingly.   In such
>>> a case if we are to use @
>>> ​​
>>> QueryParam it would mean we would have to pass all possible query
>>> parameters (Around 15) to the method.
>>>
>>
>> I think this is should be ok.
>>
>> ​
>>>
>>>
>> Also, we have used
>>> ​​
>>> uriInfo.getBaseUri() method throughout as well.
>>>
>>> How are we going to proceed with this? Appreciate your suggestions on
>>> this.
>>>
>>> [1]
>>> https://jsr311.java.net/nonav/releases/1.1/javax/ws/rs/core/UriInfo.html
>>>
>>>
>>> [2]
>>> https://docs.wso2.com/display/MSF4J100/Key+Concepts#KeyConcepts-Supportedannotations
>>>
>>> [3] http://www.mkyong.com/webservices/jax-rs/jax-rs-queryparam-example/
>>>
>>> [4]
>>> https://github.com/wso2/carbon-business-process/blob/de4d3ca5a2c3d670dcbf07ee6b58f0afd9489e95/components/bpmn/org.wso2.carbon.bpmn.rest/src/main/java/org/wso2/carbon/bpmn/rest/service/repository/ModelService.java#L98
>>>
>>> Regards,
>>>
>>> Himasha Guruge
>>> *Software Engineer*
>>> WS*O2* *Inc.*
>>> Mobile: +94 777459299
>>> himas...@wso2.com
>>>
>>
>> ​Thanks,
>> Hasitha. ​
>>
>>
>>
>>
>> --
>> --
>> Hasitha Aravinda,
>> Senior Software Engineer,
>> WSO2 Inc.
>> Email: hasi...@wso2.com
>> Mobile : +94 718 210 200
>>
>
>
>
> --
> Himasha Guruge
> *Software Engineer*
> WS*O2* *Inc.*
> Mobile: +94 777459299
> himas...@wso2.com
>



-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* <http://www.apache.org/>*
*email: **az...@wso2.com* <az...@wso2.com>
* cell: +94 77 3320919blog: **http://blog.afkham.org*
<http://blog.afkham.org>
*twitter: **http://twitter.com/afkham_azeez*
<http://twitter.com/afkham_azeez>
*linked-in: **http://lk.linkedin.com/in/afkhamazeez
<http://lk.linkedin.com/in/afkhamazeez>*

*Lean . Enterprise . Middleware*
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to