Alon Bar-Lev has posted comments on this change.

Change subject: core: Non-plugin automatic invocation of console session
......................................................................


Patch Set 2: (6 inline comments)

....................................................
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/console/ConsoleConfigServlet.java
Line 12: /**
Line 13:  * Servlet for serving console config files.
Line 14:  *
Line 15:  */
Line 16: public class ConsoleConfigServlet extends IniServlet {
Why do we need this abstraction?

Worse case scenario we can pass the following by using init parameters from 
web.xml.

In this implementation we are doing virt-viewer hardcoded anyway...

Also, my suggestion is this...

Doing a single servlet which is called getAttachment

And prepare the ini file at CLIENT side...

 <form id=form1 method="post" action="getAttachment"> 
    <input type="hidden" name="filename" value="console.vv"/>
    <input type="hidden" name="content_type" value="x-virt-viewer"/>
    <input type="hidden" name="content"/>
 </form>
 form1.content = (
     "[firt-viewer]\n"
     "name=value\n"
 );
 form1.submit();

This will be a generic mechanism for us to post/get attachments. Without 
splitting the logic between client and server.
Line 17: 
Line 18:     private static final long serialVersionUID = 8496520437603585173L;
Line 19: 
Line 20:     private static final String CONFIG_FILE_HEADER = "[virt-viewer]";


Line 21:     private static final String HEADER_CONTENT_TYPE = "x-virt-viewer";
Line 22:     private static final String HEADER_CONTENT_FILENAME = "console.vv";
Line 23: 
Line 24:     @Override
Line 25:     protected void doPost(HttpServletRequest request, 
HttpServletResponse response) throws ServletException, IOException {
I know I am in minority, but this is over abstraction, one liner functions just 
make the code unreadable.
Line 26:         setupHttpHeaders(response);
Line 27:         writeConfigFileHeader(response);
Line 28: 
Line 29:         super.doPost(request, response);


Line 39:     private void writeConfigFileHeader(HttpServletResponse response) 
throws IOException {
Line 40:         PrintWriter writer = response.getWriter();
Line 41: 
Line 42:         writer.println(CONFIG_FILE_HEADER);
Line 43:         if (writer.checkError()) {
Juan, is this really needed?!?! The servlet infrastructure is probably checking 
this.
Line 44:             throw new IOException("Error when writing to response 
stream");
Line 45:         }
Line 46: 
Line 47:         writer.flush();


Line 43:         if (writer.checkError()) {
Line 44:             throw new IOException("Error when writing to response 
stream");
Line 45:         }
Line 46: 
Line 47:         writer.flush();
I don't think there is any need for this.
Line 48:     }


....................................................
File 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/IniServlet.java
Line 14: /**
Line 15:  * Servlet for serving ini-like files built from GET params.
Line 16:  *
Line 17:  */
Line 18: public class IniServlet extends HttpServlet {
I don't think this class is required.
Line 19: 
Line 20:     private static final long serialVersionUID = 119752080913341323L;
Line 21:     private static final Logger log = 
Logger.getLogger(IniServlet.class);
Line 22: 


Line 43:                 }
Line 44:             }
Line 45:         }
Line 46: 
Line 47:         writer.flush();
I don't think this is required.
Line 48:     }


--
To view, visit http://gerrit.ovirt.org/11702
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I18b9d2efad15f5e9bb98a8176112b721c810205f
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Arik Hadas <[email protected]>
Gerrit-Reviewer: Frank Kobzik <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Roy Golan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to