Source Code Cross Referenced for EnteteReponse.java in  » Web-Server » javahttpserver » httpserver » 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 » javahttpserver » httpserver 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * <p>
003:         * Title: Connection
004:         * </p>
005:         * 
006:         * <p>
007:         * Description: Represente une entete de reponse qui sera envoyées au client
008:         * </p>
009:         * 
010:         * <p>
011:         * Copyright: Copyright (c) 2005
012:         * </p>
013:         * 
014:         * commentaire inutile
015:         * 
016:         * <p>
017:         * Company:
018:         * </p>
019:         * 
020:         * @author Adlani Anouar - Detante Antoine - Klein Gregory - Pepin Pierre
021:         * @version 1.0
022:         */package httpserver;
023:
024:        public class EnteteReponse extends EnteteHTTP {
025:
026:            /**
027:             * Creer une instance de EnteteReponse
028:             * @param code
029:             * @param status
030:             */
031:            public EnteteReponse(int code, String status) {
032:                this .setCodeNumber(code);
033:                this .setStatusMessage(status);
034:                // la version du protocole utilisé est defini par la variable public
035:                // versionProtocole de la classe Serveur
036:                this .setVersion(Serveur.VERSION_PROTOCOLE);
037:                this .setServer(Serveur.NOM_SERVEUR);
038:            }
039:
040:            /**
041:             * Methode qui permet de definir le code de reponse de l'EnteteReponse
042:             * @param codeNumber int code de reponse
043:             */
044:            public void setCodeNumber(int codeNumber) {
045:                super .ajouterChamps("Code", "" + codeNumber);
046:            }
047:
048:            /**
049:             * Methode qui permet d'obtenir le code de reponse de l'EnteteReponse
050:             * @return int code de reponse
051:             */
052:            public int getCodeNumber() {
053:                return (new Integer(super .getChamps("Code")).intValue());
054:            }
055:
056:            /**
057:             * Methode qui permet de savoir si le code de reponse est definit
058:             * @return boolean trus si le code est definit false sinon
059:             */
060:            public boolean isSetCodeNumber() {
061:                return super .contientChamps("Code");
062:            }
063:
064:            /**
065:             *.Methode qui permet de definir le status de l'entete (lié au code reponse)
066:             * @param statusMessage String statut du message d'entete
067:             */
068:            public void setStatusMessage(String statusMessage) {
069:                super .ajouterChamps("StatusMessage", statusMessage);
070:            }
071:
072:            /**
073:             *.Methode qui permet d'obtenir le status de l'entete (lié au code reponse)
074:             * @return String statut du message d'entete
075:             */
076:            public String getStatusMessage() {
077:                return super .getChamps("StatusMessage");
078:            }
079:
080:            /**
081:             *.Methode qui permet de savoir si le satut est definit
082:             * @return boolean true si definit false sinon
083:             */
084:            public boolean isSetStatusMessage() {
085:                return super .contientChamps("StatusMessage");
086:            }
087:
088:            /**
089:             *.Methode qui permet de definir la version du protocole HTTP utilisé par le serveur
090:             * @param version String version du protocole
091:             */
092:            public void setVersion(String version) {
093:                super .ajouterChamps("Version", version);
094:            }
095:
096:            /**
097:             *.Methode qui permet d'obtenir la version du protocole HTTP utilisé par le serveur
098:             * @return String version du protocole
099:             */
100:            public String getVersion() {
101:                return super .getChamps("Version");
102:            }
103:
104:            /**
105:             *.Methode qui permet de savoir si la version du protocole HTTP est definit
106:             * @return boolean true si definit false sinon
107:             */
108:            public boolean isSetVersion() {
109:                return super .contientChamps("Version");
110:            }
111:
112:            /**
113:             *.Verifie que l'entete est correcte
114:             * c'est à dire que le code reponse, le status et la version du protocole sont definis
115:             * @return boolean true si l'entete est correcte false sinon
116:             */
117:            public boolean isCorrect() {
118:                return this .isSetVersion() && this .isSetCodeNumber()
119:                        && this .isSetStatusMessage();
120:            }
121:
122:            /**
123:             *.Permet de construire l'EnteteReponse sous forme de chaine de caractères
124:             * @return l'entete de reponse
125:             */
126:            public String toString() {
127:                StringBuffer sb = new StringBuffer();
128:                if (this .isSetVersion())
129:                    sb.append(super .getChamps("Version") + " ");
130:                if (this .isSetCodeNumber())
131:                    sb.append(super .getChamps("Code") + " ");
132:                if (this .isSetStatusMessage())
133:                    sb.append(super .getChamps("StatusMessage") + " ");
134:                if (this .isSetLocation() || this .isSetServer()
135:                        || this .isSetWWWAuthentificate())
136:                    sb.append("\n");
137:                if (this .isSetLocation())
138:                    sb.append(super .champsToString("Location"));
139:                if (this .isSetServer())
140:                    sb.append(super .champsToString("Server"));
141:                if (this .isSetWWWAuthentificate())
142:                    sb.append(super .champsToString("WWW-Authentificate"));
143:                return sb.toString();//+"\n";
144:            }
145:
146:            /**
147:             *.Methode qui permet de definir le chemin de la page demandée
148:             * @param location String chemin de la page
149:             */
150:            public void setLocation(String location) {
151:                super .ajouterChamps("Location", location);
152:            }
153:
154:            /**
155:             *.Methode qui permet d'obtenir le chemin de la page demandée
156:             * @return String chemin de la page
157:             */
158:            public String getLocation() {
159:                return super .getChamps("Location");
160:            }
161:
162:            /**
163:             *.Methode qui permet de savoir si le chemin de la page est definit
164:             * @return boolean true si definit false sinon
165:             */
166:            public boolean isSetLocation() {
167:                return super .contientChamps("Location");
168:            }
169:
170:            /**
171:             *.Methode qui permet de definir le nom du serveur
172:             * @param server String le nom du serveur
173:             */
174:            public void setServer(String server) {
175:                super .ajouterChamps("Server", server);
176:            }
177:
178:            /**
179:             *.Methode qui permet de savoir si le chemin de la page est definit
180:             * @return boolean true si definit false sinon
181:             */
182:            public boolean isSetServer() {
183:                return super .contientChamps("Server");
184:            }
185:
186:            /**
187:             *.Methode qui permet d'obtenir le nom du serveur
188:             * @return String le nom du serveur
189:             */
190:            public String getServer() {
191:                return super .getChamps("Server");
192:            }
193:
194:            /**
195:             *.Methode qui permet de definir un modèle d'identification
196:             * @param wwwAuthentificate String modèle d'identification
197:             */
198:            public void setWWWAuthentificate(String wwwAuthentificate) {
199:                super .ajouterChamps("WWW-Authentificate", wwwAuthentificate);
200:            }
201:
202:            /**
203:             * Methode qui permet d'obtenir un modèle d'identification
204:             * @return String modèle d'identification
205:             */
206:            public String getWWWAuthentificate() {
207:                return super .getChamps("WWW-Authentificate");
208:            }
209:
210:            /**
211:             *.Methode qui permet de savoir si un modèle d'identification est definit
212:             * @return boolean true si definit false sinon
213:             */
214:            public boolean isSetWWWAuthentificate() {
215:                return super .contientChamps("WWW-Authentificate");
216:            }
217:
218:            // definition des principales entetes de requetes (voir RFC 1945)
219:            public static EnteteReponse reponseOK = new EnteteReponse(200, "OK");
220:            public static EnteteReponse reponseCreated = new EnteteReponse(201,
221:                    "Created");
222:            public static EnteteReponse reponseAccepted = new EnteteReponse(
223:                    202, "Accepted");
224:            public static EnteteReponse reponseNoContent = new EnteteReponse(
225:                    204, "No Content");
226:            public static EnteteReponse reponseMovedPermanently = new EnteteReponse(
227:                    301, "Moved Permanently");
228:            public static EnteteReponse reponseMovedTemporarily = new EnteteReponse(
229:                    302, "Moved Temporarily");
230:            public static EnteteReponse reponseNotMidified = new EnteteReponse(
231:                    304, "Not Modified");
232:            public static EnteteReponse reponseBadRequest = new EnteteReponse(
233:                    400, "Bad Request");
234:            public static EnteteReponse reponseUnauthorized = new EnteteReponse(
235:                    401, "Unauthorized");
236:            public static EnteteReponse reponseForbidden = new EnteteReponse(
237:                    403, "Forbidden");
238:            public static EnteteReponse reponseNotFound = new EnteteReponse(
239:                    404, "Not Found");
240:            public static EnteteReponse reponseInternalServerError = new EnteteReponse(
241:                    500, "Internal Server Error");
242:            public static EnteteReponse reponseNotImplemented = new EnteteReponse(
243:                    501, "Not Implemented");
244:            public static EnteteReponse reponseBadGateway = new EnteteReponse(
245:                    502, "Bad Gateway");
246:            public static EnteteReponse reponseServiceUnavailable = new EnteteReponse(
247:                    503, "Service Unavailable");
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.