Examples of UrlConfig


Examples of org.apache.beehive.netui.util.config.bean.UrlConfig

    }

    private static final UrlConfig parseUrlConfig(Document document) {
        Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "url-config");
        if(elem == null)
            return new UrlConfig();

        Boolean urlEncodeUrls = null;
        Boolean htmlAmpEntity = null;
        String templatedUrlFormatterClass = null;

        String tmp = null;

        tmp = DomUtils.getChildElementText(elem, "url-encode-urls");
        if(tmp != null)
            urlEncodeUrls = new Boolean(Boolean.parseBoolean(tmp));

        tmp = DomUtils.getChildElementText(elem, "html-amp-entity");
        if(tmp != null)
            htmlAmpEntity = new Boolean(Boolean.parseBoolean(tmp));

        templatedUrlFormatterClass = DomUtils.getChildElementText(elem, "templated-url-formatter-class");

        return new UrlConfig(urlEncodeUrls, htmlAmpEntity, templatedUrlFormatterClass);
    }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    super.putValue(key, value);
    return;
   }
   String newData = "";
   if(value instanceof UrlConfig){
    UrlConfig config = (UrlConfig)value;
    String queryString = config.getQueryString();
    queryString = queryString.replace('&', DATA_SEPARATOR);
    newData = queryString;
   }
   else if(value instanceof String)
    newData = (String)value;
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    engine.runTest();
  }

  private SamplerController createTestSample(String url) throws MalformedURLException
  {
    UrlConfig config = new UrlConfig();
    URL u = new URL(url);
    config.setName(u.toString());
    config.putProperty(UrlConfig.METHOD, UrlConfig.GET);
    config.putProperty(UrlConfig.DOMAIN, u.getHost());
    config.putProperty(UrlConfig.PATH, u.getFile());
    SamplerController test = new HttpTestSample();
    test.addConfigElement(config);
    return test;
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    {
      return false;
    }
    List potentialLinks = new ArrayList();
    String responseText = new String((byte[])result.getValue(SampleResult.TEXT_RESPONSE));
    UrlConfig config = (UrlConfig)entry.getConfigElement(UrlConfig.class);
    Document html;
    try
    {
      html = (Document)HtmlParser.getDOM(responseText);
    }
    catch (SAXException e)
    {
      return false;
    }
    addAnchorUrls(html, result, config, potentialLinks);
    addFormUrls(html,result,config,potentialLinks);
    if (potentialLinks.size() > 0)
    {
      UrlConfig url = (UrlConfig)potentialLinks.get(rand.nextInt(potentialLinks.size()));
      config.setDomain(url.getDomain());
      config.setPath(url.getPath());
      if(url.getMethod().equals(UrlConfig.POST))
      {
        Iterator iter = config.getArguments().iterator();
        while(iter.hasNext())
        {
          Argument arg = (Argument)iter.next();
          modifyArgument(arg,url.getArguments());
        }
      }
      else
      {
        config.removeArguments();
        config.putProperty(config.ARGUMENTS,url.getProperty(url.ARGUMENTS));
        //config.parseArguments(url.getQueryString());
      }
      config.setProtocol(url.getProtocol());
      return true;
    }
    return false;
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

          }
        }

        if (replaced)
        {
          UrlConfig newConfig = ((HttpTestSample)item).getDefaultUrl();
          LogicController newControl = new LogicController();
          tree.replace(item, newControl);
          tree.add(newControl, newConfig);
        }
      }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

          (URL)result.getValue(HTTPSampler.URL)));
    }
    Iterator iter = urls.iterator();
    while (iter.hasNext())
    {
      UrlConfig newUrl = (UrlConfig)iter.next();
      try
      {
        newUrl.setMethod(UrlConfig.POST);
        if(HtmlParser.isAnchorMatched(newUrl,config))
        {
          potentialLinks.add(newUrl);
        }
      }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

        continue;
      }
      String hrefStr = namedItem.getNodeValue();
      try
      {
        UrlConfig newUrl = HtmlParser.createUrlFromAnchor(hrefStr, (URL)result.getValue(HTTPSampler.URL));
        newUrl.setMethod(UrlConfig.GET);
        if (HtmlParser.isAnchorMatched(newUrl, config))
        {
          potentialLinks.add(newUrl);
        }
      }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    // Create a dummy UrlConfig and set only the method.  Set the method to
    // GET.  Pass this UrlConfig to setupConnection() 'cos it uses UrlConfig
    // to determine the HTTP method to get the url.  In this case, we are
    // loading binaries so the method has to be GET.
    UrlConfig urlConfig = new UrlConfig();
    urlConfig.setMethod(UrlConfig.GET);
    HttpURLConnection conn = null;
    try
    {
      conn = setupConnection(url, urlConfig, e);
      conn.connect();
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

   *@return                           !ToDo (Return description)
   *@exception MalformedURLException  !ToDo (Exception description)
   ***************************************/
  public static UrlConfig createUrlFromAnchor(String parsedUrlString, URL context) throws MalformedURLException
  {
    UrlConfig url = new UrlConfig();
    url.setDomain(context.getHost());
    url.setProtocol(context.getProtocol());
    url.setPort(context.getPort());

    // In JDK1.3, we can get the path using getPath(). However, in JDK1.2, we have to parse
    // the file to obtain the path. In the source for JDK1.3.1, they determine the path to
    // be from the start of the file up to the LAST question mark (if any).
    String contextPath = null;
    String contextFile = context.getFile();
    int indexContextQuery = contextFile.lastIndexOf('?');
    if(indexContextQuery != -1)
      contextPath = contextFile.substring(0, indexContextQuery);

    else
      contextPath = contextFile;

    int queryStarts = parsedUrlString.indexOf("?");

    if(queryStarts == -1)
      queryStarts = parsedUrlString.length();

    if(parsedUrlString.startsWith("/"))
      url.setPath(parsedUrlString.substring(0, queryStarts));

    else if(parsedUrlString.startsWith(".."))
      url.setPath(contextPath.substring(0, contextPath.substring(0,
          contextPath.lastIndexOf("/")).lastIndexOf("/")) +
          parsedUrlString.substring(2, queryStarts));

    else if(!parsedUrlString.toLowerCase().startsWith("http"))
      url.setPath(contextPath.substring(0, contextPath.lastIndexOf("/")) +
          "/" + parsedUrlString.substring(0, queryStarts));

    else
    {
      URL u = new URL(parsedUrlString);

      // Determine the path. (See JDK1.2/1.3 comment above.)
      String uPath = null;
      String uFile = u.getFile();
      int indexUQuery = uFile.lastIndexOf('?');
      if(indexUQuery != -1)
        uPath = uFile.substring(0, indexUQuery);

      else
        uPath = uFile;

      url.setPath(uPath);
      url.setDomain(u.getHost());
      url.setProtocol(u.getProtocol());
      url.setPort(u.getPort());
    }

    if(queryStarts < parsedUrlString.length())
      url.parseArguments(parsedUrlString.substring(queryStarts + 1));

    return url;
  }
View Full Code Here

Examples of org.apache.jmeter.protocol.http.config.UrlConfig

    String tag = tempNode.getNodeName();
    try
    {
      if(inForm)
      {
        UrlConfig url = (UrlConfig)urlConfigs.getLast();
        if(tag.equalsIgnoreCase("form"))
        {
          try
          {
            urlConfigs.add(createFormUrlConfig(tempNode, context));
          }
          catch(MalformedURLException e)
          {
            inForm = false;
          }
        }
        else if(tag.equalsIgnoreCase("input"))
        {
          url.addArgument(getAttributeValue(nodeAtts, "name"),
              getAttributeValue(nodeAtts, "value"));
        }

        else if(tag.equalsIgnoreCase("textarea"))
          try
          {
            url.addArgument(getAttributeValue(nodeAtts, "name"),
                tempNode.getFirstChild().getNodeValue());
          }
          catch(NullPointerException e)
          {
            url.addArgument(getAttributeValue(nodeAtts, "name"), "");
          }

        else if(tag.equalsIgnoreCase("select"))
          selectName = getAttributeValue(nodeAtts, "name");

        else if(tag.equalsIgnoreCase("option"))
        {
          String value = getAttributeValue(nodeAtts, "value");
          if(value == null || value.equals(""))
            value = tempNode.getFirstChild().getNodeValue();

          url.addArgument(selectName, value);
        }
      }
      else if(tag.equalsIgnoreCase("form"))
      {
        try
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.