<commit_before>// vim: tabstop=4 shiftwidth=4

// Copyright (c) 2010 , NetEase.com,Inc. All rights reserved.
//
// Author: <NAME> (<EMAIL>)
//
// Use, modification and distribution are subject to the "New BSD License"
// as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.

package com.netease.protobuf {
	import flash.net.*;
	import flash.utils.*;
	import flash.events.*;
	public final class SimpleWebRPC {
		private var urlPrefix:String
		public function SimpleWebRPC(urlPrefix:String) {
			this.urlPrefix = urlPrefix;
		}
		private static const REF:Dictionary = new Dictionary();
		public function send(qualifiedMethodName:String,
							 input:IExternalizable,
							 rpcResult:Function,
							 outputType:Class):void {

			const loader:URLLoader = new URLLoader
			REF[loader] = true;
			loader.dataFormat = URLLoaderDataFormat.BINARY
			loader.addEventListener(Event.COMPLETE, function(event:Event):void {
				delete REF[loader]
				const output:IExternalizable = new outputType
				output.readExternal(loader.data)
				rpcResult(output)
			})
			function errorEventHandler(event:Event):void {
				delete REF[loader]
				rpcResult(event)
			}
			loader.addEventListener(IOErrorEvent.IO_ERROR, errorEventHandler)
			loader.addEventListener(
					SecurityErrorEvent.SECURITY_ERROR, errorEventHandler)
			const request:URLRequest = new URLRequest(
				urlPrefix + qualifiedMethodName.replace(/\./g, "/"))
			request.method = URLRequestMethod.POST
			const requestContent:ByteArray = new ByteArray
			input.writeExternal(requestContent)
			request.data = requestContent
			request.contentType = "application/x-protobuf"
			loader.load(request)
		}
	}
}<commit_msg>映射 URL 时，如果包以 com 、 org 、 net 开始，则忽略前三级包路径<commit_after>// vim: tabstop=4 shiftwidth=4

// Copyright (c) 2010 , NetEase.com,Inc. All rights reserved.
//
// Author: <NAME> (<EMAIL>)
//
// Use, modification and distribution are subject to the "New BSD License"
// as listed at <url: http://www.opensource.org/licenses/bsd-license.php >.

package com.netease.protobuf {
	import flash.net.*;
	import flash.utils.*;
	import flash.events.*;
	public final class SimpleWebRPC {
		private var urlPrefix:String
		public function SimpleWebRPC(urlPrefix:String) {
			this.urlPrefix = urlPrefix;
		}

		private static const REF:Dictionary = new Dictionary();

		public function send(qualifiedMethodName:String,
							 input:IExternalizable,
							 rpcResult:Function,
							 outputType:Class):void {

			const loader:URLLoader = new URLLoader
			REF[loader] = true;
			loader.dataFormat = URLLoaderDataFormat.BINARY
			loader.addEventListener(Event.COMPLETE, function(event:Event):void {
				delete REF[loader]
				const output:IExternalizable = new outputType
				output.readExternal(loader.data)
				rpcResult(output)
			})
			function errorEventHandler(event:Event):void {
				delete REF[loader]
				rpcResult(event)
			}
			loader.addEventListener(IOErrorEvent.IO_ERROR, errorEventHandler)
			loader.addEventListener(
					SecurityErrorEvent.SECURITY_ERROR, errorEventHandler)
			const request:URLRequest = new URLRequest(
				urlPrefix + qualifiedMethodName.replace(/\./g, "/").
					replace(/^((com|org|net)\/\w+\/\w+\/)?(.*)$/, "$3"))
			const requestContent:ByteArray = new ByteArray
			input.writeExternal(requestContent)
			if (requestContent.length != 0)
			{
				request.data = requestContent
			}
			request.contentType = "application/x-protobuf"
			request.method = URLRequestMethod.POST
			loader.load(request)
		}
	}
}
{'fraction_non_alphanumeric': 0.11414745231995445, 'fraction_numerical': 0.003985197836606889, 'mean_word_length': 4.01283880171184, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '513055', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1066, 'n_words': 229}