コード例 #1
0
ファイル: NettyHttpRequest.java プロジェクト: poston/XServer
 public Object getAttachment(String key) {
   if (StringUtil.isEmpty(key)) {
     return null;
   }
   if (attachments == null) {
     return null;
   } else {
     return attachments.get(key);
   }
 }
コード例 #2
0
ファイル: NettyHttpRequest.java プロジェクト: poston/XServer
  /**
   * Grain the request string array parameter by key
   *
   * @param key request parameter
   * @param split split string
   * @return string array by split the value that get by key
   */
  public String[] getParameterStringArray(String key, String split) {
    String value = getParameter(key);
    if (StringUtil.isEmpty(value)) {
      throw new IllegalArgumentException(
          "The parameter ["
              + key
              + "] 's value should not be null, interface should be contain the value.");
    }

    String[] values = value.split(split);
    return values;
  }
コード例 #3
0
ファイル: NettyHttpRequest.java プロジェクト: poston/XServer
  /**
   * Get the request parameter value by key
   *
   * @param key the request parameter key
   * @return the request parameter value
   */
  @Override
  public String getParameter(String key) {
    if (StringUtil.isEmpty(key)) {
      throw new IllegalArgumentException("Argument should not be null or empty.");
    }

    List<String> value = getParameters().get(key);
    if (value == null) {
      return null;
    }

    return value.get(0);
  }