|
9 | 9 |
|
10 | 10 | package org.restlet; |
11 | 11 |
|
12 | | -import java.io.File; |
13 | | -import java.net.URI; |
14 | 12 | import java.util.List; |
15 | 13 | import java.util.concurrent.CopyOnWriteArrayList; |
16 | | -import java.util.logging.Level; |
17 | 14 |
|
18 | | -import org.restlet.data.Reference; |
19 | 15 | import org.restlet.engine.Engine; |
20 | 16 | import org.restlet.engine.component.ComponentHelper; |
21 | 17 | import org.restlet.engine.component.InternalRouter; |
22 | | -import org.restlet.representation.Representation; |
23 | | -import org.restlet.resource.ClientResource; |
24 | 18 | import org.restlet.routing.Router; |
25 | 19 | import org.restlet.routing.VirtualHost; |
26 | 20 | import org.restlet.security.Realm; |
|
43 | 37 | * that provides a transformation of data via its interface." Roy T. |
44 | 38 | * Fielding<br> |
45 | 39 | * <br> |
46 | | - * The configuration of a Component can be done programmatically or by using a |
47 | | - * XML document. There are dedicated constructors that accept either an URI |
48 | | - * reference to such XML document or a representation of such XML document, |
49 | | - * allowing easy configuration of the list of supported client and server |
50 | | - * connectors as well as services. In addition, you can add and configure |
51 | | - * virtual hosts (including the default one). Finally, you can attach |
52 | | - * applications either using their fully qualified class name or by pointing to |
53 | | - * a descriptor document (at this time only WADL description are supported, see |
54 | | - * the WADL Restlet extension for details).<br> |
55 | | - * <br> |
56 | | - * The XML Schema of the configuration files is available inside the API JAR |
57 | | - * under the "org.restlet.Component.xsd" name. Here is a sample of XML |
58 | | - * configuration: |
59 | | - * |
60 | | - * <pre> |
61 | | - * <?xml version="1.0"?> |
62 | | - * <component xmlns="http://restlet.org/schemas/2.0/Component"> |
63 | | - * <client protocol="CLAP" /> |
64 | | - * <client protocol="FILE" /> |
65 | | - * <client protocols="HTTP HTTPS" /> |
66 | | - * <server protocols="HTTP HTTPS" /> |
67 | | - * |
68 | | - * <defaultHost> |
69 | | - * <attach uriPattern="/abcd/{xyz}" |
70 | | - * targetClass="org.restlet.test.MyApplication" /> |
71 | | - * <attach uriPattern="/efgh/{xyz}" |
72 | | - * targetDescriptor="clap://class/org/restlet/test/MyApplication.wadl" /> |
73 | | - * </defaultHost> |
74 | | - * </component> |
75 | | - * </pre> |
76 | | - * |
77 | | - * <br> |
78 | 40 | * Components also have useful services associated. They are all enabled by |
79 | 41 | * default and are available as properties that can be eventually overridden: |
80 | 42 | * <ul> |
|
96 | 58 | */ |
97 | 59 | public class Component extends Restlet { |
98 | 60 |
|
99 | | - /** |
100 | | - * Used as bootstrap for configuring and running a component in command line. |
101 | | - * Just provide as first and unique parameter the URI to the XML file. Note that |
102 | | - * relative paths are accepted. |
103 | | - * |
104 | | - * @param args The list of in-line parameters. |
105 | | - * @deprecated Use XML support in the Spring extension instead. |
106 | | - */ |
107 | | - @Deprecated |
108 | | - public static void main(String[] args) throws Exception { |
109 | | - try { |
110 | | - if ((args == null) || (args.length != 1)) { |
111 | | - // Display program arguments |
112 | | - System.err.println("Can't launch the component. Requires the path to an XML configuration file.\n"); |
113 | | - } else { |
114 | | - // Create and start the component |
115 | | - URI currentDirURI = (new File(".")).toURI(); |
116 | | - URI confURI = currentDirURI.resolve(args[0]); |
117 | | - new Component(confURI.toString()).start(); |
118 | | - } |
119 | | - } catch (Exception e) { |
120 | | - System.err.println("Can't launch the component.\nAn unexpected exception occurred:"); |
121 | | - e.printStackTrace(System.err); |
122 | | - } |
123 | | - } |
124 | | - |
125 | 61 | /** The modifiable list of client connectors. */ |
126 | 62 | private final ClientList clients; |
127 | 63 |
|
@@ -177,61 +113,6 @@ public Component() { |
177 | 113 | } |
178 | 114 | } |
179 | 115 |
|
180 | | - /** |
181 | | - * Constructor with the reference to the XML configuration file. |
182 | | - * |
183 | | - * @param xmlConfigRef The URI reference to the XML configuration file. |
184 | | - * @deprecated Use XML support in the Spring extension instead. |
185 | | - */ |
186 | | - @Deprecated |
187 | | - public Component(Reference xmlConfigRef) { |
188 | | - this(); |
189 | | - |
190 | | - // Get the representation of the configuration file. |
191 | | - Representation xmlConfigRepresentation = null; |
192 | | - |
193 | | - if (xmlConfigRef != null) { |
194 | | - ClientResource cr = new ClientResource(xmlConfigRef); |
195 | | - xmlConfigRepresentation = cr.get(); |
196 | | - |
197 | | - if (xmlConfigRepresentation != null) { |
198 | | - new org.restlet.engine.component.ComponentXmlParser(this, xmlConfigRepresentation).parse(); |
199 | | - } else { |
200 | | - getLogger().log(Level.WARNING, |
201 | | - "Unable to get the Component XML configuration located at this URI: " + xmlConfigRef); |
202 | | - } |
203 | | - } |
204 | | - } |
205 | | - |
206 | | - /** |
207 | | - * Constructor with the representation of the XML configuration file. |
208 | | - * |
209 | | - * @param xmlConfigRepresentation The representation of the XML configuration |
210 | | - * file. |
211 | | - * @deprecated Use XML support in the Spring extension instead. |
212 | | - */ |
213 | | - @Deprecated |
214 | | - public Component(Representation xmlConfigRepresentation) { |
215 | | - this(); |
216 | | - |
217 | | - if (xmlConfigRepresentation != null) { |
218 | | - new org.restlet.engine.component.ComponentXmlParser(this, xmlConfigRepresentation).parse(); |
219 | | - } else { |
220 | | - getLogger().log(Level.WARNING, "Unable to parse the Component XML configuration."); |
221 | | - } |
222 | | - } |
223 | | - |
224 | | - /** |
225 | | - * Constructor with the URI reference to the XML configuration file. |
226 | | - * |
227 | | - * @param xmlConfigurationRef The URI reference to the XML configuration file. |
228 | | - * @deprecated Use XML support in the Spring extension instead. |
229 | | - */ |
230 | | - @Deprecated |
231 | | - public Component(String xmlConfigurationRef) { |
232 | | - this((xmlConfigurationRef == null) ? null : new Reference(xmlConfigurationRef)); |
233 | | - } |
234 | | - |
235 | 116 | /** |
236 | 117 | * Returns a modifiable list of client connectors. |
237 | 118 | * |
|
0 commit comments