Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
c2c1c8a7
Commit
c2c1c8a7
authored
Jan 05, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ver1.1' of
http://192.168.0.204/yzg/yzg-util
parents
7157c77b
edc462c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
UrlHelper.java
.../src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
+41
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
View file @
c2c1c8a7
...
...
@@ -188,6 +188,47 @@ public class UrlHelper {
return
mapRequest
;
}
/**
* 获取全路径
*
* @param simpleUrl 简短路径或全路径
* @param simpleBaseUrl 配置后的基础路径
* @param defBaseUrl 默认路径
*/
public
static
String
getFullUrl
(
String
simpleUrl
,
String
simpleBaseUrl
,
String
defBaseUrl
)
{
// 获取请求地址
String
tbdUrl
=
StringHelper
.
getFirst
(
simpleBaseUrl
,
defBaseUrl
);
// 获取全路径
String
toSimpleFullUrl
=
getFUllUrl
(
tbdUrl
,
simpleUrl
);
// 最终地址处理
String
toSimpleUrl
;
if
(!
StringHelper
.
compare
(
simpleBaseUrl
,
simpleUrl
)
&&
toSimpleFullUrl
.
startsWith
(
defBaseUrl
))
{
String
rightUrl
=
StringHelper
.
trimStart
(
toSimpleFullUrl
,
defBaseUrl
);
toSimpleUrl
=
getFUllUrl
(
tbdUrl
,
rightUrl
);
}
else
{
toSimpleUrl
=
toSimpleFullUrl
;
}
return
toSimpleUrl
;
}
/**
* 获取全路径
*
* @param baseUrl 基础路径
* @param simpleUrl 简单路径
* @return 全路径
*/
private
static
String
getFUllUrl
(
String
baseUrl
,
String
simpleUrl
)
{
String
toSimpleFullUrl
;
if
(
simpleUrl
.
startsWith
(
"http://"
)
||
simpleUrl
.
startsWith
(
"https://"
))
{
toSimpleFullUrl
=
simpleUrl
;
}
else
{
toSimpleFullUrl
=
StringHelper
.
trimEnd
(
baseUrl
,
"/"
)
+
"/"
+
StringHelper
.
trimStart
(
simpleUrl
,
"/"
);
}
return
toSimpleFullUrl
;
}
/**
public static void main(String[] args) {
String url = "http://wx.pangdly.com/#/orderPayment?companyId=6da527f930be4aa1904fe17fcb41874f&order=z001570428580820822894116f754e96";
...
...
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