Package com.google.code.apis.rest.client.Util

Examples of com.google.code.apis.rest.client.Util.Uri


   *
   * @return the package name
   */
  private String getPackageBasedName() {
    String packageName = application.getResources().getBase();
    Uri packageNameUrl = new Uri(packageName);
    packageName = packageNameUrl.getAuthority();
    packageName = packageName.replaceAll("http(s)?://(www)?", "");
    packageName = packageName.replaceAll("[/]", "");
    String[] packageNameComponents = packageName.split("\\.");
    packageName = "";
    for (int i = 0; i < packageNameComponents.length; i++) {
View Full Code Here


   *
   * @return the package name
   */
  private String getPackageName() {
    String packageName = application.getResources().getBase();
    Uri packageNameUrl = new Uri(packageName);
    packageName = packageNameUrl.getAuthority();
    packageName = packageName.replaceAll("http(s)?://(www)?", "");
    packageName = packageName.replaceAll("[/]", "");
    String[] packageNameComponents = packageName.split("\\.");
    packageName = "";
    for (int i = packageNameComponents.length -1 ; i >= 0 ; i--) {
View Full Code Here

          }
          requestString = param.getApplication().getAnalyzer().getRequestString();
          listParams(parent, parentTreeItem, requestString);        
         
          TextBox requestUriTextBox = ReferenceManager.getRequestUriTextBox(requestString);
          Uri uri = new Uri(requestUriTextBox.getText());
          String newUri = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath() + "?";
          String[] queryParameters = uri.getQueryParameters();
          String[] queryValues = uri.getQueryValues();
          for (int i = 0; i < queryParameters.length; i++) {
            if (!queryParameters[i].equals(parameterName.getText())) {
              if (i > 0) newUri += "&";      
              newUri += queryParameters[i] + "=" + queryValues[i];
            }
          }                    
          newUri += uri.getFragment();         
          ListBox httpMethodListBox = ReferenceManager.getHttpMethodListBox(requestString);
          ParameterTree parameterTree = ReferenceManager.getParameterTree(requestString);         
          parameterTree.updateReferences(requestUriTextBox, newUri);
          parameterTree.updateTree();                      
          requestString =
View Full Code Here

   */
  protected void updateParamName(String parameterName) {
    param.updateName(param.getName(), parameterName);
   
    TextBox requestUriTextBox = ReferenceManager.getRequestUriTextBox(requestString)
    Uri uri = new Uri(requestUriTextBox.getText());
    String newUri = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath() + "?";
    String[] queryParameters = uri.getQueryParameters();
    String[] queryValues = uri.getQueryValues();
    for (int i = 0; i < queryParameters.length; i++) {
      if (i > 0) newUri += "&";           
      if (queryValues[i].equals(param.getValue())) {             
        newUri += parameterName + "=" + queryValues[i];
      }
      else {
        newUri += queryParameters[i] + "=" + queryValues[i];
      }
    }        
    newUri += uri.getFragment();   
    ListBox httpMethodListBox = ReferenceManager.getHttpMethodListBox(requestString);
    ParameterTree parameterTree = ReferenceManager.getParameterTree(requestString);
    parameterTree.updateReferences(requestUriTextBox, newUri);
    parameterTree.updateTree();  
    requestString =
View Full Code Here

            analyzer = ((ApplicationNode) parentNode).getAnalyzer();
          }        
          String newRequestString = analyzer.getRequestString();
          if (!newRequestString.equals("")) {
            TextBox requestUriTextBox = ReferenceManager.getRequestUriTextBox(newRequestString);
            Uri uri = new Uri(requestUriTextBox.getText());
            String newUri = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath() + "?";
            String[] queryParameters = uri.getQueryParameters();
            String[] queryValues = uri.getQueryValues();
            for (int i = 0; i < queryParameters.length; i++) {         
              if (i > 0) newUri += "&";      
              newUri += queryParameters[i] + "=" + queryValues[i];
            }
            if (queryParameters.length > 0) {
View Full Code Here

    autoDiscoverButton.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {       
        Vector requests = new Vector();
        for (Iterator allRequestUrisIterator = ReferenceManager.allRequestStrings.iterator(); allRequestUrisIterator.hasNext(); /* empty */) {
          String uriString = (String) allRequestUrisIterator.next();
          Uri uri = new Uri(uriString.substring(uriString.indexOf(" ") + 1));
          if (!requests.contains(uri.getRequest())) {
            requests.add(uri.getRequest());
          }
          // we have a request which appears twice, so force use of operation
          // param value as name (to be guessed)
          else {
            SettingsDialog.useEndpointAsName = false;
            String[] parameters = uri.getQueryParameters();           
            paramSearch:
              for (int i = 0; i < parameters.length; i++) {
                for (int j = 0; j < RestCompilePanel.commonOpParamNames.length; j++) {
                  if (parameters[i].equalsIgnoreCase(RestCompilePanel.commonOpParamNames[j])) {
                    RestCompilePanel.paramToUseForName = parameters[i];                   
View Full Code Here

  public void setApplication(ApplicationNode applicationNode) {
    application = applicationNode;   
  }
   
  public ApplicationNode analyze() {
    Uri uri = new Uri(requestString.substring(requestString.indexOf(" ") + 1));
   
    String[] queryParameters = uri.getQueryParameters();
    String[] queryValues = uri.getQueryValues();
    String[] pathComponents = uri.getPathComponents();
       
    // <application>
    setApplication(new ApplicationNode(this));   
   
    // <resources>
    ResourcesNode resources = null;
    String base = uri.getScheme() + "://" + uri.getAuthority();
    if (application.getResources() == null) {
      resources = new ResourcesNode(base, application);
      application.addResources(resources);
    }
    else {
View Full Code Here

  /**
   * Updates the request parameter tree in case of where the request uri got changed
   * @param uri The new request uri
   */
  public void updateTree() {
    Uri uri = new Uri(requestString.substring(requestString.indexOf(" ") + 1));  
    updateRequestName(uri);
    requestItem.removeItems();   
       
    String[] queryParameters = uri.getQueryParameters();
    String[] queryValues = uri.getQueryValues();    
    for (int i = 0; i < queryParameters.length; i++) {
      final HorizontalPanel containerPanel = new HorizontalPanel();
      final TreeItem parameterItem = new TreeItem(containerPanel);
      // parameter name label
      HTML parameterName = new HTML("<nobr/>" + queryParameters[i] + " =&nbsp;</nobr>");           
View Full Code Here

   *
   */
  private void removeHyperlink(TreeItem parameterItem, String queryValue) {
    parameterItem.remove();
    TextBox requestUriTextBox = ReferenceManager.getRequestUriTextBox(requestString);
    Uri uri = new Uri(requestUriTextBox.getText());
    String newUri = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath() + "?";
    String[] queryParameters = uri.getQueryParameters();
    String[] queryValues = uri.getQueryValues();
    for (int i = 0; i < queryParameters.length; i++) {
      if (!queryValues[i].equals(queryValue)) {
        if (i > 0) newUri += "&";      
        newUri += queryParameters[i] + "=" + queryValues[i];
      }
    }
    newUri += uri.getFragment();
    updateReferences(requestUriTextBox, newUri);   
  }
View Full Code Here

    updateReferences(requestUriTextBox, newUri);   
  }

  private void updateParameterName(String queryParameter, String queryValue) {
    TextBox requestUriTextBox = ReferenceManager.getRequestUriTextBox(requestString);
    Uri uri = new Uri(requestUriTextBox.getText());
    String newUri = uri.getScheme() + "://" + uri.getAuthority() + uri.getPath() + "?";
    String[] queryParameters = uri.getQueryParameters();
    String[] queryValues = uri.getQueryValues();
    for (int i = 0; i < queryParameters.length; i++) {
      if (i > 0) newUri += "&";           
      if (queryValues[i].equals(queryValue)) {             
        newUri += queryParameter + "=" + queryValues[i];
      }
      else {
        newUri += queryParameters[i] + "=" + queryValues[i];
      }         
    } 
    newUri += uri.getFragment();
    updateReferences(requestUriTextBox, newUri);
 
View Full Code Here

TOP

Related Classes of com.google.code.apis.rest.client.Util.Uri

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.