/**
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
SyndFeed feed = null;
Writer writer = null;
try {
String pathInfo = request.getPathInfo();
if ((pathInfo == null) || (pathInfo.equals(""))) { return; // error
}
// pathInfo is like /personal/username/tokenid.rss
if (pathInfo.indexOf(RSSUtil.RSS_PREFIX_PERSONAL) == 0) {
feed = getPersonalFeed(pathInfo);
if (feed == null) {
DispatcherAction.sendNotFound(pathInfo, response);
return;
}
} else {
DispatcherAction.sendNotFound(pathInfo, response);
return;
}
// OLAT-5400 and OLAT-5243 related: sending back the reply can take arbitrary long,
// considering slow end-user connections for example - or a sudden death of the connection
// on the client-side which remains unnoticed (network partitioning)
DBFactory.getInstance().intermediateCommit();
response.setBufferSize(outputBufferSize);
String encoding = feed.getEncoding();
if (encoding == null) {
encoding = DEFAULT_ENCODING;
if (log.isDebug()) {
log.debug("Feed encoding::" + encoding);
}
log.warn("No encoding provided by feed::" + feed.getClass().getCanonicalName() + " Using utf-8 as default.");
}
response.setCharacterEncoding(encoding);
response.setContentType("application/rss+xml");
Date pubDate = feed.getPublishedDate();
if (pubDate != null) {
response.setDateHeader("Last-Modified", pubDate.getTime());
}
// TODO:GW Do we need this?
// response.setContentLength(feed.get);