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

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

本文整理了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

  1. /**
  2. * Indicates if the searched entry is specified in the given media range.
  3. *
  4. * @param searchedEntry
  5. * The searched entry.
  6. * @param mediaRange
  7. * The media range to inspect.
  8. * @return True if the searched entry is specified in the given media range.
  9. */
  10. public static boolean isEntryFound(FormData searchedEntry,
  11. MediaType mediaRange) {
  12. boolean result = false;
  13. for (Iterator<? extends NamedValue<String>> iter = mediaRange
  14. .getParameters().iterator(); !result && iter.hasNext();) {
  15. result = searchedEntry.equals(iter.next());
  16. }
  17. return result;
  18. }

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

  1. /**
  2. * Removes all the parameters with a given name.
  3. *
  4. * @param name
  5. * The parameter name.
  6. * @param ignoreCase
  7. * Indicates if the name comparison is case sensitive.
  8. * @return True if the list changed.
  9. */
  10. public boolean removeAll(String name, boolean ignoreCase) {
  11. boolean changed = false;
  12. Parameter param = null;
  13. for (final Iterator<E> iter = iterator(); iter.hasNext();) {
  14. param = iter.next();
  15. if (equals(param.getName(), name, ignoreCase)) {
  16. iter.remove();
  17. changed = true;
  18. }
  19. }
  20. return changed;
  21. }

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

  1. /**
  2. * Removes from this list the first entry whose name equals the specified
  3. * name ignoring the case or not.
  4. *
  5. * @param name
  6. * The name of the entries to be removed.
  7. * @param ignoreCase
  8. * true if the comparison ignores the case, false otherwise.
  9. * @return false if no entry has been removed, true otherwise.
  10. */
  11. public boolean removeFirst(String name, boolean ignoreCase) {
  12. boolean changed = false;
  13. Parameter param = null;
  14. for (final Iterator<E> iter = iterator(); iter.hasNext() && !changed;) {
  15. param = iter.next();
  16. if (equals(param.getName(), name, ignoreCase)) {
  17. iter.remove();
  18. changed = true;
  19. }
  20. }
  21. return changed;
  22. }

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

  1. /**
  2. * Removes from this list the first entry whose name equals the specified
  3. * name ignoring the case or not.
  4. *
  5. * @param name
  6. * The name of the entries to be removed.
  7. * @param ignoreCase
  8. * Indicates if the name comparison is case insensitive.
  9. * @return false if no entry has been removed, true otherwise.
  10. */
  11. public boolean removeFirst(String name, boolean ignoreCase) {
  12. boolean changed = false;
  13. NamedValue<String> param = null;
  14. for (final Iterator<T> iter = iterator(); iter.hasNext() && !changed;) {
  15. param = iter.next();
  16. if (equals(param.getName(), name, ignoreCase)) {
  17. iter.remove();
  18. changed = true;
  19. }
  20. }
  21. return changed;
  22. }

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

  1. /**
  2. * Removes all the parameters with a given name.
  3. *
  4. * @param name
  5. * The parameter name.
  6. * @param ignoreCase
  7. * Indicates if the name comparison is case insensitive.
  8. * @return True if the list changed.
  9. */
  10. public boolean removeAll(String name, boolean ignoreCase) {
  11. boolean changed = false;
  12. NamedValue<String> param = null;
  13. for (Iterator<T> iter = iterator(); iter.hasNext();) {
  14. param = iter.next();
  15. if (equals(param.getName(), name, ignoreCase)) {
  16. iter.remove();
  17. changed = true;
  18. }
  19. }
  20. return changed;
  21. }

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

  1. /**
  2. * Indicates if the searched parameter is specified in the given media
  3. * range.
  4. *
  5. * @param searchedParam
  6. * The searched parameter.
  7. * @param mediaRange
  8. * The media range to inspect.
  9. * @return True if the searched parameter is specified in the given media
  10. * range.
  11. */
  12. public static boolean isParameterFound(Parameter searchedParam,
  13. MediaType mediaRange) {
  14. boolean result = false;
  15. for (Iterator<Parameter> iter = mediaRange.getParameters().iterator(); !result
  16. && iter.hasNext();) {
  17. result = searchedParam.equals(iter.next());
  18. }
  19. return result;
  20. }

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

  1. /**
  2. * Removes all the parameters with a given name.
  3. *
  4. * @param name
  5. * The parameter name.
  6. * @param ignoreCase
  7. * Indicates if the name comparison is case insensitive.
  8. * @return True if the list changed.
  9. */
  10. public boolean removeAll(String name, boolean ignoreCase) {
  11. boolean changed = false;
  12. NamedValue<String> param = null;
  13. for (Iterator<T> iter = iterator(); iter.hasNext();) {
  14. param = iter.next();
  15. if (equals(param.getName(), name, ignoreCase)) {
  16. iter.remove();
  17. changed = true;
  18. }
  19. }
  20. return changed;
  21. }

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

  1. /**
  2. * Indicates if the searched parameter is specified in the given media
  3. * range.
  4. *
  5. * @param searchedParam
  6. * The searched parameter.
  7. * @param mediaRange
  8. * The media range to inspect.
  9. * @return True if the searched parameter is specified in the given media
  10. * range.
  11. */
  12. public static boolean isParameterFound(Parameter searchedParam,
  13. MediaType mediaRange) {
  14. boolean result = false;
  15. for (Iterator<Parameter> iter = mediaRange.getParameters().iterator(); !result
  16. && iter.hasNext();) {
  17. result = searchedParam.equals(iter.next());
  18. }
  19. return result;
  20. }

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

  1. /**
  2. * Removes from this list the first entry whose name equals the specified
  3. * name ignoring the case or not.
  4. *
  5. * @param name
  6. * The name of the entries to be removed.
  7. * @param ignoreCase
  8. * Indicates if the name comparison is case insensitive.
  9. * @return false if no entry has been removed, true otherwise.
  10. */
  11. public boolean removeFirst(String name, boolean ignoreCase) {
  12. boolean changed = false;
  13. NamedValue<String> param = null;
  14. for (final Iterator<T> iter = iterator(); iter.hasNext() && !changed;) {
  15. param = iter.next();
  16. if (equals(param.getName(), name, ignoreCase)) {
  17. iter.remove();
  18. changed = true;
  19. }
  20. }
  21. return changed;
  22. }

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

  1. /**
  2. * Extract the quality value. If the value is not found, 1 is returned.
  3. *
  4. * @param parameters
  5. * The preference parameters.
  6. * @return The quality value.
  7. */
  8. protected float extractQuality(Series<Parameter> parameters) {
  9. float result = 1F;
  10. boolean found = false;
  11. if (parameters != null) {
  12. Parameter param = null;
  13. for (final Iterator<Parameter> iter = parameters.iterator(); !found
  14. && iter.hasNext();) {
  15. param = iter.next();
  16. if (param.getName().equals("q")) {
  17. result = readQuality(param.getValue());
  18. found = true;
  19. // Remove the quality parameter as we will directly store it
  20. // in the Preference object
  21. iter.remove();
  22. }
  23. }
  24. }
  25. return result;
  26. }

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

  1. /**
  2. * Extract the media parameters. Only leave as the quality parameter if
  3. * found. Modifies the parameters list.
  4. *
  5. * @param parameters
  6. * All the preference parameters.
  7. * @return The media parameters.
  8. */
  9. protected Series<Parameter> extractMediaParams(Series<Parameter> parameters) {
  10. Series<Parameter> result = null;
  11. boolean qualityFound = false;
  12. Parameter param = null;
  13. if (parameters != null) {
  14. result = new Series<Parameter>(Parameter.class);
  15. for (final Iterator<Parameter> iter = parameters.iterator(); !qualityFound
  16. && iter.hasNext();) {
  17. param = iter.next();
  18. if (param.getName().equals("q")) {
  19. qualityFound = true;
  20. } else {
  21. iter.remove();
  22. result.add(param);
  23. }
  24. }
  25. }
  26. return result;
  27. }

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. @Override
  2. public PreferenceWriter append(Preference<?> pref) {
  3. append(pref.getMetadata().getName());
  4. if (pref.getQuality() < 1F) {
  5. append(";q=");
  6. appendQuality(pref.getQuality());
  7. }
  8. if (pref.getParameters() != null) {
  9. Parameter param;
  10. for (Iterator<Parameter> iter = pref.getParameters().iterator(); iter
  11. .hasNext();) {
  12. param = iter.next();
  13. if (param.getName() != null) {
  14. append(';').append(param.getName());
  15. if ((param.getValue() != null)
  16. && (param.getValue().length() > 0)) {
  17. append('=').append(param.getValue());
  18. }
  19. }
  20. }
  21. }
  22. return this;
  23. }

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

  1. @Override
  2. public void sendResponse(Response response) throws IOException {
  3. // Add call headers
  4. Parameter header;
  5. for (final Iterator<Parameter> iter = getResponseHeaders().iterator(); iter
  6. .hasNext();) {
  7. header = iter.next();
  8. getConnection().getResponse().addHeader(header.getName(),
  9. header.getValue());
  10. }
  11. // Set the status code in the response. We do this after adding the
  12. // headers because when we have to rely on the 'sendError' method,
  13. // the Servlet containers are expected to commit their response.
  14. if (Status.isError(getStatusCode()) && (response.getEntity() == null)) {
  15. try {
  16. getConnection().getResponse().sendError(getStatusCode(),
  17. getReasonPhrase());
  18. } catch (IOException ioe) {
  19. getLogger().log(Level.WARNING,
  20. "Unable to set the response error status", ioe);
  21. }
  22. } else {
  23. // Send the response entity
  24. getConnection().getResponse().setStatus(getStatusCode());
  25. super.sendResponse(response);
  26. }
  27. }
  28. }

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

  1. @Override
  2. public void sendResponse(Response response) throws IOException {
  3. // Add call headers
  4. Parameter header;
  5. for (final Iterator<Parameter> iter = getResponseHeaders().iterator(); iter
  6. .hasNext();) {
  7. header = iter.next();
  8. getConnection().getResponse().addHeader(header.getName(),
  9. header.getValue());
  10. }
  11. // Set the status code in the response. We do this after adding the
  12. // headers because when we have to rely on the 'sendError' method,
  13. // the Servlet containers are expected to commit their response.
  14. if (Status.isError(getStatusCode()) && (response.getEntity() == null)) {
  15. try {
  16. getConnection().getResponse().sendError(getStatusCode(),
  17. getReasonPhrase());
  18. } catch (IOException ioe) {
  19. getLogger().log(Level.WARNING,
  20. "Unable to set the response error status", ioe);
  21. }
  22. } else {
  23. // Send the response entity
  24. getConnection().getResponse().setStatus(getStatusCode());
  25. super.sendResponse(response);
  26. }
  27. }
  28. }

相关文章