-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the progress bar of jupyterhub, add notes to history version of j…
…upyter notebooks
- Loading branch information
Showing
15 changed files
with
761 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.gw.utils; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpRequest; | ||
import org.springframework.http.client.ClientHttpRequestExecution; | ||
import org.springframework.http.client.ClientHttpRequestInterceptor; | ||
import org.springframework.http.client.ClientHttpResponse; | ||
|
||
public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor { | ||
|
||
final static Logger log = LoggerFactory.getLogger(LoggingRequestInterceptor.class); | ||
|
||
@Override | ||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { | ||
traceRequest(request, body); | ||
ClientHttpResponse response = execution.execute(request, body); | ||
traceResponse(response); | ||
return response; | ||
} | ||
|
||
private void traceRequest(HttpRequest request, byte[] body) throws IOException { | ||
log.info("===========================request begin================================================"); | ||
log.info("URI : {}", request.getURI()); | ||
log.info("Method : {}", request.getMethod()); | ||
log.info("Headers : {}", request.getHeaders() ); | ||
log.info("Request body: {}", new String(body, "UTF-8")); | ||
log.info("==========================request end================================================"); | ||
} | ||
|
||
private void traceResponse(ClientHttpResponse response) throws IOException { | ||
StringBuilder inputStringBuilder = new StringBuilder(); | ||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getBody(), "UTF-8")); | ||
String line = bufferedReader.readLine(); | ||
while (line != null) { | ||
inputStringBuilder.append(line); | ||
inputStringBuilder.append('\n'); | ||
line = bufferedReader.readLine(); | ||
} | ||
log.info("============================response begin=========================================="); | ||
log.info("Status code : {}", response.getStatusCode()); | ||
log.info("Status text : {}", response.getStatusText()); | ||
log.info("Headers : {}", response.getHeaders()); | ||
log.info("Response body: {}", inputStringBuilder.toString()); | ||
log.info("=======================response end================================================="); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.