Examples of RestfulHttpResponse


Examples of org.jembi.openhim.RestfulHttpResponse

    AbstractMessageTransformer {

  @Override
  public Object transformMessage(MuleMessage msg, String enc) throws TransformerException {
   
    RestfulHttpResponse restRes = new RestfulHttpResponse();
   
    try {
      int status = Integer.valueOf((String) msg.getProperty("http.status", PropertyScope.INBOUND));
      restRes.setHttpStatus(status);
      String body = msg.getPayloadAsString();
      restRes.setBody(body);
      String uuid = msg.getProperty("uuid", PropertyScope.SESSION);
      restRes.setUuid(uuid);
      restRes.setHttpHeaders((Map<String, Object>) msg.getProperty("http.headers", PropertyScope.INBOUND));
    } catch (Exception e) {
      throw new TransformerException(this, e);
    }
   
    return restRes;
View Full Code Here

Examples of org.jembi.openhim.RestfulHttpResponse

      });

  @Override
  public Object transformMessage(MuleMessage msg, String enc) throws TransformerException {
   
    RestfulHttpResponse restRes = (RestfulHttpResponse) msg.getPayload();
   
    msg.setOutboundProperty("http.status", restRes.getHttpStatus());
    msg.setPayload(restRes.getBody());
   
    for (String header : restRes.getHttpHeaders().keySet()) {
      if (!httpHeaderBlackList.contains(header)) {
        msg.setProperty(header, restRes.getHttpHeaders().get(header), PropertyScope.OUTBOUND);
      }
    }
   
    return msg;
View Full Code Here

Examples of org.jembi.openhim.RestfulHttpResponse

  private void excecuteTestCase(String httpStatus, String body, String uuid, Map<String, String> httpHeaders)
      throws Exception, TransformerException {
    setupMocks(httpStatus, body, uuid, httpHeaders);
    HttpResponseToRestfulHttpResponseTransformer trans = new HttpResponseToRestfulHttpResponseTransformer();
    RestfulHttpResponse res = (RestfulHttpResponse) trans.transformMessage(msg, "UTF-8");
    assertEquals(Integer.parseInt(httpStatus), res.getHttpStatus());
    assertEquals(body, res.getBody());
    assertEquals(uuid, res.getUuid());
    assertEquals(httpHeaders, res.getHttpHeaders());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.