org.eclipse.jetty.util.MultiMap类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(129)

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

MultiMap介绍

[英]A multi valued Map.
[中]多值地图。

代码示例

代码示例来源:origin: org.eclipse.jetty/jetty-util

_parts = new MultiMap<>();
    LOG.warn("Badly formatted multipart request");
    throw e;
      LOG.warn("Badly formatted multipart request");
      badFormatLogged = true;
    String contentTransferEncoding=null;
    MultiMap<String> headers = new MultiMap<>();
    while(true)
        headers.put(key, value);
        if (key.equalsIgnoreCase("content-disposition"))
          contentDisposition=value;
    part.setHeaders(headers);
    part.setContentType(contentType);
    _parts.add(name, part);
    part.open();
        while((c=(state!=-2)?state:partInput.read())!=-1)
              partInput.mark(1);
              int tmp=partInput.read();
              if (tmp!=10)
                partInput.reset();

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * @see javax.servlet.http.Part#getHeaders(java.lang.String)
 */
@Override
public Collection<String> getHeaders(String name)
{
  return _headers.getValues(name);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * @see javax.servlet.http.Part#getHeaderNames()
 */
@Override
public Collection<String> getHeaderNames()
{
  return _headers.keySet();
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory queryParameters() {
  request.getParameterMap();
  MultiMap<String> parameters = request.getQueryParameters();
  if (parameters != null) {
    ArrayMemory result = ArrayMemory.createHashed(parameters.size());
    for (Map.Entry<String, List<String>> entry : parameters.entrySet()) {
      List<String> value = entry.getValue();
      if (value == null || value.isEmpty()) {
        result.putAsKeyString(entry.getKey(), Memory.NULL);
      } else if (value.size() == 1) {
        result.putAsKeyString(entry.getKey(), StringMemory.valueOf(value.get(0)));
      } else {
        result.putAsKeyString(entry.getKey(), ArrayMemory.ofStringCollection(value));
      }
    }
    return result;
  } else {
    return new ArrayMemory().toConstant();
  }
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

/**
 * Merge values.
 * 
 * @param map
 *            the map to overlay on top of this one, merging together values if needed.
 * @return true if an existing key was merged with potentially new values, false if either no change was made, or there were only new keys.
 */
public boolean addAllValues(MultiMap<V> map)
{
  boolean merged = false;
  if ((map == null) || (map.isEmpty()))
  {
    // done
    return merged;
  }
  for (Map.Entry<String, List<V>> entry : map.entrySet())
  {
    String name = entry.getKey();
    List<V> values = entry.getValue();
    if (this.containsKey(name))
    {
      merged = true;
    }
    this.addValues(name,values);
  }
  return merged;
}

代码示例来源:origin: org.eclipse.jetty/jetty-util

HashMap<String,String[]> map = new HashMap<String,String[]>(size()*3/2)
for(Map.Entry<String,List<V>> entry: entrySet())

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

while ((b=in.read())>=0)
      if (key != null)
        map.add(key,value);
        map.add(value,"");
      if (maxKeys>0 && map.size()>maxKeys)
        throw new IllegalStateException(String.format("Form with too many keys [%d > %d]",map.size(),maxKeys));
      break;
      int code0=in.read();
      if ('u'==code0)
        int code1=in.read();
        if (code1>=0)
  map.add(key,value);
  map.add(buffer.toString(), "");

代码示例来源:origin: org.eclipse.jetty/jetty-util

while ((b=in.read())>=0)
      if (key != null)
        map.add(key,value);
        map.add(value,"");
      if (maxKeys>0 && map.size()>maxKeys)
        throw new IllegalStateException(String.format("Form with too many keys [%d > %d]",map.size(),maxKeys));
      break;
      int code0=in.read();
      int code1=in.read();
      buffer.append(decodeHexChar(code0,code1));
      break;
    throw new IllegalStateException(String.format("Form with too many keys [%d > %d]",map.size(),maxKeys));
  map.add(key,value);
  map.add(buffer.toString(), "");

代码示例来源:origin: org.eclipse.jetty/jetty-util

while ((b=in.read())>=0)
      if (key != null)
        map.add(key,value);
        map.add(value,"");
      if (maxKeys>0 && map.size()>maxKeys)
          throw new IllegalStateException(String.format("Form with too many keys [%d > %d]",map.size(),maxKeys));
      break;
      char code0= (char) in.read();
      char code1= (char) in.read();
      buffer.append(decodeHexByte(code0,code1));
      break;
  map.add(key,value);
  map.add(buffer.toReplacedString(), "");

代码示例来源:origin: org.eclipse.jetty/jetty-util

decodeUtf8To(in,map,maxLength,maxKeys);
return;
decode88591To(in,map,maxLength,maxKeys);
return;
decodeUtf16To(in,map,maxLength,maxKeys);
return;
  while ((c=in.read())>0)
        if (key != null)
          map.add(key,value);
          map.add(value,"");
        if (maxKeys>0 && map.size()>maxKeys)
          throw new IllegalStateException(String.format("Form with too many keys [%d > %d]",map.size(),maxKeys));
        break;
      case '=':
    map.add(key,value);
    map.add(output.toString(charset),"");

代码示例来源:origin: org.eclipse.jetty/jetty-http

_parts = new MultiMap<>();
  len = _in.read(data);
if (LOG.isDebugEnabled())
  LOG.debug("Parsing Complete {} err={}", parser, _err);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

while ((b=in.read())>=0)
        if (key != null)
          map.add(key,value);
          map.add(value,"");
        if (maxKeys>0 && map.size()>maxKeys)
          throw new IllegalStateException("Form too many keys");
        break;
        int code0=in.read();
        if ('u'==code0)
          int code1=in.read();
          if (code1>=0)
    LOG.warn(e.toString());
    LOG.debug(e);
  map.add(key,value);
  map.add(buffer.toString(), "");

代码示例来源:origin: org.eclipse.jetty/server

final DispatcherType old_type = baseRequest.getDispatcherType();
final Attributes old_attr=baseRequest.getAttributes();
MultiMap old_params=baseRequest.getParameters();
try
      MultiMap parameters=new MultiMap();
      UrlEncoded.decodeTo(query,parameters,baseRequest.getCharacterEncoding());
      if (old_params!=null && old_params.size()>0)
        Iterator iter = old_params.entrySet().iterator();
        while (iter.hasNext())
          String name=(String)entry.getKey();
          Object values=entry.getValue();
          for (int i=0;i<LazyList.size(values);i++)
            parameters.add(name, LazyList.get(values, i));

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

MultiMap<String> parameters = new MultiMap<String>();
UrlEncoded.decodeTo(query,parameters, StringUtil.__UTF8); //have to assume UTF-8 because we can't know otherwise
  extractParameters();
if (_parameters != null && _parameters.size() > 0)
  Iterator<Entry<String, Object>> iter = _parameters.entrySet().iterator();
  while (iter.hasNext())
    if (parameters.containsKey(name))
      merge_old_query = true;
    for (int i = 0; i < LazyList.size(values); i++)
      parameters.add(name,LazyList.get(values,i));
    MultiMap<String> overridden_old_query = new MultiMap<String>();
    UrlEncoded.decodeTo(_queryString,overridden_old_query,getQueryEncoding());//decode using any queryencoding set for the request
    MultiMap<String> overridden_new_query = new MultiMap<String>();
    UrlEncoded.decodeTo(query,overridden_new_query,StringUtil.__UTF8); //have to assume utf8 as we cannot know otherwise
    Iterator<Entry<String, Object>> iter = overridden_old_query.entrySet().iterator();
    while (iter.hasNext())
      if (!overridden_new_query.containsKey(name))
        for (int i = 0; i < LazyList.size(values); i++)

代码示例来源:origin: Nextdoor/bender

private MultiMap<String> extractQueryParameters()
{
  MultiMap<String> result = new MultiMap<>();
  if (_uri != null && _uri.hasQuery())
  {
    if (_queryEncoding == null)
    {
      _uri.decodeQueryTo(result);
    }
    else
    {
      try
      {
        _uri.decodeQueryTo(result, _queryEncoding);
      }
      catch (UnsupportedEncodingException e)
      {
        if (LOG.isDebugEnabled())
          LOG.warn(e);
        else
          LOG.warn(e.toString());
      }
    }
  }
  return result;
}

代码示例来源:origin: jenkinsci/winstone

private void extractContentParameters()
  if (_metaData!=null && getHttpFields().contains(HttpHeader.CONTENT_ENCODING))
    throw new BadMessageException(HttpStatus.NOT_IMPLEMENTED_501,"Unsupported Content-Encoding");
  String contentType = getContentType();
  if (contentType == null || contentType.isEmpty())
    _contentParameters=NO_PARAMS;
  else
    _contentParameters=new MultiMap<>();
    contentType = HttpFields.valueParameters(contentType, null);
    int contentLength = getContentLength();
    if (contentLength != 0 && _inputState == __NONE)
          LOG.debug(e);
          throw new RuntimeIOException(e);

代码示例来源:origin: org.eclipse.jetty/jetty-security

Request base_request = Request.getBaseRequest(request);
Response base_response = base_request.getResponse();
    LOG.debug("jsecuritycheck {} {}",username,user);
    HttpSession session = request.getSession(false);
    if (user!=null)
      LOG.debug("authenticated {}->{}",form_auth,nuri);
      int redirectCode = (base_request.getHttpVersion().getVersion() < HttpVersion.HTTP_1_1.getVersion() ? HttpServletResponse.SC_MOVED_TEMPORARILY : HttpServletResponse.SC_SEE_OTHER);
      base_response.sendRedirect(redirectCode, response.encodeRedirectURL(nuri));
      return form_auth;
    if (LOG.isDebugEnabled())
      LOG.debug("Form authentication FAILED for " + StringUtil.printable(username));
    if (_formErrorPage == null)
        MultiMap<String> formParameters = new MultiMap<>();
        base_request.extractFormParameters(formParameters);
        session.setAttribute(__J_POST, formParameters);

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

MultiMap map = new MultiMap();
  context.setAttribute(CLASS_INHERITANCE_MAP, map);
  _classInheritanceHandler = new ClassInheritanceHandler(map);
    if (LOG.isDebugEnabled()) LOG.debug("Registering annotation handler for "+c.getName());
if (LOG.isDebugEnabled()) LOG.debug("No classes in HandlesTypes on initializer "+service.getClass());

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

MultiMap<String> parameters = new MultiMap<>();
UrlEncoded.decodeTo(query,parameters, StringUtil.__UTF8_CHARSET,-1); //have to assume UTF-8 because we can't know otherwise
  extractParameters();
if (_parameters != null && _parameters.size() > 0)
  merge_old_query = parameters.addAllValues(_parameters);
    MultiMap<String> overridden_old_query = new MultiMap<>();
    UrlEncoded.decodeTo(_queryString,overridden_old_query,getQueryEncoding(),-1);//decode using any queryencoding set for the request
    MultiMap<String> overridden_new_query = new MultiMap<>();
    UrlEncoded.decodeTo(query,overridden_new_query,StringUtil.__UTF8_CHARSET,-1); //have to assume utf8 as we cannot know otherwise
    for(String name: overridden_old_query.keySet())
      if (!overridden_new_query.containsKey(name))
        List<String> values = overridden_old_query.get(name);
        for(String v: values)
setParameters(parameters);
setQueryString(query);

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public void handle(String className, int version, int access, String signature, String superName, String[] interfaces)
{
  try
  {
    for (int i=0; interfaces != null && i<interfaces.length;i++)
    {
      _inheritanceMap.add (interfaces[i], className);
    }
    //To save memory, we don't record classes that only extend Object, as that can be assumed
    if (!"java.lang.Object".equals(superName))
      _inheritanceMap.add(superName, className);
  }
  catch (Exception e)
  {
    LOG.warn(e);
  }  
}

相关文章