├── .gitignore
├── LICENSE
├── README.md
├── TranslationAS.jar
├── build.xml
├── build
└── built-jar.properties
├── libs
├── commons-codec-1.9.jar
├── commons-httpclient-3.1.jar
├── commons-io-2.4.jar
├── commons-logging-1.2.jar
├── httpasyncclient-4.1.jar
├── httpasyncclient-cache-4.1.jar
├── httpclient-4.4.1.jar
├── httpclient-cache-4.4.1.jar
├── httpcore-4.4.1.jar
├── httpcore-nio-4.4.1.jar
├── httpmime-4.1.2.jar
├── json_simple-1.1.jar
├── jsoup-1.8.3.jar
├── log4j-1.2.17.jar
├── microsoft-translator-java-api-0.6.2.jar
└── mysql-connector-java-5.1.22-bin.jar
├── manifest.mf
├── nbproject
├── build-impl.xml
├── build-native.xml
├── genfiles.properties
├── private
│ ├── config.properties
│ ├── private.properties
│ └── private.xml
├── project.properties
└── project.xml
└── src
├── test
├── AsyncClientCustomContext.java
├── DBManager.java
├── Escape.java
├── Google.java
├── HttpClientUtil.java
├── TranslateUtil.java
└── examples
│ └── org
│ └── apache
│ └── http
│ └── examples
│ └── nio
│ └── client
│ ├── AsyncClientAuthentication.java
│ ├── AsyncClientConfiguration.java
│ ├── AsyncClientCustomContext.java
│ ├── AsyncClientCustomSSL.java
│ ├── AsyncClientEvictExpiredConnections.java
│ ├── AsyncClientExecuteProxy.java
│ ├── AsyncClientHttpExchange.java
│ ├── AsyncClientHttpExchangeFutureCallback.java
│ ├── AsyncClientHttpExchangeStreaming.java
│ ├── AsyncClientPipelined.java
│ ├── AsyncClientPipelinedStreaming.java
│ ├── AsyncClientProxyAuthentication.java
│ ├── QuickStart.java
│ └── ZeroCopyHttpExchange.java
└── translation
├── HttpDownloader.java
├── MSDN_Translate(1).java
├── MSDN_Translate.java
├── MultiLineRowRenderer.java
├── Post(1).java
├── Post.java
├── PropertiesControl(1).java
├── PropertiesControl.java
├── PropertiesControl2.java
├── WordsTransfer.java
├── baidu
├── BaiDuTranslate.java
├── BaiDuTranslateApi.java
└── BaiDuTranslateApiConfig.java
├── utils
├── HttpGet.java
└── MD5.java
└── view
├── JTA.java
├── TAS.form
├── TAS.java
├── TAS1.form
└── TAS1.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | dist/
4 | *~
5 | /src/translation/baidu/BaiDuTranslateApiConfig.java
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction, and
10 | distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright
13 | owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all other entities
16 | that control, are controlled by, or are under common control with that entity.
17 | For the purposes of this definition, "control" means (i) the power, direct or
18 | indirect, to cause the direction or management of such entity, whether by
19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20 | outstanding shares, or (iii) beneficial ownership of such entity.
21 |
22 | "You" (or "Your") shall mean an individual or Legal Entity exercising
23 | permissions granted by this License.
24 |
25 | "Source" form shall mean the preferred form for making modifications, including
26 | but not limited to software source code, documentation source, and configuration
27 | files.
28 |
29 | "Object" form shall mean any form resulting from mechanical transformation or
30 | translation of a Source form, including but not limited to compiled object code,
31 | generated documentation, and conversions to other media types.
32 |
33 | "Work" shall mean the work of authorship, whether in Source or Object form, made
34 | available under the License, as indicated by a copyright notice that is included
35 | in or attached to the work (an example is provided in the Appendix below).
36 |
37 | "Derivative Works" shall mean any work, whether in Source or Object form, that
38 | is based on (or derived from) the Work and for which the editorial revisions,
39 | annotations, elaborations, or other modifications represent, as a whole, an
40 | original work of authorship. For the purposes of this License, Derivative Works
41 | shall not include works that remain separable from, or merely link (or bind by
42 | name) to the interfaces of, the Work and Derivative Works thereof.
43 |
44 | "Contribution" shall mean any work of authorship, including the original version
45 | of the Work and any modifications or additions to that Work or Derivative Works
46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work
47 | by the copyright owner or by an individual or Legal Entity authorized to submit
48 | on behalf of the copyright owner. For the purposes of this definition,
49 | "submitted" means any form of electronic, verbal, or written communication sent
50 | to the Licensor or its representatives, including but not limited to
51 | communication on electronic mailing lists, source code control systems, and
52 | issue tracking systems that are managed by, or on behalf of, the Licensor for
53 | the purpose of discussing and improving the Work, but excluding communication
54 | that is conspicuously marked or otherwise designated in writing by the copyright
55 | owner as "Not a Contribution."
56 |
57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58 | of whom a Contribution has been received by Licensor and subsequently
59 | incorporated within the Work.
60 |
61 | 2. Grant of Copyright License.
62 |
63 | Subject to the terms and conditions of this License, each Contributor hereby
64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65 | irrevocable copyright license to reproduce, prepare Derivative Works of,
66 | publicly display, publicly perform, sublicense, and distribute the Work and such
67 | Derivative Works in Source or Object form.
68 |
69 | 3. Grant of Patent License.
70 |
71 | Subject to the terms and conditions of this License, each Contributor hereby
72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73 | irrevocable (except as stated in this section) patent license to make, have
74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where
75 | such license applies only to those patent claims licensable by such Contributor
76 | that are necessarily infringed by their Contribution(s) alone or by combination
77 | of their Contribution(s) with the Work to which such Contribution(s) was
78 | submitted. If You institute patent litigation against any entity (including a
79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a
80 | Contribution incorporated within the Work constitutes direct or contributory
81 | patent infringement, then any patent licenses granted to You under this License
82 | for that Work shall terminate as of the date such litigation is filed.
83 |
84 | 4. Redistribution.
85 |
86 | You may reproduce and distribute copies of the Work or Derivative Works thereof
87 | in any medium, with or without modifications, and in Source or Object form,
88 | provided that You meet the following conditions:
89 |
90 | You must give any other recipients of the Work or Derivative Works a copy of
91 | this License; and
92 | You must cause any modified files to carry prominent notices stating that You
93 | changed the files; and
94 | You must retain, in the Source form of any Derivative Works that You distribute,
95 | all copyright, patent, trademark, and attribution notices from the Source form
96 | of the Work, excluding those notices that do not pertain to any part of the
97 | Derivative Works; and
98 | If the Work includes a "NOTICE" text file as part of its distribution, then any
99 | Derivative Works that You distribute must include a readable copy of the
100 | attribution notices contained within such NOTICE file, excluding those notices
101 | that do not pertain to any part of the Derivative Works, in at least one of the
102 | following places: within a NOTICE text file distributed as part of the
103 | Derivative Works; within the Source form or documentation, if provided along
104 | with the Derivative Works; or, within a display generated by the Derivative
105 | Works, if and wherever such third-party notices normally appear. The contents of
106 | the NOTICE file are for informational purposes only and do not modify the
107 | License. You may add Your own attribution notices within Derivative Works that
108 | You distribute, alongside or as an addendum to the NOTICE text from the Work,
109 | provided that such additional attribution notices cannot be construed as
110 | modifying the License.
111 | You may add Your own copyright statement to Your modifications and may provide
112 | additional or different license terms and conditions for use, reproduction, or
113 | distribution of Your modifications, or for any such Derivative Works as a whole,
114 | provided Your use, reproduction, and distribution of the Work otherwise complies
115 | with the conditions stated in this License.
116 |
117 | 5. Submission of Contributions.
118 |
119 | Unless You explicitly state otherwise, any Contribution intentionally submitted
120 | for inclusion in the Work by You to the Licensor shall be under the terms and
121 | conditions of this License, without any additional terms or conditions.
122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of
123 | any separate license agreement you may have executed with Licensor regarding
124 | such Contributions.
125 |
126 | 6. Trademarks.
127 |
128 | This License does not grant permission to use the trade names, trademarks,
129 | service marks, or product names of the Licensor, except as required for
130 | reasonable and customary use in describing the origin of the Work and
131 | reproducing the content of the NOTICE file.
132 |
133 | 7. Disclaimer of Warranty.
134 |
135 | Unless required by applicable law or agreed to in writing, Licensor provides the
136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
138 | including, without limitation, any warranties or conditions of TITLE,
139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
140 | solely responsible for determining the appropriateness of using or
141 | redistributing the Work and assume any risks associated with Your exercise of
142 | permissions under this License.
143 |
144 | 8. Limitation of Liability.
145 |
146 | In no event and under no legal theory, whether in tort (including negligence),
147 | contract, or otherwise, unless required by applicable law (such as deliberate
148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be
149 | liable to You for damages, including any direct, indirect, special, incidental,
150 | or consequential damages of any character arising as a result of this License or
151 | out of the use or inability to use the Work (including but not limited to
152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or
153 | any and all other commercial damages or losses), even if such Contributor has
154 | been advised of the possibility of such damages.
155 |
156 | 9. Accepting Warranty or Additional Liability.
157 |
158 | While redistributing the Work or Derivative Works thereof, You may choose to
159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or
160 | other liability obligations and/or rights consistent with this License. However,
161 | in accepting such obligations, You may act only on Your own behalf and on Your
162 | sole responsibility, not on behalf of any other Contributor, and only if You
163 | agree to indemnify, defend, and hold each Contributor harmless for any liability
164 | incurred by, or claims asserted against, such Contributor by reason of your
165 | accepting any such warranty or additional liability.
166 |
167 | END OF TERMS AND CONDITIONS
168 |
169 | APPENDIX: How to apply the Apache License to your work
170 |
171 | To apply the Apache License to your work, attach the following boilerplate
172 | notice, with the fields enclosed by brackets "{}" replaced with your own
173 | identifying information. (Don't include the brackets!) The text should be
174 | enclosed in the appropriate comment syntax for the file format. We also
175 | recommend that a file or class name and description of purpose be included on
176 | the same "printed page" as the copyright notice for easier identification within
177 | third-party archives.
178 |
179 | Copyright 2015 wellchang
180 |
181 | Licensed under the Apache License, Version 2.0 (the "License");
182 | you may not use this file except in compliance with the License.
183 | You may obtain a copy of the License at
184 |
185 | http://www.apache.org/licenses/LICENSE-2.0
186 |
187 | Unless required by applicable law or agreed to in writing, software
188 | distributed under the License is distributed on an "AS IS" BASIS,
189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190 | See the License for the specific language governing permissions and
191 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 1. 工具使用命令:java -jar TranslationAS.jar(新建lib文件夹,并复制相关的库到lib)
2 | 2. 工具说明:该工具直接选择resources_en.jar,点击获取jar包目录,勾选翻译,双击列表会自动翻译成中文,翻译完一个属性文件后点击保存属性值文件,翻译完后,请从新生成的jar包中将相应的属性文件在该库中进行修改。
3 | 3. 工具会自动进行编码转换
4 | 4. 使用netbeans开发
5 | 5. jdk版本: 1.7
6 |
7 | %注意%
8 | 点击比较新旧按钮,选择新旧(任意已汉化的)resources_en.jar文件,点击比较会将新的进行翻译并生成一个新的文件
9 |
10 | 由于百度翻译API限制ip,请自行申请,并在[BaiDuTranslateApiConfig.java](https://github.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/blob/master/src/translation/baidu/BaiDuTranslateApiConfig.java "BaiDuTranslateApiConfig.java")进行配置.
11 |
12 |
13 | # windows安装文件链接(win10 x64测试,由于上传大小限制,只能放在百度网盘): https://pan.baidu.com/s/1EaRbIbRw2Dh36eS58MxpUA 提取码: cjhf
14 |
15 | # 对新的语言包进行汉化看这里https://github.com/AndroidStudioTranslate/Android-Studio-Translate-Tool-Replace
16 |
17 | # Python版看这里https://github.com/AndroidStudioTranslate/Android-Studio-Translate-Tool-Python
18 |
--------------------------------------------------------------------------------
/TranslationAS.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/TranslationAS.jar
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project TranslationAS.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/build/built-jar.properties:
--------------------------------------------------------------------------------
1 | #Wed, 25 Nov 2015 10:28:23 +0800
2 |
3 |
4 | /home/swtf/learnning/TranslationAS=
5 |
--------------------------------------------------------------------------------
/libs/commons-codec-1.9.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/commons-codec-1.9.jar
--------------------------------------------------------------------------------
/libs/commons-httpclient-3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/commons-httpclient-3.1.jar
--------------------------------------------------------------------------------
/libs/commons-io-2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/commons-io-2.4.jar
--------------------------------------------------------------------------------
/libs/commons-logging-1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/commons-logging-1.2.jar
--------------------------------------------------------------------------------
/libs/httpasyncclient-4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/httpasyncclient-4.1.jar
--------------------------------------------------------------------------------
/libs/httpasyncclient-cache-4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/httpasyncclient-cache-4.1.jar
--------------------------------------------------------------------------------
/libs/httpclient-4.4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/httpclient-4.4.1.jar
--------------------------------------------------------------------------------
/libs/httpclient-cache-4.4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/httpclient-cache-4.4.1.jar
--------------------------------------------------------------------------------
/libs/httpcore-4.4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/httpcore-4.4.1.jar
--------------------------------------------------------------------------------
/libs/httpcore-nio-4.4.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/httpcore-nio-4.4.1.jar
--------------------------------------------------------------------------------
/libs/httpmime-4.1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/httpmime-4.1.2.jar
--------------------------------------------------------------------------------
/libs/json_simple-1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/json_simple-1.1.jar
--------------------------------------------------------------------------------
/libs/jsoup-1.8.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/jsoup-1.8.3.jar
--------------------------------------------------------------------------------
/libs/log4j-1.2.17.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/log4j-1.2.17.jar
--------------------------------------------------------------------------------
/libs/microsoft-translator-java-api-0.6.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/microsoft-translator-java-api-0.6.2.jar
--------------------------------------------------------------------------------
/libs/mysql-connector-java-5.1.22-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/libs/mysql-connector-java-5.1.22-bin.jar
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=8272b576
2 | build.xml.script.CRC32=4f05a8cb
3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=8272b576
7 | nbproject/build-impl.xml.script.CRC32=bbbfecff
8 | nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48
9 |
--------------------------------------------------------------------------------
/nbproject/private/config.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AndroidStudioTranslate/Android-Studio-Translate-Tool/e96eaaa807af78fb6631facc55c1e41ac629e300/nbproject/private/config.properties
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=false
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\swtf\\AppData\\Roaming\\NetBeans\\8.1\\build.properties
7 |
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processors.list=
4 | annotation.processing.run.all.processors=true
5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6 | application.title=TranslationAS
7 | application.vendor=swtf
8 | auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
9 | build.classes.dir=${build.dir}/classes
10 | build.classes.excludes=**/*.java,**/*.form
11 | # This directory is removed when the project is cleaned:
12 | build.dir=build
13 | build.generated.dir=${build.dir}/generated
14 | build.generated.sources.dir=${build.dir}/generated-sources
15 | # Only compile against the classpath explicitly listed here:
16 | build.sysclasspath=ignore
17 | build.test.classes.dir=${build.dir}/test/classes
18 | build.test.results.dir=${build.dir}/test/results
19 | # Uncomment to specify the preferred debugger connection transport:
20 | #debug.transport=dt_socket
21 | debug.classpath=\
22 | ${run.classpath}
23 | debug.test.classpath=\
24 | ${run.test.classpath}
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/TranslationAS.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | endorsed.classpath=
30 | excludes=
31 | file.reference.commons-codec-1.9.jar=libs/commons-codec-1.9.jar
32 | file.reference.commons-httpclient-3.1.jar=libs/commons-httpclient-3.1.jar
33 | file.reference.commons-io-2.4.jar=libs/commons-io-2.4.jar
34 | file.reference.commons-logging-1.2.jar=libs/commons-logging-1.2.jar
35 | file.reference.httpasyncclient-4.1.jar=libs/httpasyncclient-4.1.jar
36 | file.reference.httpasyncclient-cache-4.1.jar=libs/httpasyncclient-cache-4.1.jar
37 | file.reference.httpclient-4.4.1.jar=libs/httpclient-4.4.1.jar
38 | file.reference.httpclient-cache-4.4.1.jar=libs/httpclient-cache-4.4.1.jar
39 | file.reference.httpcore-4.4.1.jar=libs/httpcore-4.4.1.jar
40 | file.reference.httpcore-nio-4.4.1.jar=libs/httpcore-nio-4.4.1.jar
41 | file.reference.httpmime-4.1.2.jar=libs/httpmime-4.1.2.jar
42 | file.reference.json_simple-1.1.jar=libs/json_simple-1.1.jar
43 | file.reference.jsoup-1.8.3.jar=libs/jsoup-1.8.3.jar
44 | file.reference.log4j-1.2.17.jar=libs/log4j-1.2.17.jar
45 | file.reference.microsoft-translator-java-api-0.6.2.jar=libs/microsoft-translator-java-api-0.6.2.jar
46 | file.reference.mysql-connector-java-5.1.22-bin.jar=libs/mysql-connector-java-5.1.22-bin.jar
47 | includes=**
48 | jar.archive.disabled=${jnlp.enabled}
49 | jar.compress=true
50 | jar.index=${jnlp.enabled}
51 | javac.classpath=\
52 | ${file.reference.commons-codec-1.9.jar}:\
53 | ${file.reference.commons-httpclient-3.1.jar}:\
54 | ${file.reference.commons-io-2.4.jar}:\
55 | ${file.reference.commons-logging-1.2.jar}:\
56 | ${file.reference.httpasyncclient-4.1.jar}:\
57 | ${file.reference.httpasyncclient-cache-4.1.jar}:\
58 | ${file.reference.httpclient-4.4.1.jar}:\
59 | ${file.reference.httpclient-cache-4.4.1.jar}:\
60 | ${file.reference.httpcore-4.4.1.jar}:\
61 | ${file.reference.httpcore-nio-4.4.1.jar}:\
62 | ${file.reference.httpmime-4.1.2.jar}:\
63 | ${file.reference.json_simple-1.1.jar}:\
64 | ${file.reference.jsoup-1.8.3.jar}:\
65 | ${file.reference.microsoft-translator-java-api-0.6.2.jar}:\
66 | ${file.reference.mysql-connector-java-5.1.22-bin.jar}:\
67 | ${file.reference.log4j-1.2.17.jar}
68 | # Space-separated list of extra javac options
69 | javac.compilerargs=
70 | javac.deprecation=false
71 | javac.processorpath=\
72 | ${javac.classpath}
73 | javac.source=1.7
74 | javac.target=1.7
75 | javac.test.classpath=\
76 | ${javac.classpath}:\
77 | ${build.classes.dir}
78 | javac.test.processorpath=\
79 | ${javac.test.classpath}
80 | javadoc.additionalparam=
81 | javadoc.author=true
82 | javadoc.encoding=${source.encoding}
83 | javadoc.noindex=false
84 | javadoc.nonavbar=false
85 | javadoc.notree=false
86 | javadoc.private=false
87 | javadoc.splitindex=true
88 | javadoc.use=true
89 | javadoc.version=true
90 | javadoc.windowtitle=
91 | jnlp.codebase.type=no.codebase
92 | jnlp.descriptor=application
93 | jnlp.enabled=false
94 | jnlp.mixed.code=default
95 | jnlp.offline-allowed=false
96 | jnlp.signed=false
97 | jnlp.signing=
98 | jnlp.signing.alias=
99 | jnlp.signing.keystore=
100 | main.class=translation.view.TAS
101 | # \u53ef\u4ee5\u9009\u62e9\u8986\u76d6\u9ed8\u8ba4\u7684\u4ee3\u7801\u5e93\u6e05\u5355\u5c5e\u6027, \u7528\u4e8e\u9632\u6b62 RIA \u88ab\u7528\u4f5c\u5176\u4ed6\u7528\u9014
102 | manifest.custom.codebase=
103 | # \u53ef\u4ee5\u9009\u62e9\u8986\u76d6\u9ed8\u8ba4\u7684\u6743\u9650\u6e05\u5355\u5c5e\u6027 (\u652f\u6301\u7684\u503c: sandbox, all-permissions)
104 | manifest.custom.permissions=
105 | manifest.file=manifest.mf
106 | meta.inf.dir=${src.dir}/META-INF
107 | mkdist.disabled=true
108 | native.bundling.enabled=true
109 | platform.active=JDK_1.7
110 | run.classpath=\
111 | ${javac.classpath}:\
112 | ${build.classes.dir}
113 | # Space-separated list of JVM arguments used when running the project
114 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
115 | # or test-sys-prop.name=value to set system properties for unit tests):
116 | run.jvmargs=
117 | run.test.classpath=\
118 | ${javac.test.classpath}:\
119 | ${build.test.classes.dir}
120 | source.encoding=UTF-8
121 | src.dir=src
122 | test.src.dir=test
123 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 |
7 |
8 |
9 | TranslationAS
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/test/AsyncClientCustomContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package test;
7 |
8 | /*
9 | * ====================================================================
10 | * Licensed to the Apache Software Foundation (ASF) under one
11 | * or more contributor license agreements. See the NOTICE file
12 | * distributed with this work for additional information
13 | * regarding copyright ownership. The ASF licenses this file
14 | * to you under the Apache License, Version 2.0 (the
15 | * "License"); you may not use this file except in compliance
16 | * with the License. You may obtain a copy of the License at
17 | *
18 | * http://www.apache.org/licenses/LICENSE-2.0
19 | *
20 | * Unless required by applicable law or agreed to in writing,
21 | * software distributed under the License is distributed on an
22 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23 | * KIND, either express or implied. See the License for the
24 | * specific language governing permissions and limitations
25 | * under the License.
26 | * ====================================================================
27 | *
28 | * This software consists of voluntary contributions made by many
29 | * individuals on behalf of the Apache Software Foundation. For more
30 | * information on the Apache Software Foundation, please see
31 | * .
32 | *
33 | */
34 | import org.apache.http.HttpResponse;
35 | import org.apache.http.client.CookieStore;
36 | import org.apache.http.client.methods.HttpGet;
37 | import org.apache.http.client.protocol.HttpClientContext;
38 | import org.apache.http.cookie.Cookie;
39 | import org.apache.http.impl.client.BasicCookieStore;
40 | import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
41 | import org.apache.http.impl.nio.client.HttpAsyncClients;
42 |
43 | import java.util.List;
44 | import java.util.concurrent.Future;
45 | import org.apache.http.HttpEntity;
46 | import org.apache.http.util.EntityUtils;
47 |
48 | /**
49 | * This example demonstrates the use of a local HTTP context populated with
50 | * custom attributes.
51 | */
52 | public class AsyncClientCustomContext {
53 |
54 | public final static void main(String[] args) throws Exception {
55 | CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
56 | HttpEntity entity = null;
57 | String jsonContent = "";
58 | try {
59 | // Create a local instance of cookie store
60 | CookieStore cookieStore = new BasicCookieStore();
61 |
62 | // Create local HTTP context
63 | HttpClientContext localContext = HttpClientContext.create();
64 | // Bind custom cookie store to the local context
65 | localContext.setCookieStore(cookieStore);
66 |
67 | HttpGet httpget = new HttpGet("http://viphp.sinaapp.com/baidu/translate/translate.php?origin=中文");
68 | System.out.println("Executing request " + httpget.getRequestLine());
69 |
70 | httpclient.start();
71 |
72 | // Pass local context as a parameter
73 | Future future = httpclient.execute(httpget, localContext, null);
74 |
75 | // Please note that it may be unsafe to access HttpContext instance
76 | // while the request is still being executed
77 | HttpResponse response = future.get();
78 | System.out.println("Response: " + response.getStatusLine());
79 | entity = response.getEntity();
80 | jsonContent = EntityUtils.toString(entity, "UTF-8");
81 | System.out.println("jsonContent:" + jsonContent);
82 | List cookies = cookieStore.getCookies();
83 | for (int i = 0; i < cookies.size(); i++) {
84 | System.out.println("Local cookie: " + cookies.get(i));
85 | }
86 | System.out.println("Shutting down");
87 | } finally {
88 | httpclient.close();
89 | }
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/src/test/DBManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package test;
7 |
8 | import java.sql.Connection;
9 | import java.sql.DriverManager;
10 | import java.sql.ResultSet;
11 | import java.sql.SQLException;
12 | import java.sql.Statement;
13 | import java.util.logging.Level;
14 | import org.apache.log4j.Logger;
15 |
16 | /**
17 | *
18 | * @author swtf
19 | */
20 | public class DBManager {
21 |
22 | String URL = "jdbc:mysql://localhost:3306/test";
23 | String Username = "root";
24 | String Password = "1234";
25 | String Driver = "com.mysql.jdbc.Driver";
26 |
27 | public DBManager() {
28 | try {
29 | Class.forName(Driver).newInstance();
30 | } catch (Exception e) {
31 | e.printStackTrace();
32 | }
33 | }
34 |
35 | public Connection getConnection() {
36 | Connection connection = null;
37 | try {
38 | connection = DriverManager.getConnection(URL, Username, Password);
39 | } catch (Exception e) {
40 | e.printStackTrace();
41 | }
42 | return connection;
43 | }
44 |
45 | public Statement getStatement() {
46 | Connection connection = null;
47 | Statement stmt = null;
48 | try {
49 | connection = getConnection();
50 | stmt = connection.createStatement();
51 | return stmt;
52 | } catch (Exception e) {
53 | e.printStackTrace();
54 | return null;
55 | }
56 | }
57 |
58 | public ResultSet getResultSet(String sql, boolean isQuery) {
59 | ResultSet rs = null;
60 | Statement stmt = null;
61 | stmt = getStatement();
62 | try {
63 | if (isQuery) {
64 | rs = stmt.executeQuery(sql);
65 | } else {
66 | stmt.executeUpdate(sql);
67 | }
68 | } catch (SQLException ex) {
69 | System.err.println(ex.getMessage());
70 | }
71 | return rs;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/test/Escape.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package test;
7 |
8 | /**
9 | * * JavaScript escape/unescape 编码的 Java 实现
10 | *
11 | * * author jackyz
12 | *
13 | * * keep this copyright info while using this method by free
14 | *
15 | */
16 |
17 | public class Escape {
18 |
19 | private final static String[] hex = {
20 |
21 | "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F",
22 |
23 | "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F",
24 |
25 | "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F",
26 |
27 | "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F",
28 |
29 | "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F",
30 |
31 | "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F",
32 |
33 | "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F",
34 |
35 | "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F",
36 |
37 | "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F",
38 |
39 | "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F",
40 |
41 | "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF",
42 | "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF",
43 | "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF",
44 | "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF",
45 | "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF",
46 | "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF"
47 | };
48 |
49 | private final static byte[] val = {0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
50 |
51 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
52 |
53 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
54 |
55 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
56 |
57 | 0x3F, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
58 |
59 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
60 |
61 | 0x3F, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
62 |
63 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
64 |
65 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
66 |
67 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
68 |
69 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
70 |
71 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
72 |
73 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
74 |
75 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
76 |
77 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
78 |
79 | 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F
80 |
81 | };
82 |
83 | public static String escape(String s) {
84 |
85 | StringBuffer sbuf = new StringBuffer();
86 |
87 | int len = s.length();
88 |
89 | for (int i = 0; i < len; i++) {
90 |
91 | int ch = s.charAt(i);
92 |
93 | if (ch == ' ') { // space : map to '+'
94 |
95 | sbuf.append('+');
96 |
97 | } else if ('A' <= ch && ch <= 'Z') { // 'A'..'Z' : as it was
98 |
99 | sbuf.append((char) ch);
100 |
101 | } else if ('a' <= ch && ch <= 'z') { // 'a'..'z' : as it was
102 |
103 | sbuf.append((char) ch);
104 |
105 | } else if ('0' <= ch && ch <= '9') { // '0'..'9' : as it was
106 |
107 | sbuf.append((char) ch);
108 |
109 | } else if (ch == '-' || ch == '_' // unreserved : as it was
110 |
111 | || ch == '.' || ch == '!'
112 |
113 | || ch == '~' || ch == '*'
114 |
115 | || ch == '/' || ch == '('
116 |
117 | || ch == ')') {
118 |
119 | sbuf.append((char) ch);
120 |
121 | } else if (ch <= 0x007F) { // other ASCII : map to %XX
122 |
123 | sbuf.append('%');
124 |
125 | sbuf.append(hex[ch]);
126 |
127 | } else { // unicode : map to %uXXXX
128 |
129 | sbuf.append('%');
130 |
131 | sbuf.append('u');
132 |
133 | sbuf.append(hex[(ch >>> 8)]);
134 |
135 | sbuf.append(hex[(0x00FF & ch)]);
136 |
137 | }
138 |
139 | }
140 |
141 | return sbuf.toString();
142 |
143 | }
144 |
145 | public static String unescape(String s) {
146 |
147 | StringBuffer sbuf = new StringBuffer();
148 |
149 | int i = 0;
150 |
151 | int len = s.length();
152 |
153 | while (i < len) {
154 |
155 | int ch = s.charAt(i);
156 |
157 | if (ch == '+') { // + : map to ' '
158 |
159 | sbuf.append(' ');
160 |
161 | } else if ('A' <= ch && ch <= 'Z') { // 'A'..'Z' : as it was
162 |
163 | sbuf.append((char) ch);
164 |
165 | } else if ('a' <= ch && ch <= 'z') { // 'a'..'z' : as it was
166 |
167 | sbuf.append((char) ch);
168 |
169 | } else if ('0' <= ch && ch <= '9') { // '0'..'9' : as it was
170 |
171 | sbuf.append((char) ch);
172 |
173 | } else if (ch == '-' || ch == '_' // unreserved : as it was
174 |
175 | || ch == '.' || ch == '!'
176 |
177 | || ch == '~' || ch == '*'
178 |
179 | || ch == '/' || ch == '('
180 |
181 | || ch == ')') {
182 |
183 | sbuf.append((char) ch);
184 |
185 | } else if (ch == '%') {
186 |
187 | int cint = 0;
188 |
189 | if ('u' != s.charAt(i + 1)) { // %XX : map to ascii(XX)
190 |
191 | cint = (cint << 4) | val[s.charAt(i + 1)];
192 |
193 | cint = (cint << 4) | val[s.charAt(i + 2)];
194 |
195 | i += 2;
196 |
197 | } else { // %uXXXX : map to unicode(XXXX)
198 |
199 | cint = (cint << 4) | val[s.charAt(i + 2)];
200 |
201 | cint = (cint << 4) | val[s.charAt(i + 3)];
202 |
203 | cint = (cint << 4) | val[s.charAt(i + 4)];
204 |
205 | cint = (cint << 4) | val[s.charAt(i + 5)];
206 |
207 | i += 5;
208 |
209 | }
210 |
211 | sbuf.append((char) cint);
212 |
213 | }
214 |
215 | i++;
216 |
217 | }
218 |
219 | return sbuf.toString();
220 |
221 | }
222 |
223 | // public static void main(String[] args) {
224 | //
225 | // String stest = "黄修群1234 abcd[]()<+>,.~//";
226 | //
227 | // System.out.println(stest);
228 | //
229 | // System.out.println(escape(stest));
230 | //
231 | // System.out.println(unescape(escape(stest)));
232 | //
233 | // }
234 |
235 | }
236 |
--------------------------------------------------------------------------------
/src/test/Google.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package test;
6 |
7 | import java.util.HashMap;
8 | import java.util.Map;
9 | import java.util.logging.Level;
10 | import java.util.logging.Logger;
11 | import translation.Post;
12 |
13 | /**
14 | *
15 | * @author vi
16 | */
17 | public class Google {
18 |
19 | public static void main(String[] args) {
20 | String words = "this is a test!\nthis is a test!\nthis is a test!";
21 | try {
22 | Map map = new HashMap();
23 | map.put("client", "t");
24 | map.put("text", words);
25 | map.put("sl", "en");
26 | map.put("tl", "zh_CN");
27 | String dst=Post.http("http://translate.google.com/translate_a/t", map);
28 | System.out.println(dst);
29 | //System.out.println(TranslateUtil.en2cn(words));
30 | } catch (Exception ex) {
31 | Logger.getLogger(Google.class.getName()).log(Level.SEVERE, null, ex);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/HttpClientUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package test;
6 |
7 | /**
8 | *
9 | * @author vi
10 | */
11 | import java.io.BufferedInputStream;
12 | import java.io.File;
13 | import java.io.FileOutputStream;
14 | import java.io.InputStream;
15 | import java.util.Map;
16 |
17 | import org.apache.commons.io.IOUtils;
18 | import org.apache.commons.logging.Log;
19 | import org.apache.commons.logging.LogFactory;
20 | import org.apache.http.HttpEntity;
21 | import org.apache.http.HttpResponse;
22 | import org.apache.http.client.HttpClient;
23 | import org.apache.http.client.methods.HttpGet;
24 | import org.apache.http.client.methods.HttpPost;
25 | import org.apache.http.client.methods.HttpRequestBase;
26 | import org.apache.http.conn.scheme.PlainSocketFactory;
27 | import org.apache.http.conn.scheme.Scheme;
28 | import org.apache.http.conn.scheme.SchemeRegistry;
29 | import org.apache.http.conn.ssl.SSLSocketFactory;
30 | import org.apache.http.entity.BufferedHttpEntity;
31 | import org.apache.http.impl.client.DefaultHttpClient;
32 | import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
33 | import org.apache.http.params.BasicHttpParams;
34 |
35 | /**
36 | * PostUtil.java
37 | *
38 | * @author catty
39 | * @version 1.0, Created on 2008/2/20
40 | */
41 | public class HttpClientUtil {
42 |
43 | protected static Log log = LogFactory.getLog(HttpClientUtil.class);
44 | protected static HttpClient httpclient = null;
45 | protected static int maxTotal = 200;
46 | protected static int maxPerRoute = 20;
47 | protected static String userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7";
48 |
49 | static {
50 | if (httpclient == null) {
51 | // ~~~~~~~~~~~~~~~~~~~~
52 | // create httpclient
53 | // ~~~~~~~~~~~~~~~~~~~~
54 | SchemeRegistry reg = new SchemeRegistry();
55 | reg.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
56 | reg.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
57 | ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(reg);
58 | cm.setMaxTotal(maxTotal);
59 | cm.setDefaultMaxPerRoute(maxPerRoute);
60 | httpclient = new DefaultHttpClient(cm);
61 | }
62 | }
63 |
64 | /**
65 | *