Source Code Cross Referenced for SPDocument.java in  » J2EE » Pustefix » de » schlund » pfixxml » 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 » J2EE » Pustefix » de.schlund.pfixxml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of PFIXCORE.
003:         *
004:         * PFIXCORE is free software; you can redistribute it and/or modify
005:         * it under the terms of the GNU Lesser General Public License as published by
006:         * the Free Software Foundation; either version 2 of the License, or
007:         * (at your option) any later version.
008:         *
009:         * PFIXCORE is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:         * GNU Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public License
015:         * along with PFIXCORE; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         *
018:         */
019:
020:        package de.schlund.pfixxml;
021:
022:        import java.util.ArrayList;
023:        import java.util.HashMap;
024:        import java.util.Iterator;
025:        import java.util.Map;
026:
027:        import javax.servlet.http.Cookie;
028:        import javax.servlet.http.HttpServletResponse;
029:
030:        import org.w3c.dom.Document;
031:        import org.w3c.dom.Element;
032:
033:        import de.schlund.pfixxml.util.Xml;
034:
035:        /**
036:         *
037:         *
038:         */
039:        public class SPDocument {
040:
041:            //~ Instance/static variables ..................................................................
042:
043:            private Document document;
044:            private HashMap<String, Object> propertiesmap;
045:            private boolean updateable = true;
046:            // private boolean   nostore        = false;
047:            private String pagename = null;
048:            private Variant variant = null;
049:            private String xslkey = null;
050:            private long timestamp = System.currentTimeMillis();
051:            private int error = 0;
052:            private String errortext = null;
053:            private String contenttype = null;
054:            private HashMap<String, String> header = new HashMap<String, String>();
055:            private ArrayList<Cookie> cookies = new ArrayList<Cookie>();
056:            private String redirectURL = null;
057:            private boolean trailLogged;
058:
059:            //~ Methods ....................................................................................
060:
061:            // Pagename is the preferred way to specify the target
062:            public void setPagename(String pagename) {
063:                this .pagename = pagename;
064:            }
065:
066:            public String getPagename() {
067:                return pagename;
068:            }
069:
070:            public void setVariant(Variant variant) {
071:                this .variant = variant;
072:            }
073:
074:            public Variant getVariant() {
075:                return variant;
076:            }
077:
078:            //    public void setNostore(boolean nostore) {
079:            //        this.nostore = nostore;
080:            //    }
081:            //
082:            //    public boolean getNostore() {
083:            //        return nostore;
084:            //    }
085:
086:            public void setResponseContentType(String type) {
087:                contenttype = type;
088:            }
089:
090:            public String getResponseContentType() {
091:                return contenttype;
092:            }
093:
094:            public void setResponseErrorText(String err) {
095:                errortext = err;
096:            }
097:
098:            public String getResponseErrorText() {
099:                return errortext;
100:            }
101:
102:            public void setResponseError(int err) {
103:                error = err;
104:            }
105:
106:            public int getResponseError() {
107:                if (redirectURL == null) {
108:                    return error;
109:                } else {
110:                    return HttpServletResponse.SC_MOVED_TEMPORARILY;
111:                }
112:            }
113:
114:            public void addResponseHeader(String key, String val) {
115:                header.put(key, val);
116:            }
117:
118:            public HashMap<String, String> getResponseHeader() {
119:                if (redirectURL == null) {
120:                    return header;
121:                } else {
122:                    HashMap<String, String> newheader = new HashMap<String, String>();
123:                    newheader.put("Location", redirectURL);
124:                    return newheader;
125:                }
126:            }
127:
128:            public void storeFrameAnchors(Map<String, String> anchors) {
129:                if (document == null) {
130:                    throw new RuntimeException(
131:                            "*** Can't store anchors into a null Document ***");
132:                }
133:                Element root = document.getDocumentElement();
134:                for (Iterator<String> i = anchors.keySet().iterator(); i
135:                        .hasNext();) {
136:                    String frame = i.next();
137:                    String anchor = anchors.get(frame);
138:                    Element elem = document.createElement("frameanchor");
139:                    elem.setAttribute("frame", frame);
140:                    elem.setAttribute("anchor", anchor);
141:                    root.appendChild(elem);
142:                }
143:            }
144:
145:            /**
146:             * Returns timestamp that was created on construction
147:             * of the document. Is <b>not</b> guaranteed to be unique.
148:             *
149:             * @return a <code>long</code> value
150:             */
151:            public long getTimestamp() {
152:                return timestamp;
153:            }
154:
155:            public void addCookie(Cookie cookie) {
156:                cookies.add(cookie);
157:            }
158:
159:            public ArrayList<Cookie> getCookies() {
160:                return cookies;
161:            }
162:
163:            public String getXSLKey() {
164:                return xslkey;
165:            }
166:
167:            public Document getDocument() {
168:                return document;
169:            }
170:
171:            public HashMap<String, Object> getProperties() {
172:                return propertiesmap;
173:            }
174:
175:            public boolean docIsUpdateable() {
176:                return updateable;
177:            }
178:
179:            public void setDocIsUpdateable(boolean upd) {
180:                updateable = upd;
181:            }
182:
183:            public void setDocument(Document newDocument) {
184:                document = newDocument;
185:            }
186:
187:            public void setProperties(HashMap<String, Object> newPropertiesmap) {
188:                propertiesmap = newPropertiesmap;
189:            }
190:
191:            public void setProperty(String key, Object value) {
192:                if (propertiesmap == null) {
193:                    propertiesmap = new HashMap<String, Object>();
194:                }
195:                propertiesmap.put(key, value);
196:            }
197:
198:            /**
199:             * Describe <code>setXSLKey</code> method here.
200:             *
201:             * @param xslkey a <code>String</code> value
202:             */
203:            public void setXSLKey(String xslkey) {
204:                this .xslkey = xslkey;
205:            }
206:
207:            /**
208:             * Sets an URL to use for redirection.
209:             * This will cause the {@link #getResponseError()} and
210:             * {@link #getResponseHeader()} methods to return special
211:             * values.
212:             * 
213:             * @param redirectURL Complete URL string
214:             */
215:            public void setRedirect(String redirectURL) {
216:                this .redirectURL = redirectURL;
217:            }
218:
219:            public boolean isRedirect() {
220:                return redirectURL != null;
221:            }
222:
223:            /**
224:             * Resets the redirect URL set via {@link #setRedirect(String)}.
225:             * Should be called after serving the document the first time
226:             * (which effectively means after doing the redirect).
227:             */
228:            public void resetRedirectURL() {
229:                this .redirectURL = null;
230:            }
231:
232:            public boolean getTrailLogged() {
233:                return trailLogged;
234:            }
235:
236:            public void setTrailLogged() {
237:                trailLogged = true;
238:            }
239:
240:            /**
241:             * Describe <code>toString</code> method here.
242:             *
243:             * @return a <code>String</code> value
244:             */
245:            public String toString() {
246:                Document tmp = document;
247:                StringBuffer sw = new StringBuffer();
248:                sw.append("\n");
249:                if (tmp == null) {
250:                    sw.append("null\n");
251:                } else {
252:                    sw.append("[class: " + tmp.getClass().getName() + "]\n");
253:                    sw.append(Xml.serialize(tmp, true, true));
254:                }
255:                return sw.toString();
256:            }
257:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.