1.打印头信息

@RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody
public List<UploadResult> upload(@RequestParam(name = "files", required = true) MultipartFile[] multipartFiles,
@RequestHeader HttpHeaders httpHeaders,
@RequestHeader(name = "content-range", required = false) String contentRange,
@RequestHeader(name = "content-disposition", required = false) String contentDisposition,
@RequestHeader(name = "Block-Index", required = false) Integer blockIndex,
@RequestHeader(name = "Block-Total", required = false) Integer blockTotal,
@RequestHeader(name = "Block-Done", required = false) String blockDone )
System.out.println("-----------------------------------------------------------");
Iterator<String> headerNames = httpHeaders.keySet().iterator();
while (headerNames.hasNext()) {
String key = headerNames.next();
List<String> valueList = httpHeaders.getValuesAsList(key);
String valueStr = "";
for (String value : valueList) {
valueStr += "|" + value;
}
System.out.println(key + " --> " + valueStr);
}
System.out.println("-----------------------------------------------------------");
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String key = headerNames.nextElement();
String value = request.getHeader(key);
System.out.println(key + " --> " + value);
}

2.打印form参数

Map<String, String[]> parameterMap = request.getParameterMap();
Iterator<Entry<String, String[]>> iterator = parameterMap.entrySet().iterator();
System.out.println("--form--------------------------");
while (iterator.hasNext()) {
Entry<String, String[]> keyValues = iterator.next();
String key = keyValues.getKey();
String[] values = keyValues.getValue();
System.out.println("--form--------------------------" + key + " --> ");
}

3.打印上传文件

System.out.println("-------------------getParts---------------");
Collection<Part> parts = multipartRequest.getParts();
for(Part part: parts) {
String name = part.getName();
String contentType = part.getContentType();
if(contentType == null) {
InputStream inputStream = part.getInputStream();
int length = inputStream.available();
byte[] bytes = new byte[length];
int len = inputStream.read(bytes);
String value = new String(bytes, "utf-8");
System.out.println(name + " --> " + contentType + " --> " + len + " --> " + value );
} }
System.out.println("-------------------getParts---------------");

SpringBoot取出信息的更多相关文章

  1. SpringBoot配置分析、获取到SpringBoot配置文件信息以及几种获取配置文件信息的方式

    Spring入门篇:https://www.cnblogs.com/biehongli/p/10170241.html SpringBoot的默认的配置文件application.properties ...

  2. 基于Docker+Prometheus+Grafana监控SpringBoot健康信息

    在微服务体系当中,监控是必不可少的.当系统环境超过指定的阀值以后,需要提醒指定的运维人员或开发人员进行有效的防范,从而降低系统宕机的风险.在CNCF云计算平台中,Prometheus+Grafana是 ...

  3. Springboot国际化信息(i18n)解析

    国际化信息理解 国际化信息也称为本地化信息 . Java 通过 java.util.Locale 类来表示本地化对象,它通过 “语言类型” 和 “国家/地区” 来创建一个确定的本地化对象 .举个例子吧 ...

  4. SpringBoot日记——信息修改PUT篇

    我们常用的功能,除了post和get,还有put和delete,这篇文章就介绍一下这个put的基本用法. 页面跳转和回显 1. 首先,我们之前的页面已经将添加和修改的按钮都做好了,那么如何实现这些按钮 ...

  5. SpringBoot错误信息总结(不定时更新)

    1." java.lang.IllegalStateException: @Bean method ShiroConfig.cacheManager called as a bean ref ...

  6. spring-boot启动信息中non-fatal error

    java.lang.ClassNotFoundException: org.springframework.data.web.config.EnableSpringDataWebSupport缺少依赖 ...

  7. (转)springBoot 配置信息一览

    原文链接:https://cloud.tencent.com/developer/article/1360699

  8. xmpp整理笔记:发送图片信息和声音信息

    图片和音频文件发送的基本思路就是: 先将图片转化成二进制文件,然后将二进制文件进行base64编码,编码后成字符串.在即将发送的message内添加一个子节点,节点的stringValue(节点的值) ...

  9. PHP实现简单的学生信息管理系统(web版)

    (∩_∩) 1.概述 学了php的一些基础,包括HTML,php,pdo,mysql操作等,一直都没有将它们有机结合.最近写了一个简单的网页版学生信息管理系统,前台用HTML,脚本用到了JavaScr ...

随机推荐

  1. MySQL [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause

    MySQL[Err]1055 上次MySQL5.7.19主从建立完成之后,所有的测试都是在MySQL命令行下进行的,最近用Navicat Premium进行MySQL的连接,然后在插入数据的时候MyS ...

  2. IDEA快捷键整理

                                                                              IDEA快捷键整理 一.修改快捷键方法: 点击 Fi ...

  3. ubuntu 16.04下使用 python pip的安装问题。

    ubuntu 16.04使用 pip安装软件时,不知道为什么不能使用sudo pip install XXX 需要使用的是:python -m pip install XXX才可以.

  4. 机器学习技法笔记:14 Radial Basis Function Network

    Roadmap RBF Network Hypothesis RBF Network Learning k-Means Algorithm k-Means and RBF Network in Act ...

  5. laravel5.5 __construct函数 无法使用session() 解决方法和实例

    从网上查询资料得知,在laravel中使用__construct方法的时候,session还没开启,此时就需要用到中间件来解决. $this->middleware(function ($req ...

  6. cannot download, /home/azhukov/go is a GOROOT, not a GOPATH

    问题详情: go环境安装好后,运行go代码也没有问题 下载govendor包的时候提示: cannot download, /home/azhukov/go is a GOROOT, not a GO ...

  7. Python -- tabulate 模块,

    pip install tabulate >>> from tabulate import tabulate >>> table = [["Sun&quo ...

  8. xml与Excel转换

    使用Python将如下xml格式转换为Excel格式: xml转为xls格式文件: xml格式如下: <?xml version="1.0" encoding="U ...

  9. postgresql 获取修改列的值

    使用returning CREATE TABLE users (firstname text, lastname text, id serial primary key); INSERT INTO u ...

  10. Docker 本地导入镜像/保存镜像/载入镜像/删除镜像

    1.Docker导入本地镜像 有时候我们自己在本地或者其它小伙伴电脑上拷贝了一份镜像,有了这个镜像之后,我们可以把本地的镜像导入,使用docker import 命令. 例如这里下载了一个 aliba ...