KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > actions > user > SetTimeZoneAction


1 /*
2  * $$Id: SetTimeZoneAction.java,v 1.3 2005/06/07 12:32:29 bel70 Exp $$
3  *
4  * ***** BEGIN LICENSE BLOCK ***** The contents of this file are subject to the
5  * Mozilla Public License Version 1.1 (the "License"); you may not use this file
6  * except in compliance with the License. You may obtain a copy of the License
7  * at http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
11  * the specific language governing rights and limitations under the License.
12  *
13  * The Original Code is JGossip forum code.
14  *
15  * The Initial Developer of the Original Code is the JResearch, Org. Portions
16  * created by the Initial Developer are Copyright (C) 2004 the Initial
17  * Developer. All Rights Reserved.
18  *
19  * Contributor(s): Dmitry Belov <bel@jresearch.org>
20  *
21  * ***** END LICENSE BLOCK *****
22  */

23 package org.jresearch.gossip.actions.user;
24
25 import javax.servlet.http.HttpServletRequest JavaDoc;
26 import javax.servlet.http.HttpServletResponse JavaDoc;
27 import javax.servlet.http.HttpSession JavaDoc;
28
29 import org.apache.struts.action.ActionForm;
30 import org.apache.struts.action.ActionForward;
31 import org.apache.struts.action.ActionMapping;
32 import org.jresearch.gossip.IConst;
33 import org.jresearch.gossip.actions.BaseAction;
34 import org.jresearch.gossip.exception.SystemException;
35 import org.jresearch.gossip.forms.TimeZoneForm;
36
37 /**
38  * DOCUMENT ME!
39  *
40  * @author dbelov
41  */

42 public class SetTimeZoneAction extends BaseAction {
43     /*
44      * (non-Javadoc)
45      *
46      * @see org.jresearch.gossip.actions.BaseAction#process(org.apache.struts.action.ActionMapping,
47      * org.apache.struts.action.ActionForm,
48      * javax.servlet.http.HttpServletRequest,
49      * javax.servlet.http.HttpServletResponse)
50      */

51     public ActionForward process(ActionMapping mapping, ActionForm form,
52             HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response)
53             throws SystemException {
54         HttpSession JavaDoc session = request.getSession();
55         int offset = Integer.parseInt(((TimeZoneForm) form).getOffset());
56         session.setAttribute(IConst.SESSION.TIME_ZONE, IConst.VALUES.GMT
57                 + (((offset > 0) ? "-" : "+") + Math.abs(offset)) + ":00");
58         session.setAttribute(IConst.SESSION.USER_TIME_ZONE, IConst.VALUES.TRUE);
59         return new ActionForward("/blank.jsp");
60     }
61 }
Popular Tags