Source Code Cross Referenced for HttpHandleable.java in  » Web-Server » HttpdBase4J » net » homeip » donaldm » httpdbase4j » 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 » HttpdBase4J » net.homeip.donaldm.httpdbase4j 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:        HttpdBase4J: An embeddable Java web server framework that supports HTTP, HTTPS, 
003:        templated content and serving content from inside a jar or archive.
004:        Copyright (C) 2007 Donald Munro
005:
006:        This library is free software; you can redistribute it and/or
007:        modify it under the terms of the GNU Lesser General Public
008:        License as published by the Free Software Foundation; either
009:        version 2.1 of the License, or (at your option) any later version.
010:
011:        This library is distributed in the hope that it will be useful,
012:        but WITHOUT ANY WARRANTY; without even the implied warranty of
013:        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:        Lesser General Public License for more details.
015:
016:        You should have received a copy of the GNU Lesser General Public
017:        License along with this library; if not,see http://www.gnu.org/licenses/lgpl.txt
018:         */
019:
020:        package net.homeip.donaldm.httpdbase4j;
021:
022:        import com.sun.net.httpserver.HttpExchange;
023:        import java.io.File;
024:        import java.io.InputStream;
025:
026:        /**
027:         * Interface with all the overidable methods that handlers provide.
028:         * @author Donald Munro
029:         */
030:        public interface HttpHandleable
031:        //===============================
032:        {
033:
034:            /**
035:             * Called to determine whether the resource from a request should be cached.
036:             * To implement user defined cacheing cache the file but return false and
037:             * also overide @see onGetCachedFile to return the cached file.
038:             * @param id Unique id
039:             * @param ex The exchange instance for the current HTTP transaction.
040:             * @param request The request instance
041:             * @return true to cache the result, false to not cache.
042:             */
043:            public boolean onIsCacheable(long id, HttpExchange ex,
044:                    Request request);
045:
046:            /**
047:             * Called to retrieve a cached file if a user defined caching scheme is
048:             * used.
049:             * @param id Unique id
050:             * @param ex The exchange instance for the current HTTP transaction.
051:             * @param request The request instance
052:             * @return true to cache the result, false to not cache.
053:             */
054:            public File onGetCachedFile(long id, HttpExchange ex,
055:                    Request request);
056:
057:            /**
058:             * Called before the server serves a file. 
059:             * @param id Unique id
060:             * @param ex The exchange instance for the current HTTP transaction.
061:             * @param request The request instance
062:             * @return true to continue processing the request
063:             */
064:            public boolean onPreServe(long id, HttpExchange ex, Request request);
065:
066:            /**
067:             * Called as the server is about to perform a GET. May be used by an 
068:             * overiding  class to modify the response headers. The overiding class should 
069:             * return a HttpResponse or null to use the default HttpResponse.<br>
070:             * <b>NOTE:</b> If the overiding class is going to alter the response body
071:             * using <i>onGETBody</i> then it should set the Content-Length header in
072:             * this method.
073:             * @param id Unique transaction id
074:             * @param ex The exchange instance for the current HTTP transaction.
075:             * @param request The request instance
076:             * @return Return null to process normally, otherwise return a new 
077:             * HttpResponse to be send to the client
078:             */
079:            public HttpResponse onServeHeaders(long id, HttpExchange ex,
080:                    Request request);
081:
082:            /**
083:             * Called as the server is about to send the GET data. May be used by an 
084:             * overiding  class to modify the data. The overiding class should 
085:             * return a InputStream from which to read the  or null to use the default.
086:             * @param id Unique transaction id
087:             * @param ex The exchange instance for the current HTTP transaction.
088:             * @param request The request instance
089:             * @return  Return null to process normally, else return the  HttpResponse 
090:             * to be send to the client
091:             */
092:            public InputStream onServeBody(long id, HttpExchange ex,
093:                    Request request);
094:
095:            /**
096:             * Called before the server performs a GETon a file. May be used by an 
097:             * overiding  class to generate dynamic content. The overiding class should 
098:             * return a new File or if it does not generate a new file then it should 
099:             * return the input File parameter
100:             * @param id Unique transaction id
101:             * @param ex The exchange instance for the current HTTP transaction.
102:             * @param request The request instance    
103:             * @param isOK true if the request has been successfully sent
104:             */
105:            public void onPostServe(long id, HttpExchange ex, Request request,
106:                    boolean isOK);
107:
108:            /**
109:             * Called when a request file is not found.
110:             * @param id Unique transaction id
111:             * @param ex The exchange instance for the current HTTP transaction.
112:             * @param request The request instance    
113:             * @return Return null to process normally ie return a 404 error, otherwise 
114:             * return a new Request to be processed which will be used instead of request. 
115:             */
116:            public Request onFileNotFound(long id, HttpExchange ex,
117:                    Request request);
118:
119:            /**
120:             * Called to list a directory request.
121:             * @param request
122:             * @return A String containing the HTML for a page listing the 
123:             * directory contents for a directory request.
124:             */
125:            public String onListDirectory(Request request);
126:
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.