Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
3fe89e14
Commit
3fe89e14
authored
Jun 01, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
546632ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
127 deletions
+4
-127
MyHttpRequest.java
.../com/yifu/cloud/plus/v1/yifu/auth/util/MyHttpRequest.java
+0
-123
application.yml
yifu-auth/src/main/resources/application.yml
+2
-2
application.yml
yifu-upms/yifu-upms-biz/src/main/resources/application.yml
+2
-2
No files found.
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/util/MyHttpRequest.java
deleted
100644 → 0
View file @
546632ad
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
auth
.
util
;
import
com.alibaba.cloud.commons.lang.StringUtils
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.commons.codec.Charsets
;
import
javax.servlet.ReadListener
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequestWrapper
;
import
java.io.*
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author fxj *
* @date 2022年05月27日 11:01
* @description
*/
public
class
MyHttpRequest
extends
HttpServletRequestWrapper
{
private
String
body
;
public
MyHttpRequest
(
HttpServletRequest
request
)
throws
IOException
{
super
(
request
);
StringBuilder
stringBuilder
=
new
StringBuilder
();
BufferedReader
bufferedReader
=
null
;
try
{
InputStream
inputStream
=
request
.
getInputStream
();
if
(
inputStream
!=
null
)
{
bufferedReader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
"UTF-8"
));
char
[]
charBuffer
=
new
char
[
128
];
int
bytesRead
=
-
1
;
while
((
bytesRead
=
bufferedReader
.
read
(
charBuffer
))
>
0
)
{
stringBuilder
.
append
(
charBuffer
,
0
,
bytesRead
);
}
}
else
{
stringBuilder
.
append
(
""
);
}
}
catch
(
IOException
ex
)
{
throw
ex
;
}
finally
{
if
(
bufferedReader
!=
null
)
{
try
{
bufferedReader
.
close
();
}
catch
(
IOException
ex
)
{
throw
ex
;
}
}
}
body
=
stringBuilder
.
toString
();
}
@Override
public
ServletInputStream
getInputStream
()
throws
IOException
{
final
ByteArrayInputStream
byteArrayInputStream
=
new
ByteArrayInputStream
(
body
.
getBytes
(
"UTF-8"
));
ServletInputStream
servletInputStream
=
new
ServletInputStream
()
{
@Override
public
boolean
isFinished
()
{
return
false
;
}
@Override
public
boolean
isReady
()
{
return
false
;
}
@Override
public
void
setReadListener
(
ReadListener
readListener
)
{
}
@Override
public
int
read
()
throws
IOException
{
return
byteArrayInputStream
.
read
();
}
};
return
servletInputStream
;
}
@Override
public
BufferedReader
getReader
()
throws
IOException
{
return
new
BufferedReader
(
new
InputStreamReader
(
this
.
getInputStream
(),
Charsets
.
UTF_8
));
}
public
String
getBody
()
{
return
this
.
body
;
}
@Override
public
String
getParameter
(
String
name
)
{
return
super
.
getParameter
(
name
);
}
@Override
public
Map
<
String
,
String
[]>
getParameterMap
()
{
return
super
.
getParameterMap
();
}
@Override
public
Enumeration
<
String
>
getParameterNames
()
{
return
super
.
getParameterNames
();
}
@Override
public
String
[]
getParameterValues
(
String
name
)
{
return
super
.
getParameterValues
(
name
);
}
/**
* 设置自定义post参数 //
*
* @param paramMaps
* @return
*/
public
void
setParamsMaps
(
Map
paramMaps
)
{
Map
paramBodyMap
=
new
HashMap
();
if
(!
StringUtils
.
isEmpty
(
body
))
{
paramBodyMap
=
JSONObject
.
parseObject
(
body
,
Map
.
class
);
}
paramBodyMap
.
putAll
(
paramMaps
);
body
=
JSONObject
.
toJSONString
(
paramBodyMap
);
}
}
yifu-auth/src/main/resources/application.yml
View file @
3fe89e14
...
...
@@ -62,7 +62,7 @@ spring:
pathmatch
:
matching-strategy
:
ant_path_matcher
redis
:
host
:
yifu-redis
host
:
127.0.0.1
password
:
'
@yf_2017'
cloud
:
sentinel
:
...
...
@@ -102,7 +102,7 @@ spring:
pathmatch
:
matching-strategy
:
ant_path_matcher
redis
:
host
:
yifu-redis
host
:
127.0.0.1
password
:
'
@yf_2017'
cloud
:
sentinel
:
...
...
yifu-upms/yifu-upms-biz/src/main/resources/application.yml
View file @
3fe89e14
...
...
@@ -69,7 +69,7 @@ spring:
activate
:
on-profile
:
test
redis
:
host
:
yifu-redis
host
:
127.0.0.1
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
...
...
@@ -87,7 +87,7 @@ spring:
activate
:
on-profile
:
dev
redis
:
host
:
yifu-redis
host
:
127.0.0.1
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment