Source Code Cross Referenced for PropPatchMethod.java in  » Content-Management-System » harmonise » com » ibm » webdav » protocol » http » 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 » Content Management System » harmonise » com.ibm.webdav.protocol.http 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.ibm.webdav.protocol.http;
002:
003:        /*
004:         * (C) Copyright IBM Corp. 2000  All rights reserved.
005:         *
006:         * The program is provided "AS IS" without any warranty express or
007:         * implied, including the warranty of non-infringement and the implied
008:         * warranties of merchantibility and fitness for a particular purpose.
009:         * IBM will not be liable for any damages suffered by you as a result
010:         * of using the Program. In no event will IBM be liable for any
011:         * special, indirect or consequential damages or lost profits even if
012:         * IBM has been advised of the possibility of their occurrence. IBM
013:         * will not be liable for any third party claims against you.
014:         * 
015:         * Portions Copyright (C) Simulacra Media Ltd, 2004.
016:         */
017:        import java.io.*;
018:        import java.util.*;
019:        import java.util.logging.*;
020:
021:        import javax.servlet.http.*;
022:        import javax.xml.parsers.*;
023:
024:        import org.w3c.dom.*;
025:
026:        import com.ibm.webdav.*;
027:        import com.ibm.webdav.impl.*;
028:
029:        /** Executes the WebDAV PROPPATCH method.
030:         * @author Jim Amsden <jamsden@us.ibm.com>
031:         */
032:        public class PropPatchMethod extends WebDAVMethod {
033:            private static Logger m_logger = Logger
034:                    .getLogger(PropPatchMethod.class.getName());
035:
036:            /** Construct a PropPatchMethod.
037:             * @param request the servlet request
038:             * @param response the servlet response
039:             * @exception com.ibm.webdav.WebDAVException
040:             */
041:            public PropPatchMethod(HttpServletRequest request,
042:                    HttpServletResponse response) throws WebDAVException {
043:                super (request, response);
044:                methodName = "PROPPATCH";
045:                context.setMethodName(methodName);
046:            }
047:
048:            /** Execute the method.
049:             * @return the result status code
050:             */
051:            public WebDAVStatus execute() {
052:                setStatusCode(WebDAVStatus.SC_OK); // the default status code
053:                MultiStatus multiStatus = null;
054:                try {
055:                    // get any arguments out of the headers
056:                    String depth = context.getRequestContext().depth();
057:
058:                    // get the request entity body and parse it
059:                    WebDAVErrorHandler errorHandler = new WebDAVErrorHandler(
060:                            resource.getURL().toString());
061:                    DocumentBuilderFactory factory = DocumentBuilderFactory
062:                            .newInstance();
063:                    factory.setNamespaceAware(true);
064:                    DocumentBuilder docbuilder = factory.newDocumentBuilder();
065:                    docbuilder.setErrorHandler(errorHandler);
066:                    /*Parser xmlParser = new Parser(resource.getURL().toString(), errorListener, null);
067:                    xmlParser.setWarningNoDoctypeDecl(false);
068:                    xmlParser.setProcessNamespace(true);
069:                    Document contents = xmlParser.readStream(request.getReader());*/
070:                    Document contents = docbuilder
071:                            .parse(new org.xml.sax.InputSource(request
072:                                    .getReader()));
073:                    if (errorHandler.getErrorCount() > 0) {
074:                        if (true)
075:                            throw new RuntimeException();
076:                        throw new WebDAVException(WebDAVStatus.SC_BAD_REQUEST,
077:                                "Syntax error in PROPPATCH request entity body");
078:                    }
079:                    if (ResourceImpl.debug) {
080:                        System.err.println("property update request entity:");
081:                        PrintWriter pout = new PrintWriter(System.err);
082:                        pout.print(XMLUtility.printNode(contents
083:                                .getDocumentElement()));
084:                        //((Document) contents).printWithFormat(pout);
085:                    }
086:
087:                    context.setMethodName(methodName);
088:                    multiStatus = resource.setProperties(context, contents);
089:                    Enumeration responses = multiStatus.getResponses();
090:
091:                    if (responses.hasMoreElements()) {
092:                        // there's more than one response, so return a multistatus
093:                        context.getResponseContext().contentType("text/xml");
094:                        setResponseHeaders();
095:                        setStatusCode(WebDAVStatus.SC_MULTI_STATUS);
096:
097:                        // output the results as an XML document
098:                        Document results = multiStatus.asXML();
099:                        //((Document) results).setEncoding(getResponseCharset());
100:                        if (ResourceImpl.debug) {
101:                            System.err.println("property update results:");
102:                            PrintWriter pout = new PrintWriter(System.err);
103:                            pout.print(XMLUtility.printNode(results
104:                                    .getDocumentElement()));
105:                            //((Document) results).printWithFormat(pout);
106:                        }
107:                        PrintWriter pout = new PrintWriter(
108:                                response.getWriter(), false);
109:                        //((Document) results).print(pout);
110:                        pout.print(multiStatus.toString());
111:                        pout.close();
112:                    } else {
113:                        setStatusCode(WebDAVStatus.SC_OK); // the default status code
114:                        setResponseHeaders();
115:                    }
116:                } catch (WebDAVException exc) {
117:                    m_logger.log(Level.INFO, exc.getLocalizedMessage() + " - "
118:                            + request.getQueryString());
119:                    setStatusCode(exc.getStatusCode());
120:                } catch (Exception exc) {
121:                    m_logger.log(Level.WARNING, exc.getMessage(), exc);
122:                    setStatusCode(WebDAVStatus.SC_INTERNAL_SERVER_ERROR);
123:                }
124:                return context.getStatusCode();
125:            }
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.