Source Code Cross Referenced for TunnelService.java in  » Web-Services » restlet-1.0.8 » org » restlet » service » 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 Services » restlet 1.0.8 » org.restlet.service 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 Noelios Consulting.
003:         * 
004:         * The contents of this file are subject to the terms of the Common Development
005:         * and Distribution License (the "License"). You may not use this file except in
006:         * compliance with the License.
007:         * 
008:         * You can obtain a copy of the license at
009:         * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
010:         * language governing permissions and limitations under the License.
011:         * 
012:         * When distributing Covered Code, include this CDDL HEADER in each file and
013:         * include the License file at http://www.opensource.org/licenses/cddl1.txt If
014:         * applicable, add the following below this CDDL HEADER, with the fields
015:         * enclosed by brackets "[]" replaced with your own identifying information:
016:         * Portions Copyright [yyyy] [name of copyright owner]
017:         */
018:
019:        package org.restlet.service;
020:
021:        import org.restlet.data.ClientInfo;
022:
023:        /**
024:         * Service tunnelling method names or client preferences via query parameters.
025:         * Clients applications such as browsers can easily override the default values
026:         * of their client connector by specifying additional query parameters. Here is
027:         * the list of the default parameter names supported: <table>
028:         * <tr>
029:         * <th>Property</th>
030:         * <th>Default name</th>
031:         * <th>Value type</th>
032:         * <th>Description</th>
033:         * </tr>
034:         * <tr>
035:         * <td>methodParameter</td>
036:         * <td>method</td>
037:         * <td>See values in org.restlet.data.Method</td>
038:         * <td>For POST requests, specify the actual method to use (DELETE, PUT, etc.).</td>
039:         * </tr>
040:         * <tr>
041:         * <td>characterSetParameter</td>
042:         * <td>charset</td>
043:         * <td>Use extension names defined in org.restlet.service.MetadataService</td>
044:         * <td>For GET requests, replaces the accepted character set by the given
045:         * value.</td>
046:         * </tr>
047:         * <tr>
048:         * <td>encodingParameter</td>
049:         * <td>encoding</td>
050:         * <td>Use extension names defined in org.restlet.service.MetadataService</td>
051:         * <td>For GET requests, replaces the accepted encoding by the given value.</td>
052:         * </tr>
053:         * <tr>
054:         * <td>languageParameter</td>
055:         * <td>language</td>
056:         * <td>Use extension names defined in org.restlet.service.MetadataService</td>
057:         * <td>For GET requests, replaces the accepted language by the given value.</td>
058:         * </tr>
059:         * <tr>
060:         * <td>mediaTypeParameter</td>
061:         * <td>media</td>
062:         * <td>Use extension names defined in org.restlet.service.MetadataService</td>
063:         * <td>For GET requests, replaces the accepted media type set by the given
064:         * value.</td>
065:         * </tr>
066:         * </table>
067:         * 
068:         * @author Jerome Louvel (contact@noelios.com)
069:         */
070:        public class TunnelService {
071:            /** Indicates if the service has been enabled. */
072:            private boolean enabled;
073:
074:            /** Indicates if the method name can be tunneled. */
075:            private boolean methodTunnel;
076:
077:            /** The name of the parameter containing the method name. */
078:            private String methodParameter;
079:
080:            /** Indicates if the client preferences can be tunneled. */
081:            private boolean preferencesTunnel;
082:
083:            /** The name of the parameter containing the accepted character set. */
084:            private String characterSetParameter;
085:
086:            /** The name of the parameter containing the accepted encoding. */
087:            private String encodingParameter;
088:
089:            /** The name of the parameter containing the accepted language. */
090:            private String languageParameter;
091:
092:            /** The name of the parameter containing the accepted media type. */
093:            private String mediaTypeParameter;
094:
095:            /**
096:             * Constructor.
097:             * 
098:             * @param enabled
099:             *            True if the service has been enabled.
100:             * @param methodTunnel
101:             *            Indicates if the method name can be tunneled.
102:             * @param preferencesTunnel
103:             *            Indicates if the client preferences can be tunneled.
104:             */
105:            public TunnelService(boolean enabled, boolean methodTunnel,
106:                    boolean preferencesTunnel) {
107:                this .enabled = enabled;
108:                this .methodTunnel = methodTunnel;
109:                this .methodParameter = "method";
110:                this .preferencesTunnel = preferencesTunnel;
111:                this .characterSetParameter = "charset";
112:                this .encodingParameter = "encoding";
113:                this .languageParameter = "language";
114:                this .mediaTypeParameter = "media";
115:            }
116:
117:            /**
118:             * Indicates if the request from a given client can be tunnelled. The
119:             * default implementation always return true. This could be customize to
120:             * restrict the usage of the tunnel service.
121:             * 
122:             * @param client
123:             *            The client to test.
124:             * @return True if the request from a given client can be tunnelled.
125:             */
126:            public boolean allowClient(ClientInfo client) {
127:                return true;
128:            }
129:
130:            /**
131:             * Returns the character set parameter name.
132:             * 
133:             * @return The character set parameter name.
134:             */
135:            public String getCharacterSetAttribute() {
136:                return this .characterSetParameter;
137:            }
138:
139:            /**
140:             * Returns the name of the parameter containing the accepted encoding.
141:             * 
142:             * @return The name of the parameter containing the accepted encoding.
143:             */
144:            public String getEncodingAttribute() {
145:                return this .encodingParameter;
146:            }
147:
148:            /**
149:             * Returns the name of the parameter containing the accepted language.
150:             * 
151:             * @return The name of the parameter containing the accepted language.
152:             */
153:            public String getLanguageAttribute() {
154:                return this .languageParameter;
155:            }
156:
157:            /**
158:             * Returns the name of the parameter containing the accepted media type.
159:             * 
160:             * @return The name of the parameter containing the accepted media type.
161:             */
162:            public String getMediaTypeAttribute() {
163:                return this .mediaTypeParameter;
164:            }
165:
166:            /**
167:             * Returns the method parameter name.
168:             * 
169:             * @return The method parameter name.
170:             */
171:            public String getMethodParameter() {
172:                return this .methodParameter;
173:            }
174:
175:            /**
176:             * Indicates if the service should be enabled.
177:             * 
178:             * @return True if the service should be enabled.
179:             */
180:            public boolean isEnabled() {
181:                return this .enabled;
182:            }
183:
184:            /**
185:             * Indicates if the method name can be tunneled.
186:             * 
187:             * @return True if the method name can be tunneled.
188:             */
189:            public boolean isMethodTunnel() {
190:                return this .methodTunnel;
191:            }
192:
193:            /**
194:             * Indicates if the client preferences can be tunneled.
195:             * 
196:             * @return True if the client preferences can be tunneled.
197:             */
198:            public boolean isPreferencesTunnel() {
199:                return this .preferencesTunnel;
200:            }
201:
202:            /**
203:             * Sets the character set parameter name.
204:             * 
205:             * @param parameterName
206:             *            The character set parameter name.
207:             */
208:            public void setCharacterSetAttribute(String parameterName) {
209:                this .characterSetParameter = parameterName;
210:            }
211:
212:            /**
213:             * Indicates if the service should be enabled.
214:             * 
215:             * @param enabled
216:             *            True if the service should be enabled.
217:             */
218:            public void setEnabled(boolean enabled) {
219:                this .enabled = enabled;
220:            }
221:
222:            /**
223:             * Sets the name of the parameter containing the accepted encoding.
224:             * 
225:             * @param parameterName
226:             *            The name of the parameter containing the accepted encoding.
227:             */
228:            public void setEncodingAttribute(String parameterName) {
229:                this .encodingParameter = parameterName;
230:            }
231:
232:            /**
233:             * Sets the name of the parameter containing the accepted language.
234:             * 
235:             * @param parameterName
236:             *            The name of the parameter containing the accepted language.
237:             */
238:            public void setLanguageAttribute(String parameterName) {
239:                this .languageParameter = parameterName;
240:            }
241:
242:            /**
243:             * Sets the name of the parameter containing the accepted media type.
244:             * 
245:             * @param parameterName
246:             *            The name of the parameter containing the accepted media type.
247:             */
248:            public void setMediaTypeAttribute(String parameterName) {
249:                this .mediaTypeParameter = parameterName;
250:            }
251:
252:            /**
253:             * Sets the method parameter name.
254:             * 
255:             * @param parameterName
256:             *            The method parameter name.
257:             */
258:            public void setMethodParameter(String parameterName) {
259:                this .methodParameter = parameterName;
260:            }
261:
262:            /**
263:             * Indicates if the method name can be tunneled.
264:             * 
265:             * @param methodTunnel
266:             *            True if the method name can be tunneled.
267:             */
268:            public void setMethodTunnel(boolean methodTunnel) {
269:                this .methodTunnel = methodTunnel;
270:            }
271:
272:            /**
273:             * Indicates if the client preferences can be tunneled.
274:             * 
275:             * @param preferencesTunnel
276:             *            True if the client preferences can be tunneled.
277:             */
278:            public void setPreferencesTunnel(boolean preferencesTunnel) {
279:                this.preferencesTunnel = preferencesTunnel;
280:            }
281:
282:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.