Java Doc for Component.java in  » Web-Server » simple » simple » http » serve » 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 » Web Server » simple » simple.http.serve 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   simple.http.serve.Component

All known Subclasses:   simple.http.load.Service,  simple.http.serve.IndexedComponent,
Component
abstract public class Component implements Resource(Code)
This is an abstract Resource that handles the basic HTTP status reports. For example messages like '404 Not Found' are represented using this abstraction. This Resource can be subclassed to give a Resource the ability to handle all generic status reports for 3xx, 4xx and 5xx defined by RFC 2616.

This uses a various Report objects to generate error and status messages using the Format supplied. This also enables exceptions that propagate from the service objects to be classified and for descriptions of those exceptions to be represented as Report objects that can be be used to generate a formatted message that can be presented to the client.
author:
   Niall Gallagher



Field Summary
protected  Contextcontext
     The Context that this resource is in.

Constructor Summary
protected  Component()
     Constructor that creates a Component without any Context object.
protected  Component(Context context)
     Constructor for the Component is given the Context so that it can generate status reports.

Method Summary
public  voidhandle(Request req, Response resp)
     This handle is provided so that if any errors occur when processing a HTTP transaction a '500 Server Error' message will be sent to the client.
public  voidhandle(Request req, Response resp, int code)
     This is used to generate the status report from a status code. The set of status reports that can have a valid response are the messages that are defined in RFC 2616.
public  voidhandle(Request req, Response resp, Report report)
     This is used to generate a formatted message using a report to describe the change in status.
protected  voidprocess(Request req, Response resp, int code)
     This method is used to handle the HTTP status reports so that if any Exception occurs the handle method can capture and deal with the exception.

Subclasses should treat this as the handle method of the ProtocolHandler.

protected  voidprocess(Request req, Response resp, Report report)
     This method is used to handle the HTTP status reports so that if any Exception occurs the handle method can capture and deal with the exception.

Subclasses should treat this as the handle method of the ProtocolHandler.

abstract protected  voidprocess(Request req, Response resp)
     This method is used to handle the HTTP transaction by subclasses of the Component.

Field Detail
context
protected Context context(Code)
The Context that this resource is in.




Constructor Detail
Component
protected Component()(Code)
Constructor that creates a Component without any Context object. This is used so that if the resource is a ProtocolHandler or some other form of resource that does not require a context then this will allow that resource to inherit the functionality of this. The typical implementation however will not use this constructor. If this is used and a context is not set then there will be an exception in handle(Request,Response,int).



Component
protected Component(Context context)(Code)
Constructor for the Component is given the Context so that it can generate status reports. Every implementation of the Component needs to be constructed with a Context to ensure that the generation of error and status messages is successful.
Parameters:
  context - the context that this resource is in




Method Detail
handle
public void handle(Request req, Response resp)(Code)
This handle is provided so that if any errors occur when processing a HTTP transaction a '500 Server Error' message will be sent to the client. This is used to invoke the process method which subclasses should implement to process the HTTP transaction. If the exception is a SecurityException '403 Forbidden' is used and a FileNotFoundException is '404 Not Found'.

Any Exception thrown from the process method will be captured and the Request and Response are handled by the default error handler method handle(Request,Response,int) with the code 500 which indicates the HTTP/1.1 error message 'Server Error'

This does not throw ant Exception however any user should handle RuntimeException's that may be thrown from handle(Request,Response,int).
Parameters:
  req - the Request object to be processed
Parameters:
  resp - the Response object to be processed




handle
public void handle(Request req, Response resp, int code)(Code)
This is used to generate the status report from a status code. The set of status reports that can have a valid response are the messages that are defined in RFC 2616. If the status code given does not have a valid entry then this will result in an status message description of 'Unknown'.

This does not throw Exception's but users should be prepared to handle any RuntimeException's that could propagate from this. If the Response has been committed then this will return quietly. Typically there will be an IOException writing the content body if the stream has been closed. This will not report such exceptions.
Parameters:
  req - the Request object to be processed
Parameters:
  resp - the Response object to be processed
Parameters:
  code - this is the HTTP status code of the response




handle
public void handle(Request req, Response resp, Report report)(Code)
This is used to generate a formatted message using a report to describe the change in status. This uses the Format object to prepare a formatted message that can be presented to the client. This message will describe the status using the issued Report obejct. If the status code given does not have a valid entry then this will result in an status message description of 'Unknown'.

This does not throw Exception's but users should be prepared to handle any RuntimeException's that could propagate from this. If the Response has been committed then this will return quietly. Typically there will be an IOException writing the content body if the stream has been closed. This will not report such exceptions.
Parameters:
  req - the Request object to be processed
Parameters:
  resp - the Response object to be processed
Parameters:
  report - this is used to describe the change in status




process
protected void process(Request req, Response resp, int code) throws Exception(Code)
This method is used to handle the HTTP status reports so that if any Exception occurs the handle method can capture and deal with the exception.

Subclasses should treat this as the handle method of the ProtocolHandler. Exceptions that cannot be recovered from, particularly RuntimeException's should be left propagate so the handle method can deal with the Exception appropriately.
Parameters:
  req - the Request object to be processed
Parameters:
  resp - the Response object to be processed
Parameters:
  code - this is the HTTP status code of the response
exception:
  Exception - this can throw an error for anything




process
protected void process(Request req, Response resp, Report report) throws Exception(Code)
This method is used to handle the HTTP status reports so that if any Exception occurs the handle method can capture and deal with the exception.

Subclasses should treat this as the handle method of the ProtocolHandler. Exceptions that cannot be recovered from, particularly RuntimeException's should be left propagate so the handle method can deal with the Exception appropriately.
Parameters:
  req - the Request object to be processed
Parameters:
  resp - the Response object to be processed
Parameters:
  report - this is used to describe the change in status
exception:
  Exception - this can throw an error for anything




process
abstract protected void process(Request req, Response resp) throws Exception(Code)
This method is used to handle the HTTP transaction by subclasses of the Component. This is used so that if there are any Exception's thrown while processing the HTTP transaction they can be captured and the HTTP status line will convey the status to the client.

Subclasses should treat this as the handle method of the ProtocolHandler. Exceptions that cannot be recovered from, particularly RuntimeException's should be left propagate so the handle method can prepare an appropriate response.
Parameters:
  req - the Request object to be processed
Parameters:
  resp - the Response object to be processed
exception:
  Exception - this can throw an error for anything




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.