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

Define own XMLEventReader to implement the Closeable interface
Rotate line by specified angle (Java/ Android)
Why can't I check membership of characters in Strings?
SQLDataException: invalid datetime format from HSQLDB
Stored the values in list and then sorting them using Collections is not working
Change Custom Android Theme Dynamically
How can I use string builders to shorten this string?
Is there anyway to send the scanned QR code results directly to the server?
Android app error- unfortunately your app has stopped
how to stop wso2 to read the file while file is written by other process
LibVLC fails to show subtitles for streamed video
Is it possible to have a JAVA only console in Android Studio just like in eclipse?
Maven install lifecycle phase does not call the resources phase
Storing every nth row in Java
Can not update config file using PropertyPlaceholderConfigurer
Use Spring JpaRepository in test

Categories

HOME
date
debugging
path-finding
vmware
react-router
sqlite-net-extensions
malloc
acquia
amazon-cloudformation
gitpitch
imacros
row
rascal
nstableview
visual-studio-2005
quickfix
ups
jqwidget
nodatime
paging
autoconf
excel-2007
mustache.php
crosstab
cas
apache-commons-io
maquette
buck
replaceall
twilio-api
.net-4.0
functor
semantic-versioning
titanium-mobile
gtrendsr
pim
mozilla
wallpaper
catalog
host
c11
hue
streamreader
leading-zero
graphenedb
dism
texmaker
turbogears
total-commander
thin
wso2carbon
google-datalayer
multipeer-connectivity
gabor-filter
feeds
spring-cache
bind9
cubes
visual-c++-2008
vmware-tools
etsy
player
persist
pervasive-sql
ios8-today-widget
intel-fortran
endeca-workbench
python-3.2
atk4
feedback
wordml
microbenchmark
csquery
qpainter
codeigniter-url
fpml
qcodo
rdtsc
heisenbug
dml
doskey
valuechangelistener
srs
stxxl
fmod
runtime.exec
selected
hamiltonian-cycle
gil
rdoc
errai
viewswitcher
regsvr32
enter
gnustep
pydot
zpt
mod-auth
blackberry-playbook
hamachi
servicehost
pyinotify
.nettiers
fixed-width
compiler-specific
privilege
scripting-languages
commodore
ajax-forms

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App