org.glassfish.grizzly.http.server.Request.getParameter()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(159)

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

Request.getParameter介绍

[英]Return the value of the specified request parameter, if any; otherwise, return null. If there is more than one value defined, return only the first one.
[中]返回指定请求参数的值(如果有);否则,返回null。如果定义了多个值,则只返回第一个值。

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

public OTPRequest (Request req, Graph graph) {
  this.graph = graph;
  for (String key : req.getParameterNames()) {
    params.put(key, req.getParameter(key));
  }
  String path = req.getPathInfo();
  sfmt = SerializeFormat.JSON;
  if (req.getHeader("Accept").contains("application/xml")) {
    sfmt = SerializeFormat.XML;
  }
  if (req.getHeader("Accept").contains("application/json")) {
    sfmt = SerializeFormat.JSON;
  }
  if (path.endsWith(".xml")) {
    path = path.substring(0, path.length() - 4);
    sfmt = SerializeFormat.XML;
  };
  if (path.endsWith(".json")) {
    path = path.substring(0, path.length() - 5);
    sfmt = SerializeFormat.JSON;
  };
  parts = path.split("/");
  // path always begins with a slash, so part 0 is empty
  if (parts.length > 1) action = parts[1];
  if (parts.length > 2) id = parts[2];
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
  public String run() {
    return request.getParameter(name);
  }           
}

代码示例来源:origin: javaee/grizzly

@Override
  public String run() {
    return request.getParameter(name);
  }           
}

代码示例来源:origin: javaee/grizzly

@Override
  public String run() {
    return request.getParameter(name);
  }           
}

代码示例来源:origin: javaee/grizzly

@Override
  public String run() {
    return request.getParameter(name);
  }           
}

代码示例来源:origin: javaee/grizzly

@Override
  public String run() {
    return request.getParameter(name);
  }           
}

代码示例来源:origin: javaee/grizzly

@Override
  public String run() {
    return request.getParameter(name);
  }           
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public String getParameter(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  if (System.getSecurityManager() != null){
    return AccessController.doPrivileged(
      new GetParameterPrivilegedAction(name));
  } else {
    return request.getParameter(name);
  }
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public String getParameter(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  if (System.getSecurityManager() != null){
    return AccessController.doPrivileged(
      new GetParameterPrivilegedAction(name));
  } else {
    return request.getParameter(name);
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

/**
   * Return the value of the specified request parameter, if any; otherwise,
   * return <code>null</code>.  If there is more than one value defined,
   * return only the first one.
   *
   * @param name Name of the desired request parameter
   */
  @Override
  public String getParameter(String name) {

/*
    if (!requestParametersParsed) {
      parseRequestParameters();
    }
*/
    processParameters();

    return coyoteRequest.getParameter(name);
  }

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public String getParameter(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  if (System.getSecurityManager() != null){
    return AccessController.doPrivileged(
      new GetParameterPrivilegedAction(name));
  } else {
    return request.getParameter(name);
  }
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public String getParameter(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  if (System.getSecurityManager() != null){
    return AccessController.doPrivileged(
      new GetParameterPrivilegedAction(name));
  } else {
    return request.getParameter(name);
  }
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public String getParameter(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  if (System.getSecurityManager() != null){
    return AccessController.doPrivileged(
      new GetParameterPrivilegedAction(name));
  } else {
    return request.getParameter(name);
  }
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public String getParameter(String name) {
  if (request == null) {
    throw new IllegalStateException("Null request object");
  }
  if (System.getSecurityManager() != null){
    return AccessController.doPrivileged(
      new GetParameterPrivilegedAction(name));
  } else {
    return request.getParameter(name);
  }
}

代码示例来源:origin: dhfbk/tint

@Override
  public void service(Request request, Response response) throws Exception {

    request.setCharacterEncoding("UTF-8");

    Buffer postBody = request.getPostBody(1024);
    String text = postBody.toStringContent();

    if (request.getParameter("text") != null) {
      text = request.getParameter("text");
    }

    String outputFormat = request.getParameter("format");

    InputStream inputStream = new ByteArrayInputStream(text.getBytes());
    OutputStream outputStream = new ByteArrayOutputStream();

    TintRunner.OutputFormat format = TintRunner.getOutputFormat(outputFormat, TintRunner.OutputFormat.JSON);
    pipeline.run(inputStream, outputStream, format);

    LOGGER.debug("Text: {}", text);

    String output = outputStream.toString();

    writeOutput(response, contentTypes.get(format), output);
  }
}

相关文章

Request类方法