KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > contenttool > actions > DownloadAssetAction


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C)
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23
24 package org.infoglue.cms.applications.contenttool.actions;
25
26 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
27 import org.infoglue.cms.controllers.kernel.impl.simple.DigitalAssetController;
28
29 /**
30 * This action downloads an asset from the system.
31 *
32 * @author Mattias Bogeblad
33 */

34
35 public class DownloadAssetAction extends InfoGlueAbstractAction
36 {
37     private static final long serialVersionUID = 1L;
38     
39     private Integer JavaDoc contentId;
40     private Integer JavaDoc languageId;
41     private String JavaDoc assetKey;
42     
43     protected String JavaDoc doExecute() throws Exception JavaDoc
44     {
45         String JavaDoc assetUrl = "";
46         
47         try
48         {
49             assetUrl = DigitalAssetController.getDigitalAssetUrl(contentId, languageId, assetKey, true);
50             this.getResponse().sendRedirect(assetUrl);
51         }
52         catch(Exception JavaDoc e)
53         {
54             e.printStackTrace();
55         }
56         
57         return NONE;
58     }
59
60     public String JavaDoc getAssetKey()
61     {
62         return assetKey;
63     }
64     
65     public void setAssetKey(String JavaDoc assetKey)
66     {
67         this.assetKey = assetKey;
68     }
69     
70     public Integer JavaDoc getContentId()
71     {
72         return contentId;
73     }
74     
75     public void setContentId(Integer JavaDoc contentId)
76     {
77         this.contentId = contentId;
78     }
79     
80     public Integer JavaDoc getLanguageId()
81     {
82         return languageId;
83     }
84     
85     public void setLanguageId(Integer JavaDoc languageId)
86     {
87         this.languageId = languageId;
88     }
89 }
90
Popular Tags