javax.servlet.http.HttpServlet.doPut()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(196)

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

HttpServlet.doPut介绍

[英]Called by the server (via the service method) to allow a servlet to handle a PUT request. The PUT operation allows a client to place a file on the server and is similar to sending a file by FTP.

When overriding this method, leave intact any content headers sent with the request (including Content-Length, Content-Type, Content-Transfer-Encoding, Content-Encoding, Content-Base, Content-Language, Content-Location, Content-MD5, and Content-Range). If your method cannot handle a content header, it must issue an error message (HTTP 501 - Not Implemented) and discard the request. For more information on HTTP 1.1, see RFC 2616 .

This method does not need to be either safe or idempotent. Operations that doPut performs can have side effects for which the user can be held accountable. When using this method, it may be useful to save a copy of the affected URL in temporary storage.

If the HTTP PUT request is incorrectly formatted, doPut returns an HTTP "Bad Request" message.
[中]由服务器调用(通过service方法),以允许servlet处理PUT请求。PUT操作允许客户端在服务器上放置文件,类似于通过FTP发送文件。
重写此方法时,保留随请求发送的所有内容头(包括内容长度、内容类型、内容传输编码、内容编码、内容库、内容语言、内容位置、content-MD5和内容范围)不变。如果您的方法无法处理内容头,则必须发出错误消息(HTTP 501-未实现)并放弃请求。有关HTTP1.1的更多信息,请参阅RFC2616
此方法不需要是安全的或幂等的。doPut执行的操作可能会产生副作用,用户需要对此负责。使用此方法时,将受影响URL的副本保存在临时存储器中可能很有用。
如果HTTP PUT请求的格式不正确,doPut将返回HTTP“错误请求”消息。

代码示例

代码示例来源:origin: javax.servlet/servlet-api

doPut(req, resp);

代码示例来源:origin: org.apache.geronimo.specs/geronimo-servlet_3.0_spec

doPut(req, resp);

代码示例来源:origin: org.jboss.spec.javax.servlet/jboss-servlet-api_3.0_spec

doPut(req, resp);

代码示例来源:origin: com.bbossgroups/bboss-mvc

@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
  // TODO Auto-generated method stub
  super.doPut(req, resp);
}

代码示例来源:origin: errai/errai

@Override
protected final void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 super.doPut(req, resp);
}

代码示例来源:origin: org.jboss.as/jboss-as-websockets

@Override
protected final void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 super.doPut(req, resp);
}

代码示例来源:origin: mikebrock/jboss-websockets

@Override
protected final void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 super.doPut(req, resp);
}

代码示例来源:origin: com.helger/ph-webscopes

/**
 * Implement HTTP PUT
 *
 * @param aHttpRequest
 *        The original HTTP request. Never <code>null</code>.
 * @param aHttpResponse
 *        The original HTTP response. Never <code>null</code>.
 * @param aRequestScope
 *        The request scope to be used. Never <code>null</code>.
 * @throws ServletException
 *         In case of an error.
 * @throws IOException
 *         In case of an error.
 */
@OverrideOnDemand
protected void onPut (@Nonnull final HttpServletRequest aHttpRequest,
           @Nonnull final HttpServletResponse aHttpResponse,
           @Nonnull final IRequestWebScope aRequestScope) throws ServletException, IOException
{
 super.doPut (aHttpRequest, aHttpResponse);
}

代码示例来源:origin: yangfuhai/jboot

@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  switch (req.getDispatcherType()) {
    case INCLUDE:
    case FORWARD:
    case ERROR:
      doGet(req, resp);
      break;
    default:
      super.doPut(req, resp);
  }
}

代码示例来源:origin: io.undertow/undertow-servlet

@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  switch (req.getDispatcherType()) {
    case INCLUDE:
    case FORWARD:
    case ERROR:
      doGet(req, resp);
      break;
    default:
      super.doPut(req, resp);
  }
}

代码示例来源:origin: org.jvnet.hudson.winstone/winstone

doPost(request, response);
else if (method.equals(METHOD_PUT))
  doPut(request, response);
else if (method.equals(METHOD_DELETE))
  doDelete(request, response);

代码示例来源:origin: com.caucho/javaee-16

doPut(req, res);

代码示例来源:origin: org.apache.geronimo.specs/geronimo-servlet_2.5_spec

doPut(req, resp);

代码示例来源:origin: javax/javaee-web-api

doPut(req, resp);

代码示例来源:origin: org.apache.openejb/javaee-api

doPut(req, resp);

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

doPut(req, resp);

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

doPut(req, resp);

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

doPut(req, resp);

代码示例来源:origin: codefollower/Tomcat-Research

doPut(req, resp);

代码示例来源:origin: org.apache.meecrowave/meecrowave-specs-api

doPut(req, resp);

相关文章