1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.modules.actions.controls;
18
19
20 import org.apache.turbine.modules.Action;
21 import org.apache.turbine.util.DynamicURI;
22 import org.apache.turbine.util.RunData;
23
24
25 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
26 import org.apache.jetspeed.services.logging.JetspeedLogger;
27 import org.apache.jetspeed.services.rundata.JetspeedRunData;
28 import org.apache.jetspeed.util.template.JetspeedLink;
29 import org.apache.jetspeed.util.template.JetspeedLinkFactory;
30
31 /***
32 * This action must be invoked to clean up the customization
33 * state and redirect the user to his portal hompage
34 *
35 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
36 * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
37 * @author <a href="mailto:ggolden@apache.org">Glenn R. Golden</a>
38 */
39 public class EndCustomize extends Action
40 {
41
42 /***
43 * Static initialization of the logger for this class
44 */
45 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(EndCustomize.class.getName());
46
47 /***
48 * @param rundata The RunData object for the current request
49 */
50 public void doPerform( RunData data ) throws Exception
51 {
52 ((JetspeedRunData) data).cleanupFromCustomization();
53
54
55
56 try
57 {
58 JetspeedLink jsLink = JetspeedLinkFactory.getInstance(data);
59 DynamicURI duri = jsLink.getLink(JetspeedLink.CURRENT,null,null,JetspeedLink.CURRENT,null);
60 String mtype = data.getParameters().getString("mtype");
61 if (mtype != null)
62 {
63 jsLink.setMediaType(mtype);
64 duri = jsLink.addQueryData("mtype", mtype);
65 duri = duri.addPathInfo("media-type", mtype);
66 String language = data.getParameters().getString("language");
67 if(language != null)
68 {
69 duri = duri.addQueryData("language",language);
70 String country = data.getParameters().getString("country");
71 if(country != null)
72 {
73 duri = duri.addQueryData("country", country);
74 }
75 }
76 }
77
78 data.setRedirectURI(duri.toString());
79 JetspeedLinkFactory.putInstance(jsLink);
80 jsLink = null;
81 }
82 catch (Exception e)
83 {
84 logger.error("Error while trying to bring user back to home page", e);
85 }
86 }
87 }
88