Re: [Dev] [DEV][APIM][C5] Error occcured with Created status with Location Header.

2016-11-06 Thread Sanjeewa Malalgoda
Hi Thusitha,
Thanks a lot for the workarounds. If we consider above solution, we cannot
hard code URLs like this as we may have reverse proxy, load balancer etc
fronting this application. And the workaround you suggested on github issue
is violating contract we made with swagger definition. For the moment we
may use it as we do not have other solution as this is Blocker for us to
move ahead. Lets fix this properly like other people do it.

Thanks,
sanjeewa.

On Sun, Nov 6, 2016 at 9:02 PM, Thusitha Thilina Dayaratne <
thusit...@wso2.com> wrote:

> Hi Tharindu,
>
> ATM, MSF4J doesn't support the Response.location(). We will fix this in
> the next release. Until that, as a workaround, you can use the set the
> status code and location header manually.
>
> e.g.
>
> Response.status(Response.Status.CREATED).header(HttpHeaders.LOCATION, 
> "http://localhost:8080/service/abc?page=2";).build();
>
>
> Thanks
>
> Thusitha
>
>
> On Sun, Nov 6, 2016 at 8:57 PM, Tharindu Dharmarathna 
> wrote:
>
>> Hi All,
>>
>>
>> We are going to implement API Creation Flow in API Manager C5 with msf4j
>> 2.1.0.
>>
>> *Requirement*
>> Need  to send 201 (Created) with Location for the Created API resource.
>>
>> *Issue*
>>
>> When we implement this and test we came across with below exception.
>>
>> WARN {org.wso2.msf4j.internal.MSF4JMessageProcessor} - Unmapped
>>> exception java.lang.UnsupportedOperationException
>>> at org.wso2.msf4j.delegates.MSF4JResponse$Builder.location(MSF4
>>> JResponse.java:334)
>>> at javax.ws.rs.core.Response.created(Response.java:699)
>>> at org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServic
>>> eImpl.apisPost(ApisApiServiceImpl.java:260)
>>> at org.wso2.carbon.apimgt.rest.api.publisher.ApisApi.apisPost(A
>>> pisApi.java:425)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>> ssorImpl.java:62)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>> thodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:498)
>>> at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMet
>>> hodInfo.java:132)
>>> at org.wso2.msf4j.internal.MSF4JMessageProcessor.dispatchMethod
>>> (MSF4JMessageProcessor.java:130)
>>> at org.wso2.msf4j.internal.MSF4JMessageProcessor.receive(MSF4JM
>>> essageProcessor.java:72)
>>> at org.wso2.carbon.transport.http.netty.listener.WorkerPoolDisp
>>> atchingSourceHandler.lambda$publishToWorkerPool$12(WorkerPoo
>>> lDispatchingSourceHandler.java:125)
>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>> Executor.java:1142)
>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>> lExecutor.java:617)
>>> at java.lang.Thread.run(Thread.java:745)
>>
>>
>> Is there any workaround available for this ?
>>
>> Github issue created as [1].
>>
>> [1] - https://github.com/wso2/msf4j/issues/320
>>
>> Thanks
>>
>>
>> *Tharindu Dharmarathna*Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94779109091 <%2B94779109091>*
>>
>
>
>
> --
> Thusitha Dayaratne
> Software Engineer
> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>
> Mobile  +94712756809
> Blog  alokayasoya.blogspot.com
> Abouthttp://about.me/thusithathilina
> 
>
>


-- 

*Sanjeewa Malalgoda*
WSO2 Inc.
Mobile : +94713068779

blog
:http://sanjeewamalalgoda.blogspot.com/

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DEV][APIM][C5] Error occcured with Created status with Location Header.

2016-11-06 Thread Thusitha Thilina Dayaratne
Hi Tharindu,

ATM, MSF4J doesn't support the Response.location(). We will fix this in the
next release. Until that, as a workaround, you can use the set the status
code and location header manually.

