java


how can i improve the response time of this Jersey REST Web service call?


I have got a simple Jersey REST Webservice which will read the rss mix url and display the latest news to the website .
But the issue i am facing is that the response is being very slow sometimes and i am getting timeout many times (Ajax call)
will the cache help ??
#Path("/latestnews")
public class RssReader {
#GET
#Produces("text/plain")
public String hello() {
JSONArray latestnews = new JSONArray();
try {
String url = "http://www.rssmix.com/u/8159030/rss.xml";
URL feedUrl = new URL(url);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedUrl));
for (SyndEntry entry : (List<SyndEntry>) feed.getEntries()) {
JSONObject jsonobj_latestnews = new JSONObject();
String title = entry.getTitle();
String link = entry.getLink();
String pub_date = entry.getPublishedDate().toString();
jsonobj_latestnews.put("title", title).put("link", link).put("pub_date", pub_date);
latestnews.put(jsonobj_latestnews);
}
} catch (Exception e) {
e.printStackTrace();
}
return "jsonCallback(" + latestnews.toString() + ")";
}
}
Could you please let me know how can i improve the response time of the above ajax call ??
Thanks in advance

Related Links

Resolve JDBC Oracle Index Column Names
My android app crashes
How to I add an image to list view items in Android?
how to show my data in my listview?
Spring security Skip saving SecurityContext since saving on response commited is disabled
How to disable left and right arrow keys for navigation in SWT List?
Why mixing + and cast does not produce an error in “+(int)+(long)-1”?
Injecting field into module using dagger
No Persistence Provider for EntityManager named foo
Java Array out of bounds error isn't out of bounds?
IF ELSE Statement way
Java [TCG Project] - Implementing cards effect with a tokenized String
Assigning an already existing variable to another variable of a different type
How do I find out if a number is an integer in this expression?
How to store a long/double/int inside of a String in Java
Handling recursive reference with collections (many to many) on Json Resteasy

Categories

HOME
log4j
keras
azure-data-factory
mfc
plot
analysis
electronics
c#-2.0
elasticsearch-hadoop
here-api
correlation
apache-cayenne
clearcase-ucm
clojurescript
tostring
riot.js
clickonce
excel-2007
p-value
vlsi
qhull
fgetcsv
nhapi
entitlements
msys2
bluestacks
junit5
gtrendsr
grails-3.1
openoffice.org
form-data
mpmediaquery
sequential
bytecode-manipulation
objectlistview
elasticsearch-plugin
ensembles
nomethoderror
wso2carbon
multipeer-connectivity
pnotify
celery-task
android-cursor
windows-iot-core-10
pillow
zendesk-app
mediaelement
wdf
impresspages
bgp
captivenetwork
nessus
rhino-servicebus
cloudbees
phpcas
historian
rtbkit
eclipse-clp
dukescript
browser-bugs
interrupted-exception
unity3d-gui
census
jsapi
operator-precedence
ng-animate
nstableviewcell
gadt
java.util.concurrent
fpml
bundles
app42
mbr
multiprocessor
http-unit
free-variable
distutils
tinn-r
dsn
tridion-worldserver
ocx
wse3.0
enter
dotnethighcharts
removeclass
libc++
tomcat-valve
xtype
calling-convention
mongomapper
lang
sudzc
createwindow
gamequery
gin
nintendo-ds
data-driven
document-conversion

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App