Git Product home page Git Product logo

rxjava_mvp_retrofit's Introduction

Rxjava_MVP_Retrofit

##一个小demo,RxJava MVP Retrofit 混合

HTTP 协议

请求

- version
	- http/1
	- http/1.1
	- http/2

-URL

	- protocol                   http
	- 分隔符 ://                 ://
	- domain                     apen.vpaidian.com
	- path                       /username/
	- query                      ?_n=star & _otype=list
	- 锚记                       #xxx

-METHOD

	POST

	- POST 可以有body
	- GET 不可以有body
	- DELETE 不可以有body
	- PUT 可以有body
	- ... 

-HEADER

	请求头
	键值对形式, 键可以重复,所以是  Map<String, ArrayList<String>>
	
		Content-Type: application/x-www-form-urlencoded
		Content-Length: 19
		_v: 1.0
		_r: android
		_username: 1523956
		_password: 000000

-BODY

	理论上是不限制任何内容的,但是主流有以下几种,一般body的内容会在header中的content-type进行描述
	
	- form-data
		表单, 最强大的规约,不细说了,有点深, retrofit中为 Multipart
	- x-www-form-urlencoded
		我理解为简单表单,只能包含字符串键值对, retrofit中为 FormUrlEncoded
	- raw
		二进制(文件)
	- binary
		二进制(文件)

响应

/*
服务器可以拿的参数(不限于以下几种):
	URL.path,
	URL.query,
	URL.锚记
	Header.XXX
	Body.N种类型
 */


--> POST http://api.vpaidian.com/?_n=unit.star&_otype=list http/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 19
_v: 1.0
_r: android
_username: 1523698
_password: 000000
pageid=1&pagesiz=20
--> END POST (19-byte body)
<-- 200 OK http://apen.vpaidian.com/?_n=star&_otype=list (20ms)
Date: Thu, 22 Jun 2017 11:29:13 GMT
Server: Apache/2.4.10 (Win32) OpenSSL/0.9.8zb mod_fcgid/2.3.9
X-Powered-By: PHP/5.4.33
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
{"rs":false,"mess":{"data":{"errorInfo":["<div>\u4f60\u9700\u8981\u63d0\u4f9bAPI\u7248\u672c\u53c2\u6570(_v)!			<\/div>"]}}}
<-- END HTTP (121-byte body)

rxjava_mvp_retrofit's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.