cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1144
Views
5
Helpful
4
Replies

Jabber custom tab - get methods doesn't works

mehdi.hajar3
Level 1
Level 1

Hello,

I created a custom tab and I added a webb app. The problem that I noticed is that the get methods works only one time. To make it work again I have to close Jabber and reopen it...

I don't have this problem with post methods..

A solution is to replace my get by post, but maybe some one has a better idea ?

4 Replies 4

dstaudt
Cisco Employee
Cisco Employee

Can you provide some additional detail on what you're attempting to do, any HTML/JS code, and the specific error/symptom..?

I want to get data from an API, here some  relevant code:


Html:

<div *ngFor='let client of client' [routerLink]="['/detail', client.tel]">- {{client.firstName}}

  {{client.lastName}}

</div>

JS (Angular2):

getClients(): Promise<Client[]> {

  let url = 'http://localhost:8080/clients';

  return this.http.get(url).toPromise().then(response => response.json().clients as Client[]);

}

The symptom is clear, the request does'nt go to the API more than one time per Jabber session...

If I replace the http.get(url) by http.post(url,{}) it works

Interesting...

Any chance your server is indicating via headers (i.e. Expires) that the URL can be cached?

Does this only occur with Angular2?  Does substituting a more traditional XHTTP request work?

At the end of the day, Jabber just provides a container where the OS's web browser control is given a URL and space to render its output - it's possible that quirks of the system browser may be at play here

Thanks to your answer as was able to solve the issue.

The Url was cached, so in my server I added this line : response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");


Thank you for your help !

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: