Re: [Dev] Is it possible to define a global response header in a MSF4J service

2016-08-01 Thread Thusitha Thilina Dayaratne
Hi Sumedha,

You can implement an Interceptor and in the precall you can add the header
that you want.
e.g.

public class TestInterceptor implements Interceptor {
@Override
public boolean preCall(Request request, Response responder,
ServiceMethodInfo serviceMethodInfo) throws Exception {
responder.setHeader("Access-Control-Allow-Origin", "ALL");
return true;
}

.


Thanks

Thusitha


On Mon, Aug 1, 2016 at 2:57 PM, Sumedha Kodithuwakku 
wrote:

> Hi Kasun,
>
> In my case I need to set "Access-Control-Allow-Origin" header to every
> method and it will have a fixed value.
>
> Thanks
> SumedhaS
>
>
> On Mon, Aug 1, 2016 at 2:43 PM, KasunG Gajasinghe  wrote:
>
>> Hi Sumedha,
>>
>> As I see, this is not provided by the JAX-RS 2.0 specification. If this
>> is set at the class-level, then the header names and values will need to be
>> hard-coded. Can you explain the usecase here?
>>
>> On Mon, Aug 1, 2016 at 2:32 PM, Sumedha Kodithuwakku 
>> wrote:
>>
>>> Hi all,
>>>
>>> $subject.?
>>>
>>> I can set a response header within each response as below;
>>>
>>> Response.status(Response.Status.OK).entity(object).header("Header", 
>>> "Value").build();
>>>
>>> However is it possible to define such a header at global level.? For
>>> example like *@Header({ Header", "Value" } public class ClassName(**)* at
>>> class level.
>>>
>>> Appreciate your thoughts on this..
>>>
>>> Thanks
>>> SumedhaS
>>>
>>> --
>>> *Sumedha Kodithuwakku*
>>> Senior Software Engineer
>>> WSO2 Inc. : http://wso2.com
>>> lean . enterprise . middleware
>>>
>>> Mobile: +94 71 808 1124
>>> Blog: http://sumedhask.blogspot.com/
>>>
>>>
>>
>>
>> --
>>
>> *Kasun Gajasinghe*Associate Technical Lead, WSO2 Inc.
>> email: kasung AT spamfree wso2.com
>> linked-in: http://lk.linkedin.com/in/gajasinghe
>> blog: http://kasunbg.org
>>
>>
>>
>
>
>
> --
> *Sumedha Kodithuwakku*
> Senior Software Engineer
> WSO2 Inc. : http://wso2.com
> lean . enterprise . middleware
>
> Mobile: +94 71 808 1124
> Blog: http://sumedhask.blogspot.com/
>
>


-- 
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


Re: [Dev] Is it possible to define a global response header in a MSF4J service

2016-08-01 Thread Sumedha Kodithuwakku
Hi Kasun,

In my case I need to set "Access-Control-Allow-Origin" header to every
method and it will have a fixed value.

Thanks
SumedhaS

On Mon, Aug 1, 2016 at 2:43 PM, KasunG Gajasinghe  wrote:

> Hi Sumedha,
>
> As I see, this is not provided by the JAX-RS 2.0 specification. If this is
> set at the class-level, then the header names and values will need to be
> hard-coded. Can you explain the usecase here?
>
> On Mon, Aug 1, 2016 at 2:32 PM, Sumedha Kodithuwakku 
> wrote:
>
>> Hi all,
>>
>> $subject.?
>>
>> I can set a response header within each response as below;
>>
>> Response.status(Response.Status.OK).entity(object).header("Header", 
>> "Value").build();
>>
>> However is it possible to define such a header at global level.? For
>> example like *@Header({ Header", "Value" } public class ClassName(**)* at
>> class level.
>>
>> Appreciate your thoughts on this..
>>
>> Thanks
>> SumedhaS
>>
>> --
>> *Sumedha Kodithuwakku*
>> Senior Software Engineer
>> WSO2 Inc. : http://wso2.com
>> lean . enterprise . middleware
>>
>> Mobile: +94 71 808 1124
>> Blog: http://sumedhask.blogspot.com/
>>
>>
>
>
> --
>
> *Kasun Gajasinghe*Associate Technical Lead, WSO2 Inc.
> email: kasung AT spamfree wso2.com
> linked-in: http://lk.linkedin.com/in/gajasinghe
> blog: http://kasunbg.org
>
>
>



-- 
*Sumedha Kodithuwakku*
Senior Software Engineer
WSO2 Inc. : http://wso2.com
lean . enterprise . middleware

Mobile: +94 71 808 1124
Blog: http://sumedhask.blogspot.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Is it possible to define a global response header in a MSF4J service

2016-08-01 Thread KasunG Gajasinghe
Hi Sumedha,

As I see, this is not provided by the JAX-RS 2.0 specification. If this is
set at the class-level, then the header names and values will need to be
hard-coded. Can you explain the usecase here?

On Mon, Aug 1, 2016 at 2:32 PM, Sumedha Kodithuwakku 
wrote:

> Hi all,
>
> $subject.?
>
> I can set a response header within each response as below;
>
> Response.status(Response.Status.OK).entity(object).header("Header", 
> "Value").build();
>
> However is it possible to define such a header at global level.? For
> example like *@Header({ Header", "Value" } public class ClassName(**)* at
> class level.
>
> Appreciate your thoughts on this..
>
> Thanks
> SumedhaS
>
> --
> *Sumedha Kodithuwakku*
> Senior Software Engineer
> WSO2 Inc. : http://wso2.com
> lean . enterprise . middleware
>
> Mobile: +94 71 808 1124
> Blog: http://sumedhask.blogspot.com/
>
>


-- 

*Kasun Gajasinghe*Associate Technical Lead, WSO2 Inc.
email: kasung AT spamfree wso2.com
linked-in: http://lk.linkedin.com/in/gajasinghe
blog: http://kasunbg.org
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Is it possible to define a global response header in a MSF4J service

2016-08-01 Thread Sumedha Kodithuwakku
Hi all,

$subject.?

I can set a response header within each response as below;

Response.status(Response.Status.OK).entity(object).header("Header",
"Value").build();

However is it possible to define such a header at global level.? For
example like *@Header({ Header", "Value" } public class ClassName(**)* at
class level.

Appreciate your thoughts on this..

Thanks
SumedhaS

-- 
*Sumedha Kodithuwakku*
Senior Software Engineer
WSO2 Inc. : http://wso2.com
lean . enterprise . middleware

Mobile: +94 71 808 1124
Blog: http://sumedhask.blogspot.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev