View Javadoc

1   package org.paneris.bibliomania;
2   
3   import org.melati.Melati;
4   import org.webmacro.servlet.WebContext;
5   
6   public class Bookmark extends BibliomaniaServlet {
7   
8     /**
9      * 
10     */
11    private static final long serialVersionUID = 1L;
12  
13    protected String bibliomaniaHandle(Melati melati, WebContext context)
14              throws Exception {
15  
16      if (melati.getUser().isGuest()) throw new BibliomaniaAccessPoemException();
17      org.paneris.bibliomania.User user = (org.paneris.bibliomania.User)melati.getUser();
18      String bookmark = context.getForm("bookmark");
19      if (bookmark == null) {
20        // going to the bookmark
21        if (user.getBookmark() == null) {
22          return "BookmarkFailure.wm";
23        } else {
24          melati.getResponse().sendRedirect(user.getBookmark());
25          return null;
26        }
27      } else {
28        // setting a bookmark
29        user.setBookmark(bookmark);
30        return "BookmarkSuccess.wm";
31      }
32    }
33  }