Source Code Cross Referenced for ReloadResource.java in  » Swing-Library » wings3 » org » wings » resource » 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.resource 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ReloadResource.java 3423 2007-07-05 09:47:56Z hengels $
003:         * Copyright 2000,2005 wingS development team.
004:         *
005:         * This file is part of wingS (http://wingsframework.org).
006:         *
007:         * wingS is free software; you can redistribute it and/or modify
008:         * it under the terms of the GNU Lesser General Public License
009:         * as published by the Free Software Foundation; either version 2.1
010:         * of the License, or (at your option) any later version.
011:         *
012:         * Please see COPYING for the complete licence.
013:         */
014:        package org.wings.resource;
015:
016:        import java.beans.PropertyChangeEvent;
017:        import java.beans.PropertyChangeListener;
018:        import java.io.IOException;
019:        import java.util.ArrayList;
020:        import java.util.Collection;
021:        import java.util.Collections;
022:        import java.util.Date;
023:
024:        import org.apache.commons.logging.Log;
025:        import org.apache.commons.logging.LogFactory;
026:        import org.wings.Resource;
027:        import org.wings.SFrame;
028:        import org.wings.io.Device;
029:
030:        /**
031:         * Traverses the component hierarchy of a frame and lets the CGs compose
032:         * the document.
033:         *
034:         * @author Holger Engels
035:         * @version $Revision: 3423 $
036:         */
037:        public class ReloadResource extends DynamicResource {
038:            private final static Log log = LogFactory
039:                    .getLog(ReloadResource.class);
040:
041:            private static final ArrayList<HttpHeader> DEFAULT_CODE_HEADER = new ArrayList<HttpHeader>();
042:            private final PropertyChangeListener changeListener;
043:
044:            static {
045:                DEFAULT_CODE_HEADER.add(new Resource.HeaderEntry("Expires",
046:                        new Date(1000)));
047:                DEFAULT_CODE_HEADER
048:                        .add(new Resource.HeaderEntry("Cache-Control",
049:                                "no-store, no-cache, must-revalidate"));
050:                DEFAULT_CODE_HEADER.add(new Resource.HeaderEntry(
051:                        "Cache-Control", "post-check=0, pre-check=0"));
052:                DEFAULT_CODE_HEADER.add(new Resource.HeaderEntry("Pragma",
053:                        "no-cache"));
054:            }
055:
056:            /**
057:             * Create a code resource for the specified frame.
058:             * <p>The MIME-type for this frame will be <code>text/html; charset=<i>current encoding</i></code>
059:             */
060:            public ReloadResource(final SFrame f) {
061:                super (f, "html", provideMimeType(f));
062:                // update session encoding if manually updated in the session.
063:                changeListener = new PropertyChangeListener() {
064:                    public void propertyChange(PropertyChangeEvent evt) {
065:                        mimeType = provideMimeType(f);
066:                    }
067:                };
068:                f.getSession().addPropertyChangeListener(changeListener);
069:            }
070:
071:            /**
072:             * The MIME-type for this {@link Resource}.
073:             */
074:            private static String provideMimeType(SFrame frame) {
075:                return "text/html; charset="
076:                        + frame.getSession().getCharacterEncoding();
077:            }
078:
079:            /**
080:             * Renders and writes the code of the {@link SFrame} attached to this <code>ReloadResource</code>.
081:             */
082:            public void write(Device out) throws IOException {
083:                try {
084:                    getFrame().write(out);
085:                } catch (IOException e) {
086:                    throw e;
087:                } catch (Exception e) {
088:                    log.fatal("resource: " + getId(), e);
089:                    throw new IOException(e.getMessage()); // UndeclaredThrowable
090:                }
091:            }
092:
093:            /**
094:             * The HTTP header parameteres attached to this dynamic code ressource.
095:             * This <b>static</b> list will by default contain entries to disable caching
096:             * on the server side. Call <code>getHeaders().clear()</code> to avoid this
097:             * i.e. if you want to enable back buttons.
098:             *
099:             * @return A <code>Collection</code> of {@link org.wings.Resource.HeaderEntry} objects.
100:             */
101:            public Collection<HttpHeader> getHeaders() {
102:                if (getFrame().isNoCaching())
103:                    return DEFAULT_CODE_HEADER;
104:                else
105:                    return Collections.EMPTY_SET;
106:            }
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.