Package net.infopeers.restrant.engine.parser

Examples of net.infopeers.restrant.engine.parser.UrlPathParser


     * @param patternParser
     * @return
     */
    private String toPath4Script(
        PatternParserWithPathFormat patternParser) {
      UrlPathParser pp = patternParser.getUrlPathParser();
      String path = pp.getPath();

      Replacer rep = new Replacer(phPattern) {
        @Override
        protected String replace(int groupIndex, String value) {
          return "' + " + value + " + '";
View Full Code Here


    protected void createParams(PatternParserWithPathFormat patternParser,
        StringBuilder jsonParams) {
     
      int count = 0;
      UrlPathParser pp = patternParser.getUrlPathParser();
      String query = pp.getQuery();
      if(query.trim().length() == 0){
        return;
      }
     
      String[] params = query.split("&");
View Full Code Here

      templator.appendHeader(pw);

      for (PatternParser p : parsers) {

        PatternParserWithPathFormat pp;
        UrlPathParser pathParser;
        if (p instanceof PatternParserWithPathFormat) {
          pathParser = ((PatternParserWithPathFormat) p)
              .getUrlPathParser();
          pp = (PatternParserWithPathFormat) p;
        } else {
          continue;
        }

        String controllerSimpleName = p
            .findSpecifiedPlaceHolder(PatternInvokerBuilder.CONTROLLER_PLACEHOLDER_LABEL);
        if (controllerSimpleName == null)
          continue;

        String actionName = p
            .findSpecifiedPlaceHolder(PatternInvokerBuilder.ACTION_PLACEHOLDER_LABEL);
        if (actionName == null)
          continue;

        String controllerName = PatternInvokerBuilder
            .getFullControllerClassName(controllerSimpleName,
                rootPackage);
        try {
          Class<?> cls = Class.forName(controllerName);

          if (!classNameSet.contains(controllerName)) {
            templator.appendClass(pw, cls);
            classNameSet.add(controllerName);
          }

          for (Method m : cls.getMethods()) {

            net.infopeers.restrant.Method ma = m
                .getAnnotation(net.infopeers.restrant.Method.class);
            if (ma == null)
              continue;

            if (!m.getName().equals(actionName)) {
              if (!ma.name().equals(actionName)) {
                continue;
              }
            }

            if (pathParser.isFormtype()) {
              templator.appendFunction4formtype(pw, actionName,
                  m, pp);
            } else {
              templator.appendFunction4bodytype(pw, actionName,
                  m, pp, pathParser.getBodyParamLabel());
            }
          }

          // System.out.println(sw.toString());
        } catch (ClassNotFoundException e) {
View Full Code Here

TOP

Related Classes of net.infopeers.restrant.engine.parser.UrlPathParser

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.