Examples of FormInput


Examples of de.odysseus.calyxo.forms.FormInput

  /**
   * Get value array for specified component.
   */
  public String[] getInputValues(FormComponent component) throws Exception {
    FormInput input = form.getFormInput(component.getName());
    if (!input.isArray()) {
      throw new ConfigException("Input '" + component.getName() + "' is not an array");
    }
    if (result != null) {
      return (String[])result.getFormInputResult(component.getName()).format(request);
    } else if (data != null) {
      return (String[])input.format(request, data);
    } else {
      return NOT_AVAILABLE_ARRAY;
    }
  }
View Full Code Here

Examples of de.odysseus.calyxo.forms.FormInput

      if (result != null) {
        try {
          Iterator inputs = result.getFormInputResults();
          while (inputs.hasNext()) {
            FormInputResult inputResult = (FormInputResult)inputs.next();
            FormInput input = inputResult.getFormInput();
            Object value = inputResult.format(request);
            if (input.isArray()) {
              values._setInputs(input.getName(), (String[])value);
            } else {
              values._setInput(input.getName(), (String)value);
            }
          }
        } catch (Exception e) {
          throw new JspException(e);
        }
      } else {
        Form form = support.getForm(request, action);
        if (form == null) {
          throw new JspException("Cannot find form for action '" + action + "'!");
        }
        try {
          Iterator inputs = form.getFormInputs();
          while (inputs.hasNext()) {
            FormInput input = (FormInput)inputs.next();
            Object value = input.format(request, formData);
            if (input.isArray()) {
              values._setInputs(input.getName(), (String[])value);
            } else {
              values._setInput(input.getName(), (String)value);
            }
          }
        } catch (Exception e) {
          throw new JspException(e);
        }
View Full Code Here

Examples of org.apache.sqoop.validation.Validation.FormInput

    /* toString() method check */
    assertEquals("form\\.input", fiOne.toString());

    // Checking null as input field (form validation)
    Validation.FormInput fi3 = new FormInput("form");
    assertEquals("form", fi3.getForm());
    assertNull(fi3.getInput());
    assertEquals("form", fi3.toString());

  }
View Full Code Here

Examples of org.lobobrowser.html.FormInput

        }
        else {
          newUrlBuffer.append("&");
        }
        for(int i = 0; i < formInputs.length; i++) {
          FormInput parameter = formInputs[i];
          String name = parameter.getName();
          String encName = URLEncoder.encode(name, "UTF-8");
          if(parameter.isText()) {
            if(firstParam) {
              firstParam = false;
            }
            else {
              newUrlBuffer.append("&");
            }
            String valueStr = parameter.getTextValue();
            String encValue = URLEncoder.encode(valueStr, "UTF-8");
            newUrlBuffer.append(encName);
            newUrlBuffer.append("=");
            newUrlBuffer.append(encValue);
          }
        } 
        resolvedURL = new java.net.URL(newUrlBuffer.toString());
      }
      else {
        resolvedURL = action;
      }
      URL urlForLoading;
      if(resolvedURL.getProtocol().equals("file")) {
        // Remove query so it works.
        try {
          String ref = action.getRef();
          String refText = ref == null || ref.length() == 0 ? "" : "#" + ref;
          urlForLoading = new URL(resolvedURL.getProtocol(), action.getHost(), action.getPort(), action.getPath() + refText);
        } catch(java.net.MalformedURLException throwable) {
          urlForLoading = action;
        }
      }
      else {
        urlForLoading = resolvedURL;
      }
      // Using potentially different URL for loading.
      boolean isPost = "POST".equals(actualMethod);
      URLConnection connection = urlForLoading.openConnection();
      connection.setRequestProperty("User-Agent", getUserAgentContext().getUserAgent());
      connection.setRequestProperty("Cookie", "");
      HttpURLConnection hc = null;
      if (connection instanceof HttpURLConnection) {
        hc = (HttpURLConnection) connection;
        hc.setRequestMethod(actualMethod);
        // Do not follow redirects
        hc.setInstanceFollowRedirects(false);
      }
      if(isPost) {
        connection.setDoOutput(true);
        ByteArrayOutputStream bufOut = new ByteArrayOutputStream();
        boolean firstParam = true;
        if(formInputs != null) {
          for(int i = 0; i < formInputs.length; i++) {
            FormInput parameter = formInputs[i];
            String name = parameter.getName();
            String encName = URLEncoder.encode(name, "UTF-8");
            if(parameter.isText()) {
              if(firstParam) {
                firstParam = false;
              }
              else {
                bufOut.write((byte) '&');                     
              }
              String valueStr = parameter.getTextValue();
              String encValue = URLEncoder.encode(valueStr, "UTF-8");
              bufOut.write(encName.getBytes("UTF-8"));
              bufOut.write((byte) '=');
              bufOut.write(encValue.getBytes("UTF-8"));
            }
View Full Code Here

Examples of org.lobobrowser.html.FormInput

  {
    UserAgentContext uacontext = new MozillaUserAgent();
    LocalHtmlRendererContext rcontext = new LocalHtmlRendererContext(uacontext);
    //rcontext.navigate("http://www.google.com/search");
   
    FormInput submitInput1 = new FormInput("hl", "en");
    FormInput submitInput2 = new FormInput("q", "student");
    FormInput submitInput3 = new FormInput("aqi", "g7g-s1g2");
   
    URL url = org.lobobrowser.util.Urls.guessURL("http://www.google.com/search");
   
    rcontext.submitForm("GET", url, "_this", null, new FormInput[] {
        submitInput1, submitInput2, submitInput3
View Full Code Here

Examples of org.lobobrowser.html.FormInput

     
      conceptName = breakCapitalizedConcepts(conceptName.replace("_", " ")," ");
     
      Logger.getLogger(Processor.class.getName()).info("Google number of results for " + conceptName);
     
      FormInput submitInput1 = new FormInput("hl", "en");
      FormInput submitInput2 = new FormInput("q", conceptName);
      FormInput submitInput3 = new FormInput("aqi", "g7g-s1g2");
     
      URL url = org.lobobrowser.util.Urls.guessURL(SEARCH_STRING);
     
      rcontext.submitForm("GET", url, "_this", null, new FormInput[] {
          submitInput1, submitInput2, submitInput3
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.