e.g.

Response.status(Response.Status.CREATED).header(HttpHeaders.LOCATION,
"http://localhost:8080/service/abc?page=2";).build();


Thanks

Thusitha


On Sun, Nov 6, 2016 at 8:57 PM, Tharindu Dharmarathna 
wrote:

> Hi All,
>
>
> We are going to implement API Creation Flow in API Manager C5 with msf4j
> 2.1.0.
>
> *Requirement*
> Need  to send 201 (Created) with Location for the Created API resource.
>
> *Issue*
>
> When we implement this and test we came across with below exception.
>
> WARN {org.wso2.msf4j.internal.MSF4JMessageProcessor} - Unmapped exception
>> java.lang.UnsupportedOperationException
>> at org.wso2.msf4j.delegates.MSF4JResponse$Builder.location(MSF4
>> JResponse.java:334)
>> at javax.ws.rs.core.Response.created(Response.java:699)
>> at org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServic
>> eImpl.apisPost(ApisApiServiceImpl.java:260)
>> at org.wso2.carbon.apimgt.rest.api.publisher.ApisApi.apisPost(A
>> pisApi.java:425)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>> ssorImpl.java:62)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>> thodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:498)
>> at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMet
>> hodInfo.java:132)
>> at org.wso2.msf4j.internal.MSF4JMessageProcessor.dispatchMethod
>> (MSF4JMessageProcessor.java:130)
>> at org.wso2.msf4j.internal.MSF4JMessageProcessor.receive(MSF4JM
>> essageProcessor.java:72)
>> at org.wso2.carbon.transport.http.netty.listener.WorkerPoolDisp
>> atchingSourceHandler.lambda$publishToWorkerPool$12(WorkerPoo
>> lDispatchingSourceHandler.java:125)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>> Executor.java:1142)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>> lExecutor.java:617)
>> at java.lang.Thread.run(Thread.java:745)
>
>
> Is there any workaround available for this ?
>
> Github issue created as [1].
>
> [1] - https://github.com/wso2/msf4j/issues/320
>
> Thanks
>
>
> *Tharindu Dharmarathna*Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <%2B94779109091>*
>



-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [DEV][APIM][C5] Error occcured with Created status with Location Header.

2016-11-06 Thread Tharindu Dharmarathna
Hi All,


We are going to implement API Creation Flow in API Manager C5 with msf4j
2.1.0.

*Requirement*
Need  to send 201 (Created) with Location for the Created API resource.

*Issue*

When we implement this and test we came across with below exception.

WARN {org.wso2.msf4j.internal.MSF4JMessageProcessor} - Unmapped exception
> java.lang.UnsupportedOperationException
> at org.wso2.msf4j.delegates.MSF4JResponse$Builder.location(
> MSF4JResponse.java:334)
> at javax.ws.rs.core.Response.created(Response.java:699)
> at org.wso2.carbon.apimgt.rest.api.publisher.impl.ApisApiServic
> eImpl.apisPost(ApisApiServiceImpl.java:260)
> at org.wso2.carbon.apimgt.rest.api.publisher.ApisApi.apisPost(
> ApisApi.java:425)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
> ssorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMet
> hodInfo.java:132)
> at org.wso2.msf4j.internal.MSF4JMessageProcessor.dispatchMethod
> (MSF4JMessageProcessor.java:130)
> at org.wso2.msf4j.internal.MSF4JMessageProcessor.receive(MSF4JM
> essageProcessor.java:72)
> at org.wso2.carbon.transport.http.netty.listener.WorkerPoolDisp
> atchingSourceHandler.lambda$publishToWorkerPool$12(WorkerPoo
> lDispatchingSourceHandler.java:125)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
> Executor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
> lExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)


Is there any workaround available for this ?

Github issue created as [1].

[1] - https://github.com/wso2/msf4j/issues/320

Thanks


*Tharindu Dharmarathna*Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: *+94779109091*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev