org.restlet.util.Series.iterator()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.restlet.util.Series.iterator()方法的一些代码示例,展示了Series.iterator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Series.iterator()方法的具体详情如下:
包路径:org.restlet.util.Series
类名称:Series
方法名:iterator

Series.iterator介绍

暂无

代码示例

代码示例来源:origin: org.restlet.jse/org.restlet.ext.html

/**
 * Indicates if the searched entry is specified in the given media range.
 * 
 * @param searchedEntry
 *            The searched entry.
 * @param mediaRange
 *            The media range to inspect.
 * @return True if the searched entry is specified in the given media range.
 */
public static boolean isEntryFound(FormData searchedEntry,
    MediaType mediaRange) {
  boolean result = false;
  for (Iterator<? extends NamedValue<String>> iter = mediaRange
      .getParameters().iterator(); !result && iter.hasNext();) {
    result = searchedEntry.equals(iter.next());
  }
  return result;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Removes all the parameters with a given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case sensitive.
 * @return True if the list changed.
 */
public boolean removeAll(String name, boolean ignoreCase) {
  boolean changed = false;
  Parameter param = null;
  for (final Iterator<E> iter = iterator(); iter.hasNext();) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet/org.restlet

/**
 * Removes from this list the first entry whose name equals the specified
 * name ignoring the case or not.
 * 
 * @param name
 *            The name of the entries to be removed.
 * @param ignoreCase
 *            true if the comparison ignores the case, false otherwise.
 * @return false if no entry has been removed, true otherwise.
 */
public boolean removeFirst(String name, boolean ignoreCase) {
  boolean changed = false;
  Parameter param = null;
  for (final Iterator<E> iter = iterator(); iter.hasNext() && !changed;) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Removes from this list the first entry whose name equals the specified
 * name ignoring the case or not.
 * 
 * @param name
 *            The name of the entries to be removed.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return false if no entry has been removed, true otherwise.
 */
public boolean removeFirst(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (final Iterator<T> iter = iterator(); iter.hasNext() && !changed;) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Removes all the parameters with a given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return True if the list changed.
 */
public boolean removeAll(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (Iterator<T> iter = iterator(); iter.hasNext();) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Indicates if the searched parameter is specified in the given media
 * range.
 * 
 * @param searchedParam
 *            The searched parameter.
 * @param mediaRange
 *            The media range to inspect.
 * @return True if the searched parameter is specified in the given media
 *         range.
 */
public static boolean isParameterFound(Parameter searchedParam,
    MediaType mediaRange) {
  boolean result = false;
  for (Iterator<Parameter> iter = mediaRange.getParameters().iterator(); !result
      && iter.hasNext();) {
    result = searchedParam.equals(iter.next());
  }
  return result;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Removes all the parameters with a given name.
 * 
 * @param name
 *            The parameter name.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return True if the list changed.
 */
public boolean removeAll(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (Iterator<T> iter = iterator(); iter.hasNext();) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Indicates if the searched parameter is specified in the given media
 * range.
 * 
 * @param searchedParam
 *            The searched parameter.
 * @param mediaRange
 *            The media range to inspect.
 * @return True if the searched parameter is specified in the given media
 *         range.
 */
public static boolean isParameterFound(Parameter searchedParam,
    MediaType mediaRange) {
  boolean result = false;
  for (Iterator<Parameter> iter = mediaRange.getParameters().iterator(); !result
      && iter.hasNext();) {
    result = searchedParam.equals(iter.next());
  }
  return result;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

/**
 * Removes from this list the first entry whose name equals the specified
 * name ignoring the case or not.
 * 
 * @param name
 *            The name of the entries to be removed.
 * @param ignoreCase
 *            Indicates if the name comparison is case insensitive.
 * @return false if no entry has been removed, true otherwise.
 */
public boolean removeFirst(String name, boolean ignoreCase) {
  boolean changed = false;
  NamedValue<String> param = null;
  for (final Iterator<T> iter = iterator(); iter.hasNext() && !changed;) {
    param = iter.next();
    if (equals(param.getName(), name, ignoreCase)) {
      iter.remove();
      changed = true;
    }
  }
  return changed;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Extract the quality value. If the value is not found, 1 is returned.
 * 
 * @param parameters
 *            The preference parameters.
 * @return The quality value.
 */
protected float extractQuality(Series<Parameter> parameters) {
  float result = 1F;
  boolean found = false;
  if (parameters != null) {
    Parameter param = null;
    for (final Iterator<Parameter> iter = parameters.iterator(); !found
        && iter.hasNext();) {
      param = iter.next();
      if (param.getName().equals("q")) {
        result = readQuality(param.getValue());
        found = true;
        // Remove the quality parameter as we will directly store it
        // in the Preference object
        iter.remove();
      }
    }
  }
  return result;
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Extract the media parameters. Only leave as the quality parameter if
 * found. Modifies the parameters list.
 * 
 * @param parameters
 *            All the preference parameters.
 * @return The media parameters.
 */
protected Series<Parameter> extractMediaParams(Series<Parameter> parameters) {
  Series<Parameter> result = null;
  boolean qualityFound = false;
  Parameter param = null;
  if (parameters != null) {
    result = new Series<Parameter>(Parameter.class);
    for (final Iterator<Parameter> iter = parameters.iterator(); !qualityFound
        && iter.hasNext();) {
      param = iter.next();
      if (param.getName().equals("q")) {
        qualityFound = true;
      } else {
        iter.remove();
        result.add(param);
      }
    }
  }
  return result;
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

boolean found = false;
for (final Iterator<T> iter = iterator(); iter.hasNext();) {
  param = iter.next();

代码示例来源:origin: org.restlet.osgi/org.restlet

boolean found = false;
for (final Iterator<T> iter = iterator(); iter.hasNext();) {
  param = iter.next();

代码示例来源:origin: org.restlet/org.restlet

boolean found = false;
for (final Iterator<E> iter = iterator(); iter.hasNext();) {
  param = iter.next();

代码示例来源:origin: org.restlet.osgi/org.restlet

Object currentValue = null;
for (Iterator<T> iter = iterator(); iter.hasNext();) {
  param = iter.next();

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

Object currentValue = null;
for (Iterator<T> iter = iterator(); iter.hasNext();) {
  param = iter.next();

代码示例来源:origin: org.restlet/org.restlet

Parameter param;
Object currentValue = null;
for (final Iterator<E> iter = iterator(); iter.hasNext();) {
  param = iter.next();

代码示例来源:origin: org.restlet.osgi/org.restlet

@Override
public PreferenceWriter append(Preference<?> pref) {
  append(pref.getMetadata().getName());
  if (pref.getQuality() < 1F) {
    append(";q=");
    appendQuality(pref.getQuality());
  }
  if (pref.getParameters() != null) {
    Parameter param;
    for (Iterator<Parameter> iter = pref.getParameters().iterator(); iter
        .hasNext();) {
      param = iter.next();
      if (param.getName() != null) {
        append(';').append(param.getName());
        if ((param.getValue() != null)
            && (param.getValue().length() > 0)) {
          append('=').append(param.getValue());
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.restlet/org.restlet.ext.jetty

@Override
  public void sendResponse(Response response) throws IOException {
    // Add call headers
    Parameter header;
    for (final Iterator<Parameter> iter = getResponseHeaders().iterator(); iter
        .hasNext();) {
      header = iter.next();
      getConnection().getResponse().addHeader(header.getName(),
          header.getValue());
    }

    // Set the status code in the response. We do this after adding the
    // headers because when we have to rely on the 'sendError' method,
    // the Servlet containers are expected to commit their response.
    if (Status.isError(getStatusCode()) && (response.getEntity() == null)) {
      try {
        getConnection().getResponse().sendError(getStatusCode(),
            getReasonPhrase());
      } catch (IOException ioe) {
        getLogger().log(Level.WARNING,
            "Unable to set the response error status", ioe);
      }
    } else {
      // Send the response entity
      getConnection().getResponse().setStatus(getStatusCode());
      super.sendResponse(response);
    }

  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.jetty

@Override
  public void sendResponse(Response response) throws IOException {
    // Add call headers
    Parameter header;
    for (final Iterator<Parameter> iter = getResponseHeaders().iterator(); iter
        .hasNext();) {
      header = iter.next();
      getConnection().getResponse().addHeader(header.getName(),
          header.getValue());
    }

    // Set the status code in the response. We do this after adding the
    // headers because when we have to rely on the 'sendError' method,
    // the Servlet containers are expected to commit their response.
    if (Status.isError(getStatusCode()) && (response.getEntity() == null)) {
      try {
        getConnection().getResponse().sendError(getStatusCode(),
            getReasonPhrase());
      } catch (IOException ioe) {
        getLogger().log(Level.WARNING,
            "Unable to set the response error status", ioe);
      }
    } else {
      // Send the response entity
      getConnection().getResponse().setStatus(getStatusCode());
      super.sendResponse(response);
    }

  }
}

相关文章