01: package test;
02:
03: import java.io.IOException;
04: import java.io.PrintWriter;
05:
06: import javax.servlet.ServletException;
07:
08: import javax.portlet.GenericPortlet;
09: import javax.portlet.PortletException;
10: import javax.portlet.RenderRequest;
11: import javax.portlet.ActionRequest;
12: import javax.portlet.ActionResponse;
13: import javax.portlet.RenderResponse;
14: import javax.portlet.PortletContext;
15: import javax.portlet.PortletRequestDispatcher;
16: import javax.portlet.PortletConfig;
17: import javax.portlet.PortletMode;
18:
19: import javax.portlet.UnavailableException;
20:
21: public class TestPortlet extends GenericPortlet {
22:
23: private PortletContext pContext;
24:
25: public void init(PortletConfig config) throws PortletException {
26:
27: //throw new UnavailableException("Test portlet unavailable");
28:
29: super .init(config);
30: pContext = config.getPortletContext();
31:
32: }
33:
34: public void processAction(ActionRequest request,
35: ActionResponse response) throws PortletException {
36: }
37:
38: public void doView(RenderRequest request, RenderResponse response)
39: throws PortletException {
40:
41: response.setContentType(request.getResponseContentType());
42: try {
43: PrintWriter writer = response.getWriter();
44: writer.write("Test Portlet View");
45: } catch (IOException e) {
46: throw new PortletException("TestPortlet.doView exception",
47: e);
48: }
49: }
50:
51: public void doEdit(RenderRequest request, RenderResponse response)
52: throws PortletException {
53:
54: response.setContentType(request.getResponseContentType());
55: try {
56: PrintWriter writer = response.getWriter();
57: writer.write("Test Portlet Edit");
58: } catch (IOException e) {
59: throw new PortletException("TestPortlet.doView exception",
60: e);
61: }
62: }
63:
64: public void doHelp(RenderRequest request, RenderResponse response)
65: throws PortletException {
66:
67: response.setContentType(request.getResponseContentType());
68: try {
69: PrintWriter writer = response.getWriter();
70: writer.write("Test Portlet Help");
71: } catch (IOException e) {
72: throw new PortletException("TestPortlet.doView exception",
73: e);
74: }
75: }
76:
77: }
|