Source Code Cross Referenced for Resource.java in  » Swing-Library » wings3 » org » wings » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » wings3 » org.wings 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000,2005 wingS development team.
003:         *
004:         * This file is part of wingS (http://wingsframework.org).
005:         *
006:         * wingS is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1
009:         * of the License, or (at your option) any later version.
010:         *
011:         * Please see COPYING for the complete licence.
012:         */
013:        package org.wings;
014:
015:        import org.wings.session.Session;
016:        import org.wings.session.SessionManager;
017:        import org.wings.resource.HttpHeader;
018:
019:        import java.io.Serializable;
020:        import java.util.Collection;
021:        import java.util.Map;
022:
023:        /*
024:         * Diese Klasse ist nur ein Wrapper, um Eingabestroeme von Grafiken mit dem
025:         * ExternalizeManager mit der richtigen Endung und ohne Umweg einer neuen
026:         * Codierung (die z.B. keine Transparenz unterstuetzt) uebers WWW zugreifbar zu
027:         * machen. Zugleich muss diese Klasse aber auch zu der API der Componenten
028:         * passen, also ein Image bzw. ImageIcon sein. ImageIcon ist einfacher zu
029:         * benutzen und implementiert schon alles was benoetigt wird...
030:         */
031:
032:        /**
033:         * Wrapper to decorate various resource (i.e. images, files, scripts) with
034:         * a MIME type and make it accessible to the client via HTTP and the 
035:         * {@link org.wings.externalizer.ExternalizeManager}.
036:         *
037:         * @author <a href="mailto:haaf@mercatis.de">Armin Haaf</a>
038:         * @author <a href="mailto:H.Zeller@acm.org">Henner Zeller</a>
039:         */
040:        public abstract class Resource implements  Serializable, URLResource,
041:                Renderable {
042:            /**
043:             * a serializable class is supposed to have this ID.
044:             */
045:            private static final long serialVersionUID = 0x200L;
046:
047:            protected String id;
048:
049:            protected String extension;
050:
051:            protected String mimeType;
052:
053:            protected Collection<HttpHeader> headers;
054:
055:            protected Resource(String extension, String mimeType) {
056:                this .extension = extension;
057:                this .mimeType = mimeType;
058:            }
059:
060:            protected Resource() {
061:            }
062:
063:            public int getLength() {
064:                return -1;
065:            }
066:
067:            public String getExtension() {
068:                return extension;
069:            }
070:
071:            /**
072:             * Returns the mime type of this resource.
073:             */
074:            public String getMimeType() {
075:                return mimeType;
076:            }
077:
078:            public void setHeaders(Collection<HttpHeader> headers) {
079:                this .headers = headers;
080:            }
081:
082:            public Collection<HttpHeader> getHeaders() {
083:                return headers;
084:            }
085:
086:            public String getId() {
087:                return id;
088:            }
089:
090:            public abstract SimpleURL getURL();
091:
092:            public String toString() {
093:                return getId();
094:            }
095:
096:            public Session getSession() {
097:                return SessionManager.getSession();
098:            }
099:
100:            /**
101:             * Internal structure to manage HTTP headers which should be delivered with a resource to the client.
102:             */
103:            public static final class HeaderEntry implements  HttpHeader,
104:                    Serializable {
105:                /**
106:                 * a serializable class is supposed to have this ID.
107:                 */
108:                private static final long serialVersionUID = 0x200L;
109:
110:                private final String key;
111:                private Serializable value;
112:
113:                /**
114:                 * Create new entry.
115:                 */
116:                public HeaderEntry(String k, Serializable v) {
117:                    key = k;
118:                    value = v;
119:                }
120:
121:                public String getKey() {
122:                    return key;
123:                }
124:
125:                public Object getValue() {
126:                    return value;
127:                }
128:
129:                public Object setValue(Object newValue) {
130:                    Object oldValue = value;
131:                    value = (Serializable) newValue;
132:                    return oldValue;
133:                }
134:
135:                public boolean equals(Object o) {
136:                    if (!(o instanceof  Map.Entry))
137:                        return false;
138:                    Map.Entry e = (Map.Entry) o;
139:                    Object k1 = getKey();
140:                    Object k2 = e.getKey();
141:                    if (k1 == k2 || (k1 != null && k1.equals(k2))) {
142:                        Object v1 = getValue();
143:                        Object v2 = e.getValue();
144:                        if (v1 == v2 || (v1 != null && v1.equals(v2))) {
145:                            return true;
146:                        }
147:                    }
148:                    return false;
149:                }
150:
151:                public int hashCode() {
152:                    return (key == null ? 0 : key.hashCode())
153:                            ^ (value == null ? 0 : value.hashCode());
154:                }
155:
156:                public String toString() {
157:                    return getKey() + "=" + getValue();
158:                }
159:
160:            }
161:
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.