axis2---5--2
来源:互联网 发布:js 定义json对象 编辑:程序博客网 时间:2024/04/30 02:30
/** * 获得指定文件的byte数组 */public static byte[] getBytes(String filePath) {byte[] buffer = null;try {File file = new File(filePath);FileInputStream fis = new FileInputStream(file);ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);byte[] b = new byte[1000];int n;while ((n = fis.read(b)) != -1) {bos.write(b, 0, n);}fis.close();bos.close();buffer = bos.toByteArray();} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}return buffer;}/** * 根据byte数组,生成文件 */public static void getFile(byte[] bfile, String filePath, String fileName) {BufferedOutputStream bos = null;FileOutputStream fos = null;File file = null;try {File dir = new File(filePath);if (!dir.exists() && dir.isDirectory()) {// 判断文件目录是否存在dir.mkdirs();}file = new File(filePath + "\\" + fileName);fos = new FileOutputStream(file);bos = new BufferedOutputStream(fos);bos.write(bfile);} catch (Exception e) {e.printStackTrace();} finally {if (bos != null) {try {bos.close();} catch (IOException e1) {e1.printStackTrace();}}if (fos != null) {try {fos.close();} catch (IOException e1) {e1.printStackTrace();}}}}public static void main(String[] args) throws CertificateException, FileNotFoundException, IOException,UnrecoverableKeyException {try {SSLContext ssl = SSLContext.getInstance("TLS");KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());KeyStore store = KeyStore.getInstance("JKS");String keystoreFile = "test-server.keystore";String keyPass = "testserver";store.load(new FileInputStream(keystoreFile), keyPass.toCharArray());keyFactory.init(store, keyPass.toCharArray());TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());trustFactory.init(store);KeyManager[] keyManagers = new KeyManager[1];keyManagers = keyFactory.getKeyManagers();TrustManager[] trustManagers = trustFactory.getTrustManagers();ssl.init(keyManagers, trustManagers, new SecureRandom());HttpsConfigurator configurator = new HttpsConfigurator(ssl);HttpsServer httpsServer = HttpsServer.create(new InetSocketAddress("10.50.131.59", 8440), 8440);httpsServer.setHttpsConfigurator(configurator);HttpContext httpContext = httpsServer.createContext("/Hello");httpsServer.start();Endpoint endpoint = Endpoint.create(new HelloWorld());endpoint.publish(httpContext);} catch (NoSuchAlgorithmException e1) {// TODO Auto-generated catch blocke1.printStackTrace();} catch (KeyStoreException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (KeyManagementException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}
0 0
- axis2---5--2
- axis2-----5
- myeclipse8.5安装axis2
- axis2介绍2
- axis2---2 --rpc
- axis2 调用webservice 2
- axis2
- Axis2
- axis2
- Axis2
- axis2
- Axis2
- axis2
- axis2
- Axis2
- Axis2
- Axis2
- Axis2
- ZOJ Problem Set - 1649
- python类知识
- Introduction on Using Hamcrest Unit Test Framework
- axis2-----5
- 第一个项目(五)添加跳跃动作
- axis2---5--2
- ios运用fmdb建SQLite数据库
- 在sed命令中使用外部变量
- 【容斥原理+欧拉函数】 HDOJ 1695 GCD
- Lua string库
- qtwebkit插件
- Java基础视频教程-异常,包
- axis--0000
- kernel 框架