Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

封装联网工具类遇到的问题集合 #9

Closed
youxiho1 opened this issue Nov 2, 2019 · 1 comment
Closed

封装联网工具类遇到的问题集合 #9

youxiho1 opened this issue Nov 2, 2019 · 1 comment
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested
Milestone

Comments

@youxiho1
Copy link
Contributor

youxiho1 commented Nov 2, 2019

这次的联网工具类叫啥好呢(笑)
实现联网工具类遇到了相当多的问题,目前还有好几个没解决,HELP WANTED

  1. 我们是不是应该提供同步的请求和异步的请求两套请求函数?这样的话,最少就是同步get,同步post,异步get,异步post四个函数,如果后续使用put和delete方法的话,就还需要再添加同步put,同步delete,异步put,异步delete?

  2. 目前同步的get方法和同步的post方法我把之前的工具类(FlowerHttp)改造了一下,已经实现了;在实现异步的get方法和异步的post方法的时候遇到了非常多的问题,感觉目前遇到的情况是互相冲突的……既然要实现封装,就必然要返回一个String类型的对象,但是我在测试中发现这样做是行不通的……函数返回值填String,如果函数是异步的,就不会等待那个response,然后就会返回一个空的字符串;我还尝试着封装更高级的线程,封装更高级的Callback也失败了啊啊啊!!!这两周学了超级多的Callback之类的内容,然而还是没解决这个问题啊啊
    不知道说明白没啊,没说明白可以站立会议的时候再和你们说明一下这个问题……

  3. 写issue时突然又想起来,是不是还应该在封装时提供一些超时时间比较长的方法?比如说一般的都是3s超时,再额外提供一个10s超时的?或者是这个超时时间我们作为方法的一个参数传入?

尤其是这个第二点
很令人头秃啊--||
谁来救救我啊-
-||
不行了orz
orzorzorz

@youxiho1 youxiho1 added bug Something isn't working help wanted Extra attention is needed question Further information is requested labels Nov 2, 2019
@youxiho1 youxiho1 added this to the 第六七周 milestone Nov 2, 2019
@youxiho1
Copy link
Contributor Author

youxiho1 commented Dec 8, 2019

经过多次讨论与尝试,我们最终使用Callback完成了这一封装,详情参见代码内

@youxiho1 youxiho1 closed this as completed Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants