Examples of JSONMessage


Examples of com.almende.eve.rpc.jsonrpc.JSONMessage

   * @throws IOException
   *             Signals that an I/O exception has occurred.
   */
  private JSONResponse receive(final Object arg) throws JSONRPCException,
      IOException {
    final JSONMessage jsonMsg = Agent.jsonConvert(arg);
    if (jsonMsg instanceof JSONResponse) {
      return (JSONResponse) jsonMsg;
    }
    return null;
  }
View Full Code Here

Examples of com.almende.eve.rpc.jsonrpc.JSONMessage

   * @throws IOException
   *             Signals that an I/O exception has occurred.
   */
  private JSONResponse receive(final Object arg) throws JSONRPCException,
      IOException {
    final JSONMessage jsonMsg = Agent.jsonConvert(arg);
    if (jsonMsg instanceof JSONResponse) {
      return (JSONResponse) jsonMsg;
    }
    return null;
  }
View Full Code Here

Examples of com.almende.eve.rpc.jsonrpc.JSONMessage

   * @param msg
   *            the msg
   * @return JSONMessage
   */
  public static JSONMessage jsonConvert(final Object msg) {
    JSONMessage jsonMsg = null;
    try {
      if (msg instanceof JSONMessage) {
        jsonMsg = (JSONMessage) msg;
      } else {
        ObjectNode json = null;
View Full Code Here

Examples of com.almende.eve.rpc.jsonrpc.JSONMessage

   */
  @Override
  public void receive(final Object msg, final URI senderUrl, final String tag) {
    JsonNode id = null;
    try {
      final JSONMessage jsonMsg = jsonConvert(msg);
      if (jsonMsg != null) {
        if (jsonMsg.getId() != null) {
          id = jsonMsg.getId();
        }
        if (jsonMsg instanceof JSONRequest) {
          final RequestParams params = new RequestParams();
          params.put(Sender.class, senderUrl.toASCIIString());
         
View Full Code Here

Examples of com.almende.eve.rpc.jsonrpc.JSONMessage

   * @param msg
   *            the msg
   * @return JSONMessage
   */
  public static JSONMessage jsonConvert(final Object msg) {
    JSONMessage jsonMsg = null;
    try {
      if (msg instanceof JSONMessage) {
        jsonMsg = (JSONMessage) msg;
      } else {
        ObjectNode json = null;
View Full Code Here

Examples of com.almende.eve.rpc.jsonrpc.JSONMessage

   */
  @Override
  public void receive(final Object msg, final URI senderUrl, final String tag) {
    JsonNode id = null;
    try {
      final JSONMessage jsonMsg = jsonConvert(msg);
      if (jsonMsg != null) {
        if (jsonMsg.getId() != null) {
          id = jsonMsg.getId();
        }
        if (jsonMsg instanceof JSONRequest) {
          final RequestParams params = new RequestParams();
          params.put(Sender.class, senderUrl.toASCIIString());
         
View Full Code Here

Examples of com.almende.eve.transform.rpc.formats.JSONMessage

   * @param msg
   *            the msg
   * @return the JSON message
   */
  public static JSONMessage jsonConvert(final Object msg) {
    JSONMessage jsonMsg = null;
    if (msg == null) {
      LOG.warning("Message null!");
      return null;
    }
    try {
View Full Code Here

Examples of com.almende.eve.transform.rpc.formats.JSONMessage

   * @param senderUrl
   *            the sender url
   * @return the JSON response
   */
  public JSONResponse invoke(final Object msg, final URI senderUrl) {
    final JSONMessage jsonMsg = jsonConvert(msg);
    if (jsonMsg == null) {
      LOG.log(Level.WARNING, "Received non-JSONRPC message:'" + msg + "'");
      return null;
    }
    final JsonNode id = jsonMsg.getId();
    try {
      if (jsonMsg.isRequest()) {
        final JSONRequest request = (JSONRequest) jsonMsg;
        final RequestParams params = new RequestParams();
        params.put(Sender.class, senderUrl.toASCIIString());
        return JSONRPC.invoke(destination.get(), request, params, auth);
      } else if (jsonMsg.isResponse() && callbacks != null && id != null
          && !id.isNull()) {
        final AsyncCallback<JSONResponse> callback = callbacks.pull(id);
        if (callback != null) {
          final JSONResponse response = (JSONResponse) jsonMsg;
          final JSONRPCException error = response.getError();
View Full Code Here

Examples of com.jaxws.json.JSONMessage

           * We can't find it in global type once user extend simple type and use it as method parameter.
           * E.g String255 extended from String
           */
          parameterType = parameterTypes[part.getValue().getIndex()];
        if(!operationParameters.containsKey(part.getKey())){
          return new JSONMessage(null, operation, operationParameters, jsonPopulator);
                //throw new RuntimeException(String.format("Request parameter %s can't be null. B.P 1.1 vilation", part.getKey()));
              }
       
        Object val = null;
              if(!WSJSONPopulator.isJSONPrimitive(parameterType)){
                val = jsonPopulator.populateObject(jsonPopulator.getNewInstance(parameterType),
                    (Map<String,Object>)operationParameters.get(part.getKey()),jsonwebService,
                    (List<MIMEPart>) invocationProperties.get(JSONCodec.MIME_ATTACHMENTS));
              } else {
                val  = jsonPopulator.convert(parameterType, null, operationParameters.get(part.getKey()),
                    seiMethod != null ? seiMethod.getAnnotation(JSONWebService.class) : null, null);
              }
              parameterObjects[part.getValue().getIndex()] = val;
      }
     
      // TODO find better way with out using JavaMethodImpl
      List<ParameterImpl> requestParameters = ((JavaMethodImpl)javaMethod).getRequestParameters();
      List<ParameterImpl> responseParameters = ((JavaMethodImpl)javaMethod).getResponseParameters();
      invocationProperties.put(JSONEncoder.RESPONSEPARAMETERS, responseParameters);
     
      if(operation instanceof WSDLBoundOperationImpl && ((WSDLBoundOperationImpl)operation).getOutputMimeTypes().size() > 0){
        // Use only one in case of multipart use attachment
        String mimeType = String.valueOf(((WSDLBoundOperationImpl)operation).getOutputMimeTypes().values().toArray()[0]);
        for (Encoder handler : ServiceFinder.find(Encoder.class)) {
          if(mimeType.equals(handler.mimeContent())){
            invocationProperties.put(JSONCodec.ENCODER, handler);
            break;
          }
        }
      }
      if(requestParameters != null && requestParameters.size() == 1){
        ParameterImpl parameter = requestParameters.get(0);
        if(parameter.isWrapperStyle()){
          // RPC literal
          List<ParameterImpl> childParameters = ((WrapperParameter)parameter).getWrapperChildren();
          if(parameterObjects.length != childParameters.size())
            throw new RuntimeException("Invalid count of parameters");
          Object  obj  = null;
          if(style == Style.RPC){
            CompositeStructure cs = new CompositeStructure();
            cs.values  = parameterObjects;
            cs.bridges  = new Bridge[childParameters.size()];
            for(ParameterImpl parameterChild : childParameters){
              cs.bridges[parameterChild.getIndex()] = parameterChild.getBridge();
            }
            obj  = cs;
          }else{
            Class<?> type = (Class<?>)parameter.getBridge().getTypeReference().type;
            obj   = jsonPopulator.getNewInstance(type);
            for(ParameterImpl parameterChild : childParameters){
              type.getField(parameterChild.getPartName()).set(obj,
                  parameterObjects[parameterChild.getIndex()]);
            }
          }
          return JAXBMessage.create(parameter.getBridge(), obj, this.codec.soapVersion);
        }else{
          // BARE
          return new JSONMessage(null, operation, operationParameters,jsonPopulator);
        }
      }else{
        return new JSONMessage(null, operation, operationParameters,jsonPopulator);
      }
    }else{
      Message message = packet.getMessage();
      if(message == null){
        throw new RuntimeException("Null response message");
View Full Code Here

Examples of model.JsonMessage

  private static transient final Logger log = LoggerFactory.getLogger(AController.class);

  @RequestMapping(value = "b")
  @ResponseBody
  public Object findMbr(HttpServletRequest request) {
    JsonMessage jm = new JsonMessage();
    AOV aov = new AOV("这个事名字");
    jm.setCode("333");
    jm.setData(aov);
    jm.setMessage("message");
    jm.setSuccess("successs");
    return jm;
  }
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.