-
大小: 52KB文件类型: .rar金币: 1下载: 0 次发布日期: 2021-06-02
- 语言: Java
- 标签: SpringBoot okhttp3
资源简介
SpringBoot OkHttp3,里面包含了各种测试代码,其中包含了get,post,文件上传等测试
代码片段和文件信息
package cn.ok.http.controller;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import cn.ok.http.utils.FileUtil;
@RestController
@RequestMapping(“/okHttp“)
public class OkHttpController {
@RequestMapping(value = “/request“ method = { RequestMethod.GET RequestMethod.POST })
public String request() {
return “index/index“;
}
@RequestMapping(value = “requestWithHeaders“method = { RequestMethod.GET RequestMethod.POST } )
String requestWithHeaders(@RequestHeader(value = “authorization_token“ required = true) String token
@RequestHeader(value = “mac_address“ required = true) String macAddress) {
return String.format(“authorization_token is %s mac_address is %s“ token macAddress);
}
@RequestMapping(value = “/requestWithParams“method = { RequestMethod.GETRequestMethod.POST } )
String requestWithParams(@RequestParam(value = “userName“ required = true) String paramNameUser
@RequestParam(value = “userAge“ required = true) int paramAge) {
return String.format(“paramNameUser is %s paramAge is %s“ paramNameUser paramAge);
}
@RequestMapping(value = “/requestWithHeadersAndParams“method = { RequestMethod.GETRequestMethod.POST } )
String requestWithHeadersAndParams( @RequestParam(value = “userName“ required = true) String paramNameUser
@RequestParam(value = “userAge“ required = true) int paramAge
@RequestHeader(value = “authorization_token“ required = true) String token
@RequestHeader(value = “mac_address“ required = true) String macAddress
) {
return String.format(“paramNameUser is %s paramAge is %sauthorization_token is %smac_address is %s“ paramNameUser paramAgetokenmacAddress);
}
@RequestMapping(value = “/queryByByJson“method = { RequestMethod.POST } )
public object queryByTipper(@RequestBody Map request) {
return request;
}
@RequestMapping(value = “/sessionLogin“ method = RequestMethod.POST)
public object sessionLogin (String userNameString passWord HttpServletRequest request){
Map user = new HashMap();
user.put(“userName“userNa
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 624 2019-02-21 14:34 okHttp\.idea\compiler.xm
文件 172 2019-02-21 14:34 okHttp\.idea\encodings.xm
文件 568 2019-02-21 14:34 okHttp\.idea\libraries\Maven__ch_qos_logback_logback_classic_1_1_9.xm
文件 547 2019-02-21 14:34 okHttp\.idea\libraries\Maven__ch_qos_logback_logback_core_1_1_9.xm
文件 525 2019-02-21 14:40 okHttp\.idea\libraries\Maven__commons_lang_commons_lang_2_6.xm
文件 507 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_alibaba_fastjson_1_2_4.xm
文件 522 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_fasterxm
文件 644 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_fasterxm
文件 595 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_fasterxm
文件 623 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_fasterxm
文件 499 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_google_guava_guava_18_0.xm
文件 546 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_jayway_jsonpath_json_path_2_2_0.xm
文件 536 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_squareup_okhttp3_okhttp_3_13_1.xm
文件 510 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_squareup_okio_okio_1_17_2.xm
文件 700 2019-02-21 14:34 okHttp\.idea\libraries\Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xm
文件 553 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_springfox_springfox_core_2_6_1.xm
文件 567 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_springfox_springfox_schema_2_6_1.xm
文件 546 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_springfox_springfox_spi_2_6_1.xm
文件 595 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_springfox_springfox_spring_web_2_6_1.xm
文件 581 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_springfox_springfox_swagger2_2_6_1.xm
文件 623 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_springfox_springfox_swagger_common_2_6_1.xm
文件 595 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_springfox_springfox_swagger_ui_2_6_1.xm
文件 587 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_swagger_swagger_annotations_1_5_10.xm
文件 552 2019-02-21 14:34 okHttp\.idea\libraries\Maven__io_swagger_swagger_models_1_5_10.xm
文件 578 2019-02-21 14:34 okHttp\.idea\libraries\Maven__javax_servlet_javax_servlet_api_3_1_0.xm
文件 473 2019-02-21 14:34 okHttp\.idea\libraries\Maven__javax_servlet_jstl_1_2.xm
文件 611 2019-02-21 14:34 okHttp\.idea\libraries\Maven__javax_validation_validation_api_1_1_0_Final.xm
文件 455 2019-02-21 14:34 okHttp\.idea\libraries\Maven__junit_junit_4_12.xm
文件 542 2019-02-21 14:34 okHttp\.idea\libraries\Maven__net_minidev_accessors_smart_1_1.xm
文件 521 2019-02-21 14:34 okHttp\.idea\libraries\Maven__net_minidev_json_smart_2_2_1.xm
............此处省略91个文件信息
- 上一篇:java验证码
- 下一篇:官方kettle最新8.2百度云
相关资源
- SpringBoot与Shiro整合-权限管理实战视频
- 2019基于SpringBoot和SpringCloud实现微服务
- Springboot+mybatis+mysql+redis
- springboot StringRedisTemplate redis工具类
- 微信小程序支付demo后端(springboot)
- idea+springboot+mybatis+jsp+bootstrap实现从
- SpringBoot实战
- okhttp3.8.0-jdk1.6.zip
- eclipse整合springboot+mybatis项目demo
- 尚硅谷2018最新SpringBoot 上下 核心技术
- springboot 业务插件demo
- SpringBoot+Echarts
- FreeMarker+SpringBoot模板引擎demo
- SpringBoot实现Socket.io消息推送(java+h
- springboot-1.5.1.RELEASE.jar
- rabbitmq:基于java、基于springboot、基于
- gradle+springboot+mysql+mybatis+thymeleaf开发的
- springboot 整合mina 源码,nio通讯基础教
- java 微信小程序 文件上传
- OKHttp3 所有Jarb包
- java springboot 切割分片上传大文件
- SpringBoot实战教程好评如潮58集
- JavaEE就业webSSHSSMJava仿在线教育网站
- 廖师兄的springboot项目视频
- 传智播客SpringBoot视频+代码+笔记
- 2019Java微服务架构(SpringBoot+SpringClo
- GB28181国标28181的JAVA注册实现代码
- mybatis-spring-boot-starter-2.0.0.jar
- 小马哥Java微服务实践-SpringbootSpringC
- SpringBoot实战(第4版)
评论
共有 条评论