org.simpleframework.http.Response.addValue()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(139)

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

Response.addValue介绍

暂无

代码示例

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

@Override
public OutputStream writeResponseStatusAndHeaders(final long contentLength,
                         final ContainerResponse context) throws ContainerException {
  final javax.ws.rs.core.Response.StatusType statusInfo = context.getStatusInfo();
  final int code = statusInfo.getStatusCode();
  final String reason = statusInfo.getReasonPhrase() == null
      ? Status.getDescription(code)
      : statusInfo.getReasonPhrase();
  response.setCode(code);
  response.setDescription(reason);
  if (contentLength != -1) {
    response.setContentLength(contentLength);
  }
  for (final Map.Entry<String, List<String>> e : context.getStringHeaders().entrySet()) {
    for (final String value : e.getValue()) {
      response.addValue(e.getKey(), value);
    }
  }
  try {
    return response.getOutputStream();
  } catch (final IOException ioe) {
    throw new ContainerException("Error during writing out the response headers.", ioe);
  }
}

代码示例来源:origin: ngallagher/simpleframework

/**
* This can be used to add a HTTP message header to this object.
* The name and value of the HTTP message header will be used to
* create a HTTP message header object which can be retrieved using
* the <code>getValue</code> in combination with the get methods.
*
* @param name the name of the HTTP message header to be added
* @param value the value the HTTP message header will have
*/   
public void addValue(String name, String value) {
 response.addValue(name, value);
}

代码示例来源:origin: org.simpleframework/simple-http

/**
* This can be used to add a HTTP message header to this object.
* The name and value of the HTTP message header will be used to
* create a HTTP message header object which can be retrieved using
* the <code>getValue</code> in combination with the get methods.
*
* @param name the name of the HTTP message header to be added
* @param value the value the HTTP message header will have
*/   
public void addValue(String name, String value) {
 response.addValue(name, value);
}

代码示例来源:origin: org.simpleframework/simple

/**
* This can be used to add a HTTP message header to this object.
* The name and value of the HTTP message header will be used to
* create a HTTP message header object which can be retrieved using
* the <code>getValue</code> in combination with the get methods.
*
* @param name the name of the HTTP message header to be added
* @param value the value the HTTP message header will have
*/   
public void addValue(String name, String value) {
 response.addValue(name, value);
}

代码示例来源:origin: lantunes/fixd

public void addHeader(String name, String value) {
  response.addValue(name, value);
}

代码示例来源:origin: opendedup/sdfs

private void downloadFile(File f, Request request, Response response) throws IOException {
  if (f.exists()) {
    response.setContentType("application/octet-stream");
    response.addValue("Server", "SDFS Management Server");
    response.setContentLength(f.length());
    InputStream in = new FileInputStream(f);
    OutputStream out = response.getOutputStream();
    byte[] buf = new byte[32768];
    int len;
    while ((len = in.read(buf)) > 0) {
      out.write(buf, 0, len);
    }
    out.flush();
    in.close();
    out.close();
  } else {
    response.setCode(404);
    PrintStream body = response.getPrintStream();
    body.println("could not find " + f.getPath());
    body.close();
    SDFSLogger.getLog().warn("unable to find " + f.getPath());
  }
}

代码示例来源:origin: opendedup/sdfs

rsp.addValue("Server", "SDFS Management Server");
rsp.setDate("Date", time);
rsp.setDate("Last-Modified", time);

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-simple-http

@Override
public OutputStream writeResponseStatusAndHeaders(final long contentLength,
                         final ContainerResponse context) throws ContainerException {
  final javax.ws.rs.core.Response.StatusType statusInfo = context.getStatusInfo();
  final int code = statusInfo.getStatusCode();
  final String reason = statusInfo.getReasonPhrase() == null
      ? Status.getDescription(code)
      : statusInfo.getReasonPhrase();
  response.setCode(code);
  response.setDescription(reason);
  if (contentLength != -1) {
    response.setContentLength(contentLength);
  }
  for (final Map.Entry<String, List<String>> e : context.getStringHeaders().entrySet()) {
    for (final String value : e.getValue()) {
      response.addValue(e.getKey(), value);
    }
  }
  try {
    return response.getOutputStream();
  } catch (final IOException ioe) {
    throw new ContainerException("Error during writing out the response headers.", ioe);
  }
}

代码示例来源:origin: opendedup/sdfs

long time = System.currentTimeMillis();
response.setContentType("application/x-gtar");
response.addValue("Server", "SDFS Management Server");
response.setDate("Date", time);
response.setDate("Last-Modified", time);

代码示例来源:origin: lantunes/fixd

resolved.handler.headers();
for (SimpleImmutableEntry<String, String> header : headers) {
  response.addValue(header.getKey(), header.getValue());

相关文章