Leon-WTF commented on a change in pull request #2225:
URL: https://github.com/apache/drill/pull/2225#discussion_r642897014



##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
##########
@@ -395,6 +410,33 @@ public Viewable getProfile(@PathParam("queryid") String 
queryId){
     }
   }
 
+  @POST
+  @Path("/profiles/view")
+  @Consumes(MediaType.MULTIPART_FORM_DATA)
+  @Produces(MediaType.TEXT_HTML)
+  public Viewable viewProfile(@FormDataParam(PROFILE_DATA) String content,
+                              @Context HttpServletRequest req){
+    try {
+      HttpSession session = req.getSession(true);
+      if (session.isNew()) {
+        session.setMaxInactiveInterval(work.getContext().getConfig()
+          .getInt(ExecConstants.HTTP_SESSION_MAX_IDLE_SECS));
+      }
+      session.setAttribute(PROFILE_DATA, content);

Review comment:
       same as above

##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/ProfileResources.java
##########
@@ -373,9 +379,18 @@ private QueryProfile getQueryProfile(String queryId) {
   @GET
   @Path("/profiles/{queryid}.json")
   @Produces(MediaType.APPLICATION_JSON)
-  public String getProfileJSON(@PathParam("queryid") String queryId) {
+  public String getProfileJSON(@PathParam("queryid") String queryId,
+                               @Context HttpServletRequest req) {
     try {
-      return new 
String(work.getContext().getProfileStoreContext().getProfileStoreConfig().getSerializer().serialize(getQueryProfile(queryId)));
+      HttpSession session = req.getSession(false);
+      if (session == null || session.getAttribute(PROFILE_DATA) == null) {

Review comment:
       if drill.exec.security.user.auth.enabled=false, session will be null




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to