KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > applications > media > urlcomposers > omroep > CgiURLComposer


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.applications.media.urlcomposers.omroep;
12 import org.mmbase.applications.media.Format;
13 import org.mmbase.applications.media.urlcomposers.RamURLComposer;
14 import org.mmbase.applications.media.urlcomposers.RealURLComposer;
15
16
17
18 /**
19  * An example. Produces an URL to the omroep cgi-scripts (for real and wm)
20  *
21  * @author Michiel Meeuwissen
22  * @version $Id: CgiURLComposer.java,v 1.10 2006/04/12 00:01:21 michiel Exp $
23  * @since MMBase-1.7
24  */

25 public class CgiURLComposer extends RamURLComposer {
26
27     /**
28      * These scripts actually wrap the source in a ram or wmp
29      */

30     public Format getFormat() {
31         Format format = super.getFormat();
32         if (format.isReal()) return Format.RAM;
33         if (format.isWindowsMedia()) return Format.WMP;
34         return format;
35     }
36
37     /**
38      * Host must be cgi.omroep.nl script.
39      */

40     public boolean canCompose() {
41         return provider.getStringValue("host").equals("cgi.omroep.nl") &&
42             (provider.getStringValue("rootpath").charAt(0) != '%');
43     }
44
45
46     protected StringBuffer JavaDoc getURLBuffer() {
47         String JavaDoc rootpath = provider.getStringValue("rootpath");
48         StringBuffer JavaDoc buff = new StringBuffer JavaDoc(provider.getStringValue("protocol") + "://cgi.omroep.nl" + rootpath);
49         buff.append(source.getStringValue("url"));
50         RealURLComposer.getRMArgs(buff, fragment, info); // append time, title
51
if (fragment == null) {
52             // cgi script does not work without title (for wm)?
53
buff.append('?').append("title=geen_beschrijving");
54         }
55         return buff;
56     }
57
58 }
59
60
61
Popular Tags