as3corelib 0.1.0 → 0.85.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -4
- data/Gemfile.lock +7 -4
- data/README.textile +20 -10
- data/Rakefile +32 -2
- data/as3corelib.gemspec +13 -11
- data/lib/as3corelib.rb +10 -4
- data/lib/as3corelib/version.rb +4 -0
- metadata +31 -121
- data/build/build.properties +0 -48
- data/build/build.xml +0 -104
- data/examples/JSONExample/JSONExample.mxml +0 -73
- data/src/com/adobe/air/crypto/EncryptionKeyGenerator.as +0 -313
- data/src/com/adobe/air/filesystem/FileMonitor.as +0 -245
- data/src/com/adobe/air/filesystem/FileUtil.as +0 -63
- data/src/com/adobe/air/filesystem/VolumeMonitor.as +0 -184
- data/src/com/adobe/air/filesystem/events/FileMonitorEvent.as +0 -61
- data/src/com/adobe/air/logging/FileTarget.as +0 -95
- data/src/com/adobe/air/net/ResourceCache.as +0 -165
- data/src/com/adobe/air/net/events/ResourceCacheEvent.as +0 -70
- data/src/com/adobe/crypto/HMAC.as +0 -127
- data/src/com/adobe/crypto/MD5.as +0 -281
- data/src/com/adobe/crypto/MD5Stream.as +0 -402
- data/src/com/adobe/crypto/SHA1.as +0 -289
- data/src/com/adobe/crypto/SHA224.as +0 -257
- data/src/com/adobe/crypto/SHA256.as +0 -261
- data/src/com/adobe/crypto/WSSEUsernameToken.as +0 -114
- data/src/com/adobe/errors/IllegalStateError.as +0 -63
- data/src/com/adobe/fileformats/vcard/Address.as +0 -47
- data/src/com/adobe/fileformats/vcard/Email.as +0 -39
- data/src/com/adobe/fileformats/vcard/Phone.as +0 -39
- data/src/com/adobe/fileformats/vcard/VCard.as +0 -54
- data/src/com/adobe/fileformats/vcard/VCardParser.as +0 -246
- data/src/com/adobe/images/BitString.as +0 -39
- data/src/com/adobe/images/JPGEncoder.as +0 -648
- data/src/com/adobe/images/PNGEncoder.as +0 -141
- data/src/com/adobe/net/DynamicURLLoader.as +0 -55
- data/src/com/adobe/net/IURIResolver.as +0 -76
- data/src/com/adobe/net/MimeTypeMap.as +0 -200
- data/src/com/adobe/net/URI.as +0 -2466
- data/src/com/adobe/net/URIEncodingBitmap.as +0 -139
- data/src/com/adobe/net/proxies/RFC2817Socket.as +0 -198
- data/src/com/adobe/protocols/dict/Database.as +0 -66
- data/src/com/adobe/protocols/dict/Definition.as +0 -71
- data/src/com/adobe/protocols/dict/Dict.as +0 -360
- data/src/com/adobe/protocols/dict/DictionaryServer.as +0 -60
- data/src/com/adobe/protocols/dict/MatchStrategy.as +0 -66
- data/src/com/adobe/protocols/dict/Response.as +0 -71
- data/src/com/adobe/protocols/dict/events/ConnectedEvent.as +0 -53
- data/src/com/adobe/protocols/dict/events/DatabaseEvent.as +0 -67
- data/src/com/adobe/protocols/dict/events/DefinitionEvent.as +0 -70
- data/src/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as +0 -69
- data/src/com/adobe/protocols/dict/events/DictionaryServerEvent.as +0 -69
- data/src/com/adobe/protocols/dict/events/DisconnectedEvent.as +0 -55
- data/src/com/adobe/protocols/dict/events/ErrorEvent.as +0 -80
- data/src/com/adobe/protocols/dict/events/MatchEvent.as +0 -67
- data/src/com/adobe/protocols/dict/events/MatchStrategiesEvent.as +0 -70
- data/src/com/adobe/protocols/dict/events/NoMatchEvent.as +0 -54
- data/src/com/adobe/protocols/dict/util/CompleteResponseEvent.as +0 -68
- data/src/com/adobe/protocols/dict/util/SocketHelper.as +0 -81
- data/src/com/adobe/serialization/json/JSON.as +0 -86
- data/src/com/adobe/serialization/json/JSONDecoder.as +0 -327
- data/src/com/adobe/serialization/json/JSONEncoder.as +0 -312
- data/src/com/adobe/serialization/json/JSONParseError.as +0 -87
- data/src/com/adobe/serialization/json/JSONToken.as +0 -104
- data/src/com/adobe/serialization/json/JSONTokenType.as +0 -69
- data/src/com/adobe/serialization/json/JSONTokenizer.as +0 -702
- data/src/com/adobe/utils/ArrayUtil.as +0 -187
- data/src/com/adobe/utils/DateUtil.as +0 -701
- data/src/com/adobe/utils/DictionaryUtil.as +0 -87
- data/src/com/adobe/utils/IntUtil.as +0 -99
- data/src/com/adobe/utils/NumberFormatter.as +0 -74
- data/src/com/adobe/utils/StringUtil.as +0 -239
- data/src/com/adobe/utils/XMLUtil.as +0 -168
- data/src/com/adobe/webapis/ServiceBase.as +0 -48
- data/src/com/adobe/webapis/URLLoaderBase.as +0 -108
- data/src/com/adobe/webapis/events/ServiceEvent.as +0 -82
- data/tests/src/CoreLibTestRunner-app.xml +0 -135
- data/tests/src/CoreLibTestRunner.as +0 -138
- data/tests/src/CoreLibTestRunner.mxml +0 -46
- data/tests/src/com/adobe/air/crypto/EncryptionKeyGeneratorTest.as +0 -176
- data/tests/src/com/adobe/air/filesystem/FileMonitorTest.as +0 -63
- data/tests/src/com/adobe/air/filesystem/VolumeMonitorTest.as +0 -57
- data/tests/src/com/adobe/air/filesystem/events/FileMonitorEventTest.as +0 -59
- data/tests/src/com/adobe/air/net/events/ResourceCacheEventTest.as +0 -72
- data/tests/src/com/adobe/crypto/HMACMD5Test.as +0 -134
- data/tests/src/com/adobe/crypto/HMACSHA1Test.as +0 -138
- data/tests/src/com/adobe/crypto/MD5Test.as +0 -82
- data/tests/src/com/adobe/crypto/SHA1Test.as +0 -151
- data/tests/src/com/adobe/crypto/SHA224Test.as +0 -104
- data/tests/src/com/adobe/crypto/SHA256Test.as +0 -116
- data/tests/src/com/adobe/crypto/WSSEUsernameTokenTest.as +0 -87
- data/tests/src/com/adobe/images/JPGEncoderTest.as +0 -54
- data/tests/src/com/adobe/images/PNGEncoderTest.as +0 -54
- data/tests/src/com/adobe/net/URITest.as +0 -589
- data/tests/src/com/adobe/protocols/events/ConnectedEventTest.as +0 -59
- data/tests/src/com/adobe/protocols/events/DatabaseEventTest.as +0 -62
- data/tests/src/com/adobe/protocols/events/DefinitionEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/DefinitionHeaderEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/DictionaryServerEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/DisconnectedEventTest.as +0 -59
- data/tests/src/com/adobe/protocols/events/ErrorEventTest.as +0 -63
- data/tests/src/com/adobe/protocols/events/MatchEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/MatchStrategiesEventTest.as +0 -61
- data/tests/src/com/adobe/protocols/events/NoMatchEventTest.as +0 -58
- data/tests/src/com/adobe/protocols/util/CompletedResponseEventTest.as +0 -60
- data/tests/src/com/adobe/serialization/json/JSONTest.as +0 -522
- data/tests/src/com/adobe/serialization/json/SimpleClass.as +0 -85
- data/tests/src/com/adobe/utils/ArrayUtilTest.as +0 -173
- data/tests/src/com/adobe/utils/DateUtilTest.as +0 -436
- data/tests/src/com/adobe/utils/DictionaryUtilTest.as +0 -93
- data/tests/src/com/adobe/utils/IntUtilTest.as +0 -73
- data/tests/src/com/adobe/utils/NumberFormatterTest.as +0 -70
- data/tests/src/com/adobe/utils/StringUtilTest.as +0 -304
- data/tests/src/com/adobe/utils/XMLUtilTest.as +0 -101
- data/tests/src/com/adobe/webapis/events/ServiceEventTest.as +0 -66
@@ -1,360 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2009, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.protocols.dict
|
34
|
-
{
|
35
|
-
import com.adobe.protocols.dict.events.*;
|
36
|
-
import com.adobe.protocols.dict.util.*;
|
37
|
-
|
38
|
-
import flash.events.Event;
|
39
|
-
import flash.events.EventDispatcher;
|
40
|
-
import flash.events.IOErrorEvent;
|
41
|
-
import flash.events.ProgressEvent;
|
42
|
-
import flash.events.SecurityErrorEvent;
|
43
|
-
import flash.net.Socket;
|
44
|
-
import mx.rpc.http.HTTPService;
|
45
|
-
import mx.rpc.events.ResultEvent;
|
46
|
-
import mx.rpc.events.FaultEvent;
|
47
|
-
import flash.xml.XMLNode;
|
48
|
-
import mx.utils.StringUtil;
|
49
|
-
|
50
|
-
public class Dict
|
51
|
-
extends EventDispatcher
|
52
|
-
{
|
53
|
-
// Event type names.
|
54
|
-
//public static var CONNECTED:String = "connected";
|
55
|
-
//public static var DISCONNECTED:String = "disconnected";
|
56
|
-
public static var IO_ERROR:String = IOErrorEvent.IO_ERROR;
|
57
|
-
//public static var ERROR:String = "error";
|
58
|
-
//public static var SERVERS:String = "servers";
|
59
|
-
//public static var DATABASES:String = "databases";
|
60
|
-
//public static var MATCH_STRATEGIES:String = "matchStrategies";
|
61
|
-
//public static var DEFINITION:String = "definition";
|
62
|
-
//public static var DEFINITION_HEADER:String = "definitionHeader";
|
63
|
-
//public static var MATCH:String = "match";
|
64
|
-
//public static var NO_MATCH:String = "noMatch";
|
65
|
-
|
66
|
-
public static var FIRST_MATCH:uint = 0;
|
67
|
-
public static var ALL_DATABASES:uint = 1;
|
68
|
-
|
69
|
-
private var socket:SocketHelper;
|
70
|
-
|
71
|
-
private var dbShortList:Boolean;
|
72
|
-
|
73
|
-
public function Dict()
|
74
|
-
{
|
75
|
-
this.socket = new SocketHelper();
|
76
|
-
this.socket.addEventListener(Event.CONNECT, connected);
|
77
|
-
this.socket.addEventListener(Event.CLOSE, disconnected);
|
78
|
-
this.socket.addEventListener(SocketHelper.COMPLETE_RESPONSE, incomingData);
|
79
|
-
this.socket.addEventListener(IOErrorEvent.IO_ERROR, ioError);
|
80
|
-
this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
|
81
|
-
}
|
82
|
-
|
83
|
-
public function connect(server:String, port:uint = 2628):void
|
84
|
-
{
|
85
|
-
if (this.socket.connected)
|
86
|
-
{
|
87
|
-
this.socket.close();
|
88
|
-
}
|
89
|
-
this.socket.connect(server, port);
|
90
|
-
}
|
91
|
-
|
92
|
-
public function connectThroughProxy(proxyServer:String,
|
93
|
-
proxyPort:int,
|
94
|
-
server:String,
|
95
|
-
port:uint = 2628):void
|
96
|
-
{
|
97
|
-
if (this.socket.connected)
|
98
|
-
{
|
99
|
-
this.socket.close();
|
100
|
-
}
|
101
|
-
this.socket.setProxyInfo(proxyServer, proxyPort);
|
102
|
-
this.socket.connect(server, port);
|
103
|
-
}
|
104
|
-
|
105
|
-
public function disconnect():void
|
106
|
-
{
|
107
|
-
this.socket.close();
|
108
|
-
this.disconnected(null);
|
109
|
-
}
|
110
|
-
|
111
|
-
public function getServers():void
|
112
|
-
{
|
113
|
-
var http:HTTPService = new HTTPService();
|
114
|
-
http.url = "http://luetzschena-stahmeln.de/dictd/xmllist.php";
|
115
|
-
http.addEventListener(ResultEvent.RESULT, incomingServerXML);
|
116
|
-
http.addEventListener(FaultEvent.FAULT, httpError);
|
117
|
-
http.resultFormat = HTTPService.RESULT_FORMAT_E4X;
|
118
|
-
http.send();
|
119
|
-
}
|
120
|
-
|
121
|
-
public function getDatabases(shortList:Boolean=true):void
|
122
|
-
{
|
123
|
-
this.dbShortList = shortList;
|
124
|
-
this.socket.writeUTFBytes("show db\r\n");
|
125
|
-
this.socket.flush();
|
126
|
-
}
|
127
|
-
|
128
|
-
public function getMatchStrategies():void
|
129
|
-
{
|
130
|
-
this.socket.writeUTFBytes("show strat\r\n");
|
131
|
-
this.socket.flush();
|
132
|
-
}
|
133
|
-
|
134
|
-
public function match(database:String, term:String, scope:String="prefix"):void
|
135
|
-
{
|
136
|
-
this.socket.writeUTFBytes("match " + database + " " + scope + " \"" + term + "\"\r\n");
|
137
|
-
this.socket.flush();
|
138
|
-
}
|
139
|
-
|
140
|
-
public function define(database:String, term:String):void
|
141
|
-
{
|
142
|
-
this.socket.writeUTFBytes("define " + database + " \"" + term + "\"\r\n");
|
143
|
-
this.socket.flush();
|
144
|
-
}
|
145
|
-
|
146
|
-
public function lookup(term:String, scope:uint):void
|
147
|
-
{
|
148
|
-
var flag:String;
|
149
|
-
if (scope == Dict.ALL_DATABASES)
|
150
|
-
{
|
151
|
-
flag = "*";
|
152
|
-
}
|
153
|
-
else if (scope == Dict.FIRST_MATCH)
|
154
|
-
{
|
155
|
-
flag = "!";
|
156
|
-
}
|
157
|
-
this.socket.writeUTFBytes("define " + flag + " \"" + term + "\"\r\n");
|
158
|
-
this.socket.flush();
|
159
|
-
}
|
160
|
-
|
161
|
-
//// Private functions ////
|
162
|
-
|
163
|
-
private function connected(event:Event):void
|
164
|
-
{
|
165
|
-
// Wait to dispatch an event until we get the 220 response.
|
166
|
-
}
|
167
|
-
|
168
|
-
private function disconnected(event:Event):void
|
169
|
-
{
|
170
|
-
dispatchEvent(new DisconnectedEvent(DisconnectedEvent.DISCONNECTED));
|
171
|
-
}
|
172
|
-
|
173
|
-
private function incomingServerXML(event:ResultEvent):void
|
174
|
-
{
|
175
|
-
var dictd:Namespace = new Namespace("http://www.luetzschena-stahmeln.de/dictd/");
|
176
|
-
var result:XML = event.result as XML;
|
177
|
-
var server:String, description:String;
|
178
|
-
var servers:Array = new Array();
|
179
|
-
for each (var serverNode:XML in result.dictd::server)
|
180
|
-
{
|
181
|
-
server = serverNode.dictd::dictdurl;
|
182
|
-
description = serverNode.dictd::description;
|
183
|
-
if (StringUtil.trim(server).length != 0 &&
|
184
|
-
StringUtil.trim(description).length != 0)
|
185
|
-
{
|
186
|
-
var dServer:DictionaryServer = new DictionaryServer();
|
187
|
-
dServer.server = server.replace("dict://", "");
|
188
|
-
dServer.description = description;
|
189
|
-
servers.push(dServer);
|
190
|
-
}
|
191
|
-
}
|
192
|
-
var dEvent:DictionaryServerEvent = new DictionaryServerEvent(DictionaryServerEvent.SERVERS);
|
193
|
-
dEvent.servers = servers;
|
194
|
-
dispatchEvent(dEvent);
|
195
|
-
}
|
196
|
-
|
197
|
-
private function incomingData(event:CompleteResponseEvent):void
|
198
|
-
{
|
199
|
-
var rawResponse:String = event.response;
|
200
|
-
var response:Response = this.parseRawResponse(rawResponse);
|
201
|
-
var responseCode:uint = response.code;
|
202
|
-
if (responseCode == 552) // no matches
|
203
|
-
{
|
204
|
-
throwNoMatchEvent(response);
|
205
|
-
}
|
206
|
-
else if (responseCode >= 400 && responseCode <= 599) // error
|
207
|
-
{
|
208
|
-
throwErrorEvent(response);
|
209
|
-
}
|
210
|
-
else if (responseCode == 220) // successful connection
|
211
|
-
{
|
212
|
-
dispatchEvent(new ConnectedEvent(ConnectedEvent.CONNECTED));
|
213
|
-
}
|
214
|
-
else if (responseCode == 110) // databases are being returned
|
215
|
-
{
|
216
|
-
throwDatabasesEvent(response);
|
217
|
-
}
|
218
|
-
else if (responseCode == 111) // matches strategies
|
219
|
-
{
|
220
|
-
throwMatchStrategiesEvent(response);
|
221
|
-
}
|
222
|
-
else if (responseCode == 152) // matches
|
223
|
-
{
|
224
|
-
throwMatchEvent(response);
|
225
|
-
}
|
226
|
-
else if (responseCode == 150)
|
227
|
-
{
|
228
|
-
throwDefinitionHeaderEvent(response);
|
229
|
-
}
|
230
|
-
else if (responseCode == 151)
|
231
|
-
{
|
232
|
-
throwDefinitionEvent(response);
|
233
|
-
}
|
234
|
-
}
|
235
|
-
|
236
|
-
private function ioError(event:IOErrorEvent):void
|
237
|
-
{
|
238
|
-
dispatchEvent(event);
|
239
|
-
}
|
240
|
-
|
241
|
-
private function httpError(event:FaultEvent):void
|
242
|
-
{
|
243
|
-
trace("httpError!");
|
244
|
-
}
|
245
|
-
|
246
|
-
private function securityError(event:SecurityErrorEvent):void
|
247
|
-
{
|
248
|
-
trace("security error!");
|
249
|
-
trace(event.text);
|
250
|
-
}
|
251
|
-
|
252
|
-
// Dispatch new events.
|
253
|
-
|
254
|
-
private function throwDatabasesEvent(response:Response):void
|
255
|
-
{
|
256
|
-
var databases:Array = new Array();
|
257
|
-
var responseArray:Array = response.body.split("\r\n");
|
258
|
-
for each (var line:String in responseArray)
|
259
|
-
{
|
260
|
-
var name:String = line.substring(0, line.indexOf(" "));
|
261
|
-
if (name == "--exit--")
|
262
|
-
{
|
263
|
-
if (this.dbShortList)
|
264
|
-
{
|
265
|
-
break;
|
266
|
-
}
|
267
|
-
continue;
|
268
|
-
}
|
269
|
-
var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
|
270
|
-
databases.push(new Database(name, description));
|
271
|
-
}
|
272
|
-
var event:DatabaseEvent = new DatabaseEvent(DatabaseEvent.DATABASES);
|
273
|
-
event.databases = databases;
|
274
|
-
dispatchEvent(event);
|
275
|
-
}
|
276
|
-
|
277
|
-
private function throwMatchStrategiesEvent(response:Response):void
|
278
|
-
{
|
279
|
-
var strategies:Array = new Array();
|
280
|
-
var responseArray:Array = response.body.split("\r\n");
|
281
|
-
for each (var line:String in responseArray)
|
282
|
-
{
|
283
|
-
var name:String = line.substring(0, line.indexOf(" "));
|
284
|
-
var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
|
285
|
-
strategies.push(new MatchStrategy(name, description));
|
286
|
-
}
|
287
|
-
var event:MatchStrategiesEvent = new MatchStrategiesEvent(MatchStrategiesEvent.MATCH_STRATEGIES);
|
288
|
-
event.strategies = strategies;
|
289
|
-
dispatchEvent(event);
|
290
|
-
}
|
291
|
-
|
292
|
-
private function throwMatchEvent(response:Response):void
|
293
|
-
{
|
294
|
-
var matches:Array = new Array();
|
295
|
-
var responseArray:Array = response.body.split("\r\n");
|
296
|
-
for each (var line:String in responseArray)
|
297
|
-
{
|
298
|
-
var match:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
|
299
|
-
matches.push(match);
|
300
|
-
}
|
301
|
-
var event:MatchEvent = new MatchEvent(MatchEvent.MATCH);
|
302
|
-
event.matches = matches;
|
303
|
-
dispatchEvent(event);
|
304
|
-
}
|
305
|
-
|
306
|
-
private function throwErrorEvent(response:Response):void
|
307
|
-
{
|
308
|
-
var event:ErrorEvent = new ErrorEvent(ErrorEvent.ERROR);
|
309
|
-
event.code = response.code;
|
310
|
-
event.message = response.headerText;
|
311
|
-
dispatchEvent(event);
|
312
|
-
}
|
313
|
-
|
314
|
-
private function throwNoMatchEvent(response:Response):void
|
315
|
-
{
|
316
|
-
dispatchEvent(new NoMatchEvent(NoMatchEvent.NO_MATCH));
|
317
|
-
}
|
318
|
-
|
319
|
-
private function throwDefinitionHeaderEvent(response:Response):void
|
320
|
-
{
|
321
|
-
var event:DefinitionHeaderEvent = new DefinitionHeaderEvent(DefinitionHeaderEvent.DEFINITION_HEADER);
|
322
|
-
event.definitionCount = uint(response.headerText.substring(0, response.headerText.indexOf(" ")));
|
323
|
-
dispatchEvent(event);
|
324
|
-
}
|
325
|
-
|
326
|
-
private function throwDefinitionEvent(response:Response):void
|
327
|
-
{
|
328
|
-
var event:DefinitionEvent = new DefinitionEvent(DefinitionEvent.DEFINITION);
|
329
|
-
var def:Definition = new Definition();
|
330
|
-
var headerText:String = response.headerText;
|
331
|
-
var tokens:Array = headerText.match(/"[^"]+"/g);
|
332
|
-
def.term = String(tokens[0]).replace(/"/g, "");
|
333
|
-
def.database = String(tokens[1]).replace(/"/g, "");
|
334
|
-
def.definition = response.body;
|
335
|
-
event.definition = def;
|
336
|
-
dispatchEvent(event);
|
337
|
-
}
|
338
|
-
|
339
|
-
private function parseRawResponse(rawResponse:String):Response
|
340
|
-
{
|
341
|
-
var response:Response = new Response();
|
342
|
-
var fullHeader:String;
|
343
|
-
if (rawResponse.indexOf("\r\n") != -1)
|
344
|
-
{
|
345
|
-
fullHeader = rawResponse.substring(0, rawResponse.indexOf("\r\n"));
|
346
|
-
}
|
347
|
-
else
|
348
|
-
{
|
349
|
-
fullHeader = rawResponse;
|
350
|
-
}
|
351
|
-
var responseCodeMatch:Array = fullHeader.match(/^\d{3}/);
|
352
|
-
response.code = uint(responseCodeMatch[0]);
|
353
|
-
response.headerText = fullHeader.substring(fullHeader.indexOf(" ")+1, fullHeader.length);
|
354
|
-
var body:String = rawResponse.substring(rawResponse.indexOf("\r\n")+2, rawResponse.length);
|
355
|
-
body = body.replace(/\r\n\.\./, "\r\n.");
|
356
|
-
response.body = body;
|
357
|
-
return response;
|
358
|
-
}
|
359
|
-
}
|
360
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2009, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.protocols.dict
|
34
|
-
{
|
35
|
-
public class DictionaryServer
|
36
|
-
{
|
37
|
-
private var _server:String;
|
38
|
-
private var _description:String;
|
39
|
-
|
40
|
-
public function set server(server:String):void
|
41
|
-
{
|
42
|
-
this._server = server;
|
43
|
-
}
|
44
|
-
|
45
|
-
public function get server():String
|
46
|
-
{
|
47
|
-
return this._server;
|
48
|
-
}
|
49
|
-
|
50
|
-
public function set description(description:String):void
|
51
|
-
{
|
52
|
-
this._description = description;
|
53
|
-
}
|
54
|
-
|
55
|
-
public function get description():String
|
56
|
-
{
|
57
|
-
return this._description;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
@@ -1,66 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2009, Adobe Systems Incorporated
|
3
|
-
All rights reserved.
|
4
|
-
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
6
|
-
modification, are permitted provided that the following conditions are
|
7
|
-
met:
|
8
|
-
|
9
|
-
* Redistributions of source code must retain the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer.
|
11
|
-
|
12
|
-
* Redistributions in binary form must reproduce the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer in the
|
14
|
-
documentation and/or other materials provided with the distribution.
|
15
|
-
|
16
|
-
* Neither the name of Adobe Systems Incorporated nor the names of its
|
17
|
-
contributors may be used to endorse or promote products derived from
|
18
|
-
this software without specific prior written permission.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
21
|
-
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
23
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
24
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
26
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
27
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
28
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
30
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
*/
|
32
|
-
|
33
|
-
package com.adobe.protocols.dict
|
34
|
-
{
|
35
|
-
public class MatchStrategy
|
36
|
-
{
|
37
|
-
private var _name:String;
|
38
|
-
private var _description:String;
|
39
|
-
|
40
|
-
public function MatchStrategy(name:String, description:String)
|
41
|
-
{
|
42
|
-
this._name = name;
|
43
|
-
this._description = description;
|
44
|
-
}
|
45
|
-
|
46
|
-
public function set name(name:String):void
|
47
|
-
{
|
48
|
-
this._name = name;
|
49
|
-
}
|
50
|
-
|
51
|
-
public function get name():String
|
52
|
-
{
|
53
|
-
return this._name;
|
54
|
-
}
|
55
|
-
|
56
|
-
public function set description(description:String):void
|
57
|
-
{
|
58
|
-
this._description = description;
|
59
|
-
}
|
60
|
-
|
61
|
-
public function get description():String
|
62
|
-
{
|
63
|
-
return this._description;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|