Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Jeffrey Jarin
Service Builder JsonWS caching issue
12 septembre 2013 14:46
Réponse

Jeffrey Jarin

Rang: Junior Member

Publications: 30

Date d'inscription: 5 juillet 2013

Publications Récentes

Good Day,

I would just like to ask how the service builder / liferay cache the objects? is there as way I could disable it?
The problem is that I'd tried to put a pre defined date filter like today(09-12-2013), yestersday(09-11-2013) and last 7 days and when i tried to deploy it on our DEV environment
the filter works fine but after a day the Dates are not updated like it should be for tomorrow will be today(09-13-2013), etc... , The date filter are cache afaik when it was deployed and all the dates since it was deployed will be cached and will not update its date only until i restarted the server, but restarting the server on daliy basis should not be an option

im doing the Date Filter using Jodatime inside my utility.java in Service Builder

is this Service Builder Specific or its a liferay portal specific?

Thanks
Jeff
M J
RE: Service Builder JsonWS caching issue
12 septembre 2013 16:24
Réponse

M J

Rang: Regular Member

Publications: 184

Date d'inscription: 1 mars 2013

Publications Récentes

Add cache-enabled="false" to entity. Here is a sample from service.xml:

 1
 2  <entity name="Table1" local-service="true" remote-service="false" cache-enabled="false">
 3    <column name="table1Id" type="long" primary="true" id-type="identity" />
 4    <column name="companyId" type="long" />
 5    <column name="groupId" type="long" />
 6
 7    <order by="desc">
 8      <order-column name="table1Id" />
 9    </order>
10
11    <!-- Finder Methods Standard -->
12    <finder name="GroupId" return-type="Collection">
13      <finder-column name="groupId" />
14    </finder>
15    <finder name="CompanyId" return-type="Collection">
16      <finder-column name="companyId" />
17    </finder>
18  </entity>


MJ
Jeffrey Jarin
RE: Service Builder JsonWS caching issue
12 septembre 2013 19:49
Réponse

Jeffrey Jarin

Rang: Junior Member

Publications: 30

Date d'inscription: 5 juillet 2013

Publications Récentes

Hi MJ, thanks for the reply but I already have that on my Service.xml and also i just added the java class to return an array of string in Dates
Utility.java >
public List<String> getOffersFilter() {
List<String> filterList = new ArrayList<String>();
filterList.add(getToday());
filterList.add(getYesterday());
filterList.add(getLast7Days());
filterList.add(getLast30Days());
filterList.add(getThisMonth());
filterList.add(getLastMonth());
filterList.add(getLast3Months());
filterList.add(getLastYear());
return filterList;
}

its not actually an entity related thing - not sure if its with jodatime or with the service builder emoticon
Kan Zhang
RE: Service Builder JsonWS caching issue
13 septembre 2013 14:15
Réponse

Kan Zhang

Rang: Junior Member

Publications: 68

Date d'inscription: 1 décembre 2010

Publications Récentes

Hi Jeff,

In what layer/class did you put the date filter?

Have you tried to put a break point in your getOffersFilter() method to see if it is actually getting called in the subsequent JsonWS calls?

Also I suggest to use Firebug to check the response headers of each JsonWS calls to see if they are being cached in the web browser.
Jeffrey Jarin
RE: Service Builder JsonWS caching issue
17 septembre 2013 09:48
Réponse

Jeffrey Jarin

Rang: Junior Member

Publications: 30

Date d'inscription: 5 juillet 2013

Publications Récentes

Thanks Kan, here is the headers for the first call

Response Headers
Connection keep-alive
Content-Length 958
Content-Type text/html;charset=utf-8
Date Tue, 17 Sep 2013 16:41:30 GMT
Server nginx
WWW-Authenticate Basic realm="PortalRealm"
Request Headers
Accept application/json, text/javascript, */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Cookie __utma=27178300.840633310.1376421876.1376421876.1376421876.1; __utmz=27178300.1376421876.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); GUEST_LANGUAGE_ID=en_US; COOKIE_SUPPORT=true; JSESSIONID=nSBshHji050Ewxwe--cI1G4M.undefined; USER_UUID=Ut/QyFn+3Cfi27mS3tMW60E+mj/sse3n; LFR_SESSION_STATE_11324=1379367559792; LFR_SESSION_STATE_10538=1379436030112; COMPANY_ID=10154; ID=386b6a4c715a5745375a773d



second call is


Response Headers
Cache-Control private, no-cache, no-store, must-revalidate
Connection keep-alive
Content-Length 227
Content-Type text/javascript;charset=UTF-8
Date Tue, 17 Sep 2013 16:42:08 GMT
Server nginx
Request Headers
Accept application/json, text/javascript, */*
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Cookie __utma=27178300.840633310.1376421876.1376421876.1376421876.1; __utmz=27178300.1376421876.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); GUEST_LANGUAGE_ID=en_US; COOKIE_SUPPORT=true; JSESSIONID=nSBshHji050Ewxwe--cI1G4M.undefined; USER_UUID=Ut/QyFn+3Cfi27mS3tMW60E+mj/sse3n; LFR_SESSION_STATE_11324=1379367559792; LFR_SESSION_STATE_10538=1379436030112; COMPANY_ID=10154; ID=386b6a4c715a5745375a773d


third call is the same header as the second one

my thoughts is that it's probably with the Service Builder or with the JodaTime itself

in my service.xml i already placed cache-enabled="false" to each entity

My DataFilter is being called inside the com.foo.util package that i added under src folder

My problem still persist - the Date filters i have on my dropdown is not getting the correct dates today but the dates it was deployed
Lesha Lesha
RE: Service Builder JsonWS caching issue
4 décembre 2014 03:28
Réponse

Lesha Lesha

Rang: New Member

Publications: 7

Date d'inscription: 6 octobre 2014

Publications Récentes

And after a while, the cache is reset ???
And where this can be changed ?
Lesha Lesha
RE: Service Builder JsonWS caching issue
10 décembre 2014 02:00
Réponse

Lesha Lesha

Rang: New Member

Publications: 7

Date d'inscription: 6 octobre 2014

Publications Récentes

Lesha Lesha:
And after a while, the cache is reset ???
And where this can be changed ?



Can you help me??