Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
MVPArms
提交
6042eba9
M
MVPArms
项目概览
门心叼龙
/
MVPArms
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
MVPArms
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6042eba9
编写于
1月 31, 2018
作者:
J
jessyan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move RequestInterceptor to http.log
上级
4bc075bd
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
13 addition
and
12 deletion
+13
-12
app/src/main/java/me/jessyan/mvparms/demo/app/GlobalConfiguration.java
...java/me/jessyan/mvparms/demo/app/GlobalConfiguration.java
+1
-1
app/src/main/java/me/jessyan/mvparms/demo/app/GlobalHttpHandlerImpl.java
...va/me/jessyan/mvparms/demo/app/GlobalHttpHandlerImpl.java
+1
-1
arms/src/main/java/com/jess/arms/di/module/ClientModule.java
arms/src/main/java/com/jess/arms/di/module/ClientModule.java
+1
-1
arms/src/main/java/com/jess/arms/di/module/GlobalConfigModule.java
...main/java/com/jess/arms/di/module/GlobalConfigModule.java
+1
-1
arms/src/main/java/com/jess/arms/http/log/DefaultFormatPrinter.java
...ain/java/com/jess/arms/http/log/DefaultFormatPrinter.java
+3
-3
arms/src/main/java/com/jess/arms/http/log/RequestInterceptor.java
.../main/java/com/jess/arms/http/log/RequestInterceptor.java
+6
-5
未找到文件。
app/src/main/java/me/jessyan/mvparms/demo/app/GlobalConfiguration.java
浏览文件 @
6042eba9
...
...
@@ -23,7 +23,7 @@ import android.support.v4.app.FragmentManager;
import
com.jess.arms.base.delegate.AppLifecycles
;
import
com.jess.arms.di.module.GlobalConfigModule
;
import
com.jess.arms.http.RequestInterceptor
;
import
com.jess.arms.http.
log.
RequestInterceptor
;
import
com.jess.arms.integration.ConfigModule
;
import
com.jess.arms.utils.ArmsUtils
;
import
com.squareup.leakcanary.RefWatcher
;
...
...
app/src/main/java/me/jessyan/mvparms/demo/app/GlobalHttpHandlerImpl.java
浏览文件 @
6042eba9
...
...
@@ -20,7 +20,7 @@ import android.text.TextUtils;
import
com.google.gson.reflect.TypeToken
;
import
com.jess.arms.http.GlobalHttpHandler
;
import
com.jess.arms.http.RequestInterceptor
;
import
com.jess.arms.http.
log.
RequestInterceptor
;
import
com.jess.arms.utils.ArmsUtils
;
import
java.util.List
;
...
...
arms/src/main/java/com/jess/arms/di/module/ClientModule.java
浏览文件 @
6042eba9
...
...
@@ -21,7 +21,7 @@ import android.support.annotation.Nullable;
import
com.google.gson.Gson
;
import
com.jess.arms.http.GlobalHttpHandler
;
import
com.jess.arms.http.RequestInterceptor
;
import
com.jess.arms.http.
log.
RequestInterceptor
;
import
com.jess.arms.utils.DataHelper
;
import
java.io.File
;
...
...
arms/src/main/java/com/jess/arms/di/module/GlobalConfigModule.java
浏览文件 @
6042eba9
...
...
@@ -23,7 +23,7 @@ import android.text.TextUtils;
import
com.bumptech.glide.Glide
;
import
com.jess.arms.http.BaseUrl
;
import
com.jess.arms.http.GlobalHttpHandler
;
import
com.jess.arms.http.RequestInterceptor
;
import
com.jess.arms.http.
log.
RequestInterceptor
;
import
com.jess.arms.http.imageloader.BaseImageLoaderStrategy
;
import
com.jess.arms.http.imageloader.glide.GlideImageLoaderStrategy
;
import
com.jess.arms.integration.cache.Cache
;
...
...
arms/src/main/java/com/jess/arms/http/FormatPrinter.java
→
arms/src/main/java/com/jess/arms/http/
log/Default
FormatPrinter.java
浏览文件 @
6042eba9
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
com.jess.arms.http
;
package
com.jess.arms.http
.log
;
import
android.text.TextUtils
;
...
...
@@ -33,7 +33,7 @@ import timber.log.Timber;
* ================================================
*/
public
class
FormatPrinter
{
public
class
Default
FormatPrinter
{
private
static
final
String
TAG
=
"ArmsHttpLog"
;
private
static
final
String
LINE_SEPARATOR
=
System
.
getProperty
(
"line.separator"
);
private
static
final
String
DOUBLE_SEPARATOR
=
LINE_SEPARATOR
+
LINE_SEPARATOR
;
...
...
@@ -57,7 +57,7 @@ public class FormatPrinter {
private
static
final
String
CENTER_LINE
=
"├ "
;
private
static
final
String
DEFAULT_LINE
=
"│ "
;
private
FormatPrinter
()
{
private
Default
FormatPrinter
()
{
throw
new
UnsupportedOperationException
(
"you can't instantiate me!"
);
}
...
...
arms/src/main/java/com/jess/arms/http/RequestInterceptor.java
→
arms/src/main/java/com/jess/arms/http/
log/
RequestInterceptor.java
浏览文件 @
6042eba9
...
...
@@ -13,11 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jess.arms.http
;
package
com.jess.arms.http
.log
;
import
android.support.annotation.Nullable
;
import
com.jess.arms.di.module.GlobalConfigModule
;
import
com.jess.arms.http.GlobalHttpHandler
;
import
com.jess.arms.utils.CharacterHandler
;
import
com.jess.arms.utils.ZipHelper
;
...
...
@@ -82,9 +83,9 @@ public class RequestInterceptor implements Interceptor {
if
(
logRequest
)
{
//打印请求信息
if
(
request
.
body
()
!=
null
&&
isParseable
(
request
.
body
().
contentType
()))
{
FormatPrinter
.
printJsonRequest
(
request
,
parseParams
(
request
));
Default
FormatPrinter
.
printJsonRequest
(
request
,
parseParams
(
request
));
}
else
{
FormatPrinter
.
printFileRequest
(
request
);
Default
FormatPrinter
.
printFileRequest
(
request
);
}
}
...
...
@@ -117,13 +118,13 @@ public class RequestInterceptor implements Interceptor {
final
String
url
=
originalResponse
.
request
().
url
().
toString
();
if
(
responseBody
!=
null
&&
isParseable
(
responseBody
.
contentType
()))
{
FormatPrinter
.
printJsonResponse
(
TimeUnit
.
NANOSECONDS
.
toMillis
(
t2
-
t1
),
Default
FormatPrinter
.
printJsonResponse
(
TimeUnit
.
NANOSECONDS
.
toMillis
(
t2
-
t1
),
isSuccessful
,
code
,
header
,
isJson
(
responseBody
.
contentType
())
?
CharacterHandler
.
jsonFormat
(
bodyString
)
:
isXml
(
responseBody
.
contentType
())
?
CharacterHandler
.
xmlFormat
(
bodyString
)
:
bodyString
,
segmentList
,
message
,
url
);
}
else
{
FormatPrinter
.
printFileResponse
(
TimeUnit
.
NANOSECONDS
.
toMillis
(
t2
-
t1
),
Default
FormatPrinter
.
printFileResponse
(
TimeUnit
.
NANOSECONDS
.
toMillis
(
t2
-
t1
),
isSuccessful
,
code
,
header
,
segmentList
,
message
,
url
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录