]> WPIA git - gigi.git/blob - src/org/cacert/gigi/pages/wot/MyListingPage.java
0b64b2e4fcd63866e825e812d0999648bb76a924
[gigi.git] / src / org / cacert / gigi / pages / wot / MyListingPage.java
1 package org.cacert.gigi.pages.wot;
2
3 import java.io.IOException;
4 import java.util.HashMap;
5
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
8
9 import org.cacert.gigi.dbObjects.User;
10 import org.cacert.gigi.output.template.Form;
11 import org.cacert.gigi.pages.Page;
12 import org.cacert.gigi.util.AuthorizationContext;
13
14 public class MyListingPage extends Page {
15
16     public static final String PATH = "/wot/listing";
17
18     public MyListingPage() {
19         super("My Listing");
20     }
21
22     @Override
23     public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
24         if (Form.getForm(req, MyListingForm.class).submit(resp.getWriter(), req)) {
25             resp.sendRedirect(PATH);
26             return;
27         }
28         super.doPost(req, resp);
29     }
30
31     @Override
32     public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
33         new MyListingForm(req, getUser(req)).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
34     }
35
36     @Override
37     public boolean isPermitted(AuthorizationContext ac) {
38         return ac != null && ac.getTarget() instanceof User;
39     }
40
41 }