|
@ -6,7 +6,6 @@ import com.yihu.hos.core.datatype.StringUtil;
|
|
|
import com.yihu.hos.core.http.HTTPResponse;
|
|
|
import com.yihu.hos.core.http.HttpClientKit;
|
|
|
import org.apache.camel.Exchange;
|
|
|
import org.apache.camel.Message;
|
|
|
import org.apache.camel.Processor;
|
|
|
|
|
|
import java.io.IOException;
|
|
@ -24,9 +23,7 @@ public class GatewayProcessor implements Processor {
|
|
|
static final String agUrl = "http://192.168.1.221:10000";
|
|
|
|
|
|
public void process(Exchange exchange) throws Exception {
|
|
|
Message inMessage = exchange.getIn();
|
|
|
Map<String, Object> headers = exchange.getIn().getHeaders();
|
|
|
// exchange.setOut(inMessage);
|
|
|
exchange.getOut().setHeader("api", headers.get("api"));
|
|
|
exchange.getOut().setHeader("param", headers.get("param"));
|
|
|
exchange.getOut().setHeader("timestamp", headers.get("timestamp"));
|
|
@ -40,6 +37,9 @@ public class GatewayProcessor implements Processor {
|
|
|
public String route(Exchange exchange) throws IOException, ParseException {
|
|
|
// body = URLDecoder.decode(body, "UTF-8");
|
|
|
Map<String, Object> params = exchange.getIn().getHeaders();
|
|
|
if (params.get("appKey")==null) {
|
|
|
return "jetty:http://0.0.0.0:9999/error/paramError"; //TODO:
|
|
|
}
|
|
|
String appKey = params.get("appKey").toString();
|
|
|
String secret = getSecret(appKey);
|
|
|
|