Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
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
沈俊林
java-gitlab-api
Commits
ffa218d0
Commit
ffa218d0
authored
Mar 06, 2017
by
Gabriel Allaigre
Committed by
Tim Olshansky
Mar 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Add proxy support (#193)
parent
4b9fe8a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+11
-0
GitlabHTTPRequestor.java
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
+1
-1
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
ffa218d0
...
@@ -7,6 +7,7 @@ import org.gitlab.api.http.Query;
...
@@ -7,6 +7,7 @@ import org.gitlab.api.http.Query;
import
org.gitlab.api.models.*
;
import
org.gitlab.api.models.*
;
import
java.io.*
;
import
java.io.*
;
import
java.net.Proxy
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -35,6 +36,7 @@ public class GitlabAPI {
...
@@ -35,6 +36,7 @@ public class GitlabAPI {
private
final
TokenType
tokenType
;
private
final
TokenType
tokenType
;
private
AuthMethod
authMethod
;
private
AuthMethod
authMethod
;
private
boolean
ignoreCertificateErrors
=
false
;
private
boolean
ignoreCertificateErrors
=
false
;
private
Proxy
proxy
;
private
int
requestTimeout
=
0
;
private
int
requestTimeout
=
0
;
private
String
userAgent
=
GitlabAPI
.
class
.
getCanonicalName
()
+
"/"
+
System
.
getProperty
(
"java.version"
);
private
String
userAgent
=
GitlabAPI
.
class
.
getCanonicalName
()
+
"/"
+
System
.
getProperty
(
"java.version"
);
...
@@ -69,6 +71,11 @@ public class GitlabAPI {
...
@@ -69,6 +71,11 @@ public class GitlabAPI {
return
this
;
return
this
;
}
}
public
GitlabAPI
proxy
(
Proxy
proxy
)
{
this
.
proxy
=
proxy
;
return
this
;
}
public
int
getRequestTimeout
()
{
public
int
getRequestTimeout
()
{
return
requestTimeout
;
return
requestTimeout
;
}
}
...
@@ -90,6 +97,10 @@ public class GitlabAPI {
...
@@ -90,6 +97,10 @@ public class GitlabAPI {
return
ignoreCertificateErrors
;
return
ignoreCertificateErrors
;
}
}
public
Proxy
getProxy
()
{
return
proxy
;
}
public
URL
getAPIUrl
(
String
tailAPIUrl
)
throws
IOException
{
public
URL
getAPIUrl
(
String
tailAPIUrl
)
throws
IOException
{
if
(!
tailAPIUrl
.
startsWith
(
"/"
))
{
if
(!
tailAPIUrl
.
startsWith
(
"/"
))
{
tailAPIUrl
=
"/"
+
tailAPIUrl
;
tailAPIUrl
=
"/"
+
tailAPIUrl
;
...
...
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
View file @
ffa218d0
...
@@ -358,7 +358,7 @@ public class GitlabHTTPRequestor {
...
@@ -358,7 +358,7 @@ public class GitlabHTTPRequestor {
url
=
new
URL
(
urlWithAuth
);
url
=
new
URL
(
urlWithAuth
);
}
}
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
HttpURLConnection
connection
=
root
.
getProxy
()
!=
null
?
(
HttpURLConnection
)
url
.
openConnection
(
root
.
getProxy
())
:
(
HttpURLConnection
)
url
.
openConnection
();
if
(
apiToken
!=
null
&&
authMethod
==
AuthMethod
.
HEADER
)
{
if
(
apiToken
!=
null
&&
authMethod
==
AuthMethod
.
HEADER
)
{
connection
.
setRequestProperty
(
tokenType
.
getTokenHeaderName
(),
String
.
format
(
tokenType
.
getTokenHeaderFormat
(),
apiToken
));
connection
.
setRequestProperty
(
tokenType
.
getTokenHeaderName
(),
String
.
format
(
tokenType
.
getTokenHeaderFormat
(),
apiToken
));
}
}
...
...
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