Hi Shani,

AFAIU When you use location.href for the redirection it makes a http
request. There we can't add custom headers[1].
But according to the post you can use cookies. Hope it might help you.

[1] -
http://stackoverflow.com/questions/24130004/adding-http-headers-to-window-location-href-in-angular-app

Thanks

On Fri, Oct 16, 2015 at 12:17 PM, Shani Ranasinghe <[email protected]> wrote:

> Hi Lasantha,
>
> Thank you for the information.
>
> Actually this is in the JS, not in a Jag. I am using location.href
> currently to do the redirection.
>
> On Fri, Oct 16, 2015 at 12:08 PM, Lasantha Samarakoon <[email protected]>
> wrote:
>
>> Hi Shani,
>>
>> in Jaggey, the response.sendRedirect() method invokes the
>> HttpServletResponse.sendRedirect() method which sends "302 Found" response
>> to the browser. Then the browser initiates a new request to the URL which
>> is passed via the "Location" HTTP header.
>>
>> ex:
>> HTTP/1.1 302 Found
>> Location: http://www.example.com/
>>
>> Therefore, you won't be able to pass a custom HTTP header along with the
>> response.sendRedirect() method.
>>
>> [1]
>> http://stackoverflow.com/questions/17227511/pass-header-parameters-with-sendredirect-url
>>
>>
>> Regards,
>>
>> *Lasantha Samarakoon* | Software Engineer
>> WSO2, Inc.
>> #20, Palm Grove, Colombo 03, Sri Lanka
>> Mobile: +94 (71) 214 1576
>> Email:  [email protected]
>> Web:    www.wso2.com
>>
>> lean . enterprise . middleware
>>
>> On Fri, Oct 16, 2015 at 10:32 AM, Shani Ranasinghe <[email protected]>
>> wrote:
>>
>>> [+ WSO2 Dev]
>>>
>>> On Fri, Oct 16, 2015 at 10:12 AM, Shani Ranasinghe <[email protected]>
>>> wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> I have a requirement where I need to do a redirect from a Javascript,
>>>> and I need to send some headers along with it too.
>>>>
>>>> The scenario is as follows.
>>>>
>>>> From my jaggery layer, I use a JS.At the JS, I receive a callbackURL  &
>>>> a workflow reference Id, I need to pass this to the external party to which
>>>> I would redirect so that they could use those information to communicate
>>>> back to the APIM.  It is better if we can send this via headers from the JS
>>>> (because in HTTPS headers will be secured).
>>>>
>>>> Cookies, is not a good choice, as browsers can disable them, Forms put
>>>> in an additional popup & notifies that the data is transmitted insecurely,
>>>> hence forms are not a good option as well.
>>>>
>>>> Could we use XMLHttpRequest for this? however, we are not expecting a
>>>> response.
>>>>
>>>> Are there any other alternatives?
>>>>
>>>> Any help is appreciated.
>>>>
>>>> --
>>>> Thanks and Regards
>>>> *,Shani Ranasinghe*
>>>> Senior Software Engineer
>>>> WSO2 Inc.; http://wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: +94 77 2273555
>>>> Blog: http://waysandmeans.blogspot.com/
>>>> linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
>>>>
>>>
>>>
>>>
>>> --
>>> Thanks and Regards
>>> *,Shani Ranasinghe*
>>> Senior Software Engineer
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> mobile: +94 77 2273555
>>> Blog: http://waysandmeans.blogspot.com/
>>> linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
>>>
>>
>>
>
>
> --
> Thanks and Regards
> *,Shani Ranasinghe*
> Senior Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 77 2273555
> Blog: http://waysandmeans.blogspot.com/
> linked in: lk.linkedin.com/pub/shani-ranasinghe/34/111/ab
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


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

Mobile  +94712756809
Blog      alokayasoya.blogspot.com
About    http://about.me/thusithathilina
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to