public class SubscribeServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
UserLoginService userLoginService = DataImplFactory.getUserLoginService();
UserDataService userDataService = DataImplFactory.getUserDataService();
if (!userLoginService.isUserLoggedIn()) {
// User needs to login first
resp.sendRedirect(userLoginService.createLoginUrl(req.getRequestURL().toString()));
return;
}
String livingStoryId = req.getParameter("livingStoryId");
if (livingStoryId != null) {
Locale locale = req.getLocale();
userDataService.setEmailSubscription(userLoginService.getUserId(),
Long.valueOf(livingStoryId), true, locale.getLanguage() + "_" + locale.getCountry());
}
String lspUrl = req.getParameter("lspUrl");
if (lspUrl != null) {