1 | |
package org.paneris.bibliomania; |
2 | |
|
3 | |
import org.melati.Melati; |
4 | |
import org.webmacro.servlet.WebContext; |
5 | |
|
6 | 0 | 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 | 0 | if (melati.getUser().isGuest()) throw new BibliomaniaAccessPoemException(); |
17 | 0 | org.paneris.bibliomania.User user = (org.paneris.bibliomania.User)melati.getUser(); |
18 | 0 | String bookmark = context.getForm("bookmark"); |
19 | 0 | if (bookmark == null) { |
20 | |
|
21 | 0 | if (user.getBookmark() == null) { |
22 | 0 | return "BookmarkFailure.wm"; |
23 | |
} else { |
24 | 0 | melati.getResponse().sendRedirect(user.getBookmark()); |
25 | 0 | return null; |
26 | |
} |
27 | |
} else { |
28 | |
|
29 | 0 | user.setBookmark(bookmark); |
30 | 0 | return "BookmarkSuccess.wm"; |
31 | |
} |
32 | |
} |
33 | |
} |