SpringBoot取出信息
Posted ParamousGIS
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot取出信息相关的知识,希望对你有一定的参考价值。
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 + " --> "); }
以上是关于SpringBoot取出信息的主要内容,如果未能解决你的问题,请参考以下文章
SpringBoot+SpringCloud实现登录用户信息在微服务之间的传递
SpringBoot+SpringCloud实现登录用户信息在微服务之间的传递
SpringBoot启动报错“Consider defining a bean of type ‘xxx.mapper.UserMapper‘ in your configuration.“(代码片段
全栈编程系列SpringBoot整合Shiro(含KickoutSessionControlFilter并发在线人数控制以及不生效问题配置启动异常No SecurityManager...)(代码片段
SpringBoot中表单提交报错“Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported“(代码片段