01: // AttRes.java
02: // $Id: AttRes.java,v 1.2 2000/08/16 21:37:48 ylafon Exp $
03: // (c) COPYRIGHT MIT, INRIA and Keio, 1999.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigsaw.tests;
07:
08: import org.w3c.tools.resources.FramedResource;
09: import org.w3c.tools.resources.Attribute;
10: import org.w3c.tools.resources.AttributeRegistry;
11: import org.w3c.tools.resources.ReplyInterface;
12: import org.w3c.tools.resources.RequestInterface;
13: import org.w3c.tools.resources.ProtocolException;
14: import org.w3c.tools.resources.ResourceException;
15: import org.w3c.jigsaw.frames.MimeTypeArrayAttribute;
16: import org.w3c.www.mime.MimeType;
17:
18: /**
19: * @version $Revision: 1.2 $
20: * @author Benoît Mahé (bmahe@w3.org)
21: */
22: public class AttRes extends FramedResource {
23:
24: /**
25: * Attribute index - The MTA attribute
26: */
27: protected static int ATTR_MTA = -1;
28:
29: static {
30: Attribute a = null;
31: Class cls = null;
32: // Get a pointer to our class:
33: try {
34: cls = Class.forName("org.w3c.jigsaw.tests.AttRes");
35: } catch (Exception ex) {
36: ex.printStackTrace();
37: System.exit(1);
38: }
39: // The object identifier, *should* be uniq (see below)
40: a = new MimeTypeArrayAttribute("mime-type-array", null,
41: Attribute.EDITABLE);
42: ATTR_MTA = AttributeRegistry.registerAttribute(cls, a);
43: }
44:
45: public MimeType[] getMimeTypeArray() {
46: return (MimeType[]) getValue(ATTR_MTA, null);
47: }
48:
49: public ReplyInterface perform(RequestInterface request)
50: throws ProtocolException, ResourceException {
51: MimeType mimes[] = getMimeTypeArray();
52: System.out.println(mimes);
53: for (int i = 0; i < mimes.length; i++)
54: System.out.println("=> " + mimes[i]);
55: return super.perform(request);
56: }
57:
58: }
|