Java Doc for WebDAVMethod.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 Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ibm.webdav.protocol.http.WebDAVMethod

All known Subclasses:   com.ibm.webdav.protocol.http.UncheckOutMethod,  com.ibm.webdav.protocol.http.PutMethod,  com.ibm.webdav.protocol.http.VersionControlMethod,  com.ibm.webdav.protocol.http.HeadMethod,  com.ibm.webdav.protocol.http.OrderPatchMethod,  com.ibm.webdav.protocol.http.PropFindMethod,  com.ibm.webdav.protocol.http.CheckInMethod,  com.ibm.webdav.protocol.http.CheckOutMethod,  com.ibm.webdav.protocol.http.MoveMethod,  com.ibm.webdav.protocol.http.OptionsMethod,  com.ibm.webdav.protocol.http.DeleteMethod,  com.ibm.webdav.protocol.http.CopyMethod,  com.ibm.webdav.protocol.http.BindMethod,  com.ibm.webdav.protocol.http.UnlockMethod,  com.ibm.webdav.protocol.http.SearchMethod,  com.ibm.webdav.protocol.http.GetMethod,  com.ibm.webdav.protocol.http.LockMethod,  com.ibm.webdav.protocol.http.ReportMethod,  com.ibm.webdav.protocol.http.MkcolMethod,  com.ibm.webdav.protocol.http.PropPatchMethod,  com.ibm.webdav.protocol.http.PostMethod,
WebDAVMethod
abstract public class WebDAVMethod extends Object (Code)
WebDAVMethod is the abstract superclass of classes corresponding to the WebDAV methods using the command pattern. It maintains the state and logic that is common to the execution of all webDAV methods. These subclasses are a good place to see how the WebDAV protocol is mapped back onto the DAV4J API.

WebDAVMethods are constructed by the HTTP server skeleton ResourceHTTPSkel in order to dispatch Resource methods to ResourceImpl methods on the server. This treats HTTP just like any other remote procedure call mechanism, and unifies the client/server communication.

In general, the execution of a WebDAV method consists of:

  1. create an instance of a Resource implementation corresponding to the resource being manipulated by the method
  2. set the ResourceImpl request context from the request headers using getRequestHeaders()
  3. get the request entity (if any), parse it, and marshal any arguments it contains for the method
  4. call the ResoureImpl method corresponding to the WebDAVMethod subclass (WebDAV or HTTP method)
  5. put any response context into the result headers using setResponseHeaders()
  6. output the response if any
  7. catch exceptions and translate them to set the status code and message for method

Some of these operations are generic to all methods while others are specific to each subclass. In particular, how the context values, request entity, generation of the result entity, and status codes are handled are subclass specific.

Note it is critical that the execute method sets status codes and the request and response headers at the right time. The order is, (1) use setStatusCode() and set other response headers the method needs to set. (2) Call setResponseHeaders() to copy the resource response context to the response headers. (3) Output any response entity body. The headers and response code are written the the HTTP response output stream just before the first byte of the response entity body. Any headers or status code set after the first byte of the response entity body has been written will be lost.



Field Summary
protected  ResourceContextcontext
    
protected  StringmethodName
    
protected  HttpServletRequestrequest
    
protected  ResourceImplresource
    
protected  HttpServletResponseresponse
    

Constructor Summary
public  WebDAVMethod(HttpServletRequest request, HttpServletResponse response)
     Construct a WebDAVMethod.

Method Summary
protected  voidcopy(InputStream in, HttpServletResponse response, int length, String mime)
     Copies input stream to an HTTP output stream.
protected  voidcopy(HttpServletRequest request, OutputStream out, int length, String mime)
     Copies an HTTP input stream to an output stream.
public static  WebDAVMethodcreate(HttpServletRequest request, HttpServletResponse response)
     Create a WebDAVMethod corresponding to the WebDAV or HTTP method in the request.
abstract public  WebDAVStatusexecute()
     Execute this method.
public  StringgetMethodName()
    
