01: /*
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999-2005 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * Initial developer(s): Brice Ruzand
22: *
23: * --------------------------------------------------------------------------
24: * $Id$
25: * --------------------------------------------------------------------------
26: */
27: package emb.sample.servlet;
28:
29: import java.io.IOException;
30:
31: import javax.servlet.ServletException;
32: import javax.servlet.http.HttpServletRequest;
33: import javax.servlet.http.HttpServletResponse;
34:
35: import emb.sample.MediaSampleException;
36:
37: /**
38: * The Home of emb Sample
39: *
40: * @author Brice Ruzand
41: */
42: public class HomeSample extends BaseSampleServlet {
43:
44: /**
45: * serialVersionUID
46: */
47: private static final long serialVersionUID = -4450606249375127461L;
48:
49: /**
50: * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest,
51: * javax.servlet.http.HttpServletResponse)
52: * @inheritDoc
53: */
54: public void service(HttpServletRequest request,
55: HttpServletResponse response) throws ServletException,
56: IOException {
57: try {
58:
59: try {
60: // init session
61: getSession(request);
62: } catch (MediaSampleException e) {
63: getSession(request);
64: }
65:
66: StringPrinter workspaceContent = new StringPrinter();
67:
68: workspaceContent
69: .println("<h2>Welcome to JOnAS Enterprise Media Beans Sample application</h2>");
70: workspaceContent
71: .println("<p>This application provide a small sample of Enterprise Media Beans use with JOnAS.</p>");
72: workspaceContent
73: .println("<h4>First you have to load media sample : <a href=\"ActionDispatcher?action=load\">Load</a></h4>");
74: workspaceContent
75: .println("<h4>Then view the media list and work with it : <a href=\"ActionDispatcher?action=list\">Media list</a></h4>");
76: workspaceContent
77: .println("<h4>Add your own media : <a href=\"ActionDispatcher?action=upload\">Upload</a></h4>");
78:
79: request.setAttribute("workspaceContent", workspaceContent);
80: getServletConfig().getServletContext()
81: .getRequestDispatcher(TEMPLATE_JSP).forward(
82: request, response);
83:
84: } catch (Throwable e) {
85: exceptionHandler(e, getClass(), request, response);
86: }
87: }
88:
89: }
|