Package ru.yandex.strictweb.ajaxtools.representation

Examples of ru.yandex.strictweb.ajaxtools.representation.ParseException


    if(arguments==null) throw new MethodNotArgumentized(method);
   
    Class<?>[] parameterTypes = method.getParameterTypes();
   
    int nParams = parameterTypes.length;
    if(rep.lexer.yylex() != Yytoken.TYPE_LEFT_SQUARE) throw new ParseException("Method "+method.getName()+" args["+nParams+"] expected");
   
    if(nParams == 0) {
          if(rep.lexer.yylex() != Yytoken.TYPE_RIGHT_SQUARE) throw new ParseException("Method "+method.getName()+" empty args[] expected");
        return null;
    }
   
    Type[] genericParameterTypes = method.getGenericParameterTypes();
   
    Object[] params = new Object[nParams];
       
    for(int i = 0; i < nParams; i++) {
       
      Class<?> clazz = parameterTypes[i];
      Type type = genericParameterTypes[i];
         
        if(clazz.isAssignableFrom(HttpServletRequest.class)) {
          if(rep.lexer.yylex() != Yytoken.TYPE_VALUE || rep.lexer.value != null) throw new ParseException("HttpServlet should be null");
            params[i] =  request;
        } else {
          params[i] = rep.getObject(clazz, type);
        }
       
        rep.lexer.yylex();
       
            if(i == nParams-1 && rep.lexer.type == Yytoken.TYPE_RIGHT_SQUARE) break;
      if(rep.lexer.type != Yytoken.TYPE_COMMA) throw new ParseException("no , or ] in method params");         
    }
   
        if(rep.lexer.type != Yytoken.TYPE_RIGHT_SQUARE) throw new ParseException("Method "+method.getName()+": bad args");

    return params;
  }
View Full Code Here


        }
      };
     
      JsonRePresentation rep = new JsonRePresentation(ef).reset(input);
     
      if(rep.lexer.yylex() != Yytoken.TYPE_LEFT_SQUARE) throw new ParseException("request args should be passed as array");
     
      for(int i=0;;i++) {
          AjaxRequestResult result = new AjaxRequestResult();
                   
          try {       
                String beanName = getStringFromJsonArray("Bean name expected", rep);
                if(beanName==null) break;
               
                String methodName = getStringFromJsonArray("Method name expected", rep);
                if(methodName==null) break;
               
                rep.lexer.yylex();
                  if(rep.lexer.type != Yytoken.TYPE_COMMA) {
                      throw new ParseException("Method " + methodName + " args expected as array");
                  }
                             
                    if(!doAction(beanName, methodName, rep, request, result)) break;
           
            if(orm != null) orm.commit();
View Full Code Here

        int type = rep.lexer.yylex();
        if(type == Yytoken.TYPE_COMMA) continue;
        if(type == Yytoken.TYPE_RIGHT_SQUARE) return null;
            if(type == Yytoken.TYPE_EOF) return null;
        if(type == Yytoken.TYPE_VALUE) return rep.lexer.value;
        throw new ParseException(errMessage);
      }
  }
View Full Code Here

TOP

Related Classes of ru.yandex.strictweb.ajaxtools.representation.ParseException

Copyright © 2018 www.massapicom. 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.