public  voidgetRequestHeaders()
     Initialize the request context from the request headers.
public  URLgetRequestURL()
     Reconstructs the URL used by the client used to make the request.
public  ResourceImplgetResource()
     Return the Resource the method operates on.
public  StringgetResponseCharset()
     Get the client prefered character encoding to be used to encode text responses.
public  intgetStatusCode()
     Get the status code for this method.
public  voidsetResponseHeaders()
     Set the response headers from the response context.
public  voidsetStatusCode(int statusCode)
     Set the status code for the method.

Field Detail
context
protected ResourceContext context(Code)



methodName
protected String methodName(Code)



request
protected HttpServletRequest request(Code)



resource
protected ResourceImpl resource(Code)



response
protected HttpServletResponse response(Code)




Constructor Detail
WebDAVMethod
public WebDAVMethod(HttpServletRequest request, HttpServletResponse response) throws WebDAVException(Code)
Construct a WebDAVMethod.
Parameters:
  request - the servlet request
Parameters:
  response - the servlet response
exception:
  com.ibm.webdav.WebDAVException -




Method Detail
copy
protected void copy(InputStream in, HttpServletResponse response, int length, String mime) throws WebDAVException(Code)
Copies input stream to an HTTP output stream.
Parameters:
  in - the source stream from the NamespaceManager
Parameters:
  out - the destination stream from the servlet response
Parameters:
  length - the number of bytes to read from the steam
Parameters:
  mime - the MIME type of the document to determine if its text or binary



copy
protected void copy(HttpServletRequest request, OutputStream out, int length, String mime) throws WebDAVException(Code)
Copies an HTTP input stream to an output stream.
Parameters:
  in - the source stream from the servlet request
Parameters:
  out - the destination stream from the NamespaceManager
Parameters:
  length - the number of bytes to read from the steam
Parameters:
  mime - the MIME type of the document to determine if its text or binary



create
public static WebDAVMethod create(HttpServletRequest request, HttpServletResponse response) throws WebDAVException(Code)
Create a WebDAVMethod corresponding to the WebDAV or HTTP method in the request.
Parameters:
  request - the servlet request
Parameters:
  response - the servlet response a subclass of WebDAVMethod corresponding to the request method
exception:
  com.ibm.webdav.WebDAVException -



execute
abstract public WebDAVStatus execute() throws WebDAVException(Code)
Execute this method. Subclasses are expected to override this method to handle the request entity, do the work, update the context, return the response entity result if any, and set the status code. the WebDAV status code.
exception:
  com.ibm.webdav.WebDAVException -



getMethodName
public String getMethodName()(Code)
Get the request method name



getRequestHeaders
public void getRequestHeaders() throws WebDAVException(Code)
Initialize the request context from the request headers. This provides additional parameters for the methods and perhaps other state from the client for the resource.
exception:
  com.ibm.webdav.WebDAVException -



getRequestURL
public URL getRequestURL()(Code)
Reconstructs the URL used by the client used to make the request. This accounts for differences such as addressing scheme (http, https), but does not attempt to include query parameters. The port is retained even if the default port was used.

This method is useful for creating redirect messages and for reporting errors.




getResource
public ResourceImpl getResource()(Code)
Return the Resource the method operates on.



getResponseCharset
public String getResponseCharset()(Code)
Get the client prefered character encoding to be used to encode text responses. This implementation gets the charset from the Accept header. TODO: it should probably do something with Accept-Charset too. the MIME charset



getStatusCode
public int getStatusCode()(Code)
Get the status code for this method. a status code as defined by HTTP/1.1 and WebDAV



setResponseHeaders
public void setResponseHeaders() throws WebDAVException(Code)
Set the response headers from the response context. This must be called after the remote method has been executed, and BEFORE any response entity is written.
exception:
  RemoteException -



setStatusCode
public void setStatusCode(int statusCode)(Code)
Set the status code for the method. This method must be called before any of the response entity is written.
Parameters:
  statusCode - the status code to set as defined by HTTP/1.1and WebDAV.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.