小编Kmr*_*Gtm的帖子

weblogic.net.http.SOAPHttpsURLConnection无法强制转换为javax.net.ssl.HttpsURLConnection

尝试使用javax.net.ssl.HttpsURLConnection连接到URL时,我得到"java.lang.ClassCastException".

我使用的是Weblogic Server 10.3.4.

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;



import java.security.cert.X509Certificate;


import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.net.HttpURLConnection;
import java.net.URL;

/**
 * @author kmrgtm
 *
 */
public class GatewayConnect {


public void ConnectURL()
{
    try
    {

        System.out.println("***** Inside Class File *****");
    // Create a trust manager that does not validate certificate chains
    TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
            public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                return null;
            }
            public void checkClientTrusted(X509Certificate[] certs, String authType) { …
Run Code Online (Sandbox Code Playgroud)

java ssl weblogic httpsurlconnection

13
推荐指数
2
解决办法
3万
查看次数

Apache Camel xmljson中的自定义JSON输出

骆驼路线:

<camelContext xmlns="http://camel.apache.org/schema/spring">

   <dataFormats>
    <xmljson id="xmljson" />
   </dataFormats>

    <route id="route1">
        <from uri="file:C:/Users/User1/InputXML"/>
        <to uri="activemq:queue:MyThread1"/>        
    </route>

    <route id="route2">
        <from uri="activemq:queue:MyThread1"/>    
        <marshal ref="xmljson"/> 
        <bean ref="com.test.OutputProcessor"/>
    </route> 
</camelContext>
Run Code Online (Sandbox Code Playgroud)

输入XML:

<?xml version="1.0" encoding="UTF-8"?>
<Message>
  <to> Tove</to>
 <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</Message>
Run Code Online (Sandbox Code Playgroud)

实际产量:

{"to":" Tove","from":"Jani","heading":"Reminder","body":"Don't forget me this weekend!"}
Run Code Online (Sandbox Code Playgroud)

我想自定义此输出.我想为转换后的json添加一些mote属性.例如,我希望输出json为

  {
    "inputs":[  
                { 
            "inputname":"to",
            "inputValue":"Tove"
            },
            { 
            "inputname":"from",
            "inputValue":"jani"
            },
            { 
            "inputname":"heading",
            "inputValue":"Reminder"
            },
            { 
            "inputname":"body",
            "inputValue":"Don't forget me this weekend!"
            }
        ]
    }
Run Code Online (Sandbox Code Playgroud)

如何实现这一目标?

xml json apache-camel xml-parsing

9
推荐指数
1
解决办法
1272
查看次数