Hi, I see the problem. The tool org.h2.tools.Server has a static method startWebServer(Connection conn) which starts a web server and a browser window with a connection (it doesn't have to be a H2 database). Maybe part of this code can be re-used? But it's a own server, not a servlet.
Regards, Thomas On Wednesday, April 25, 2012, Ryan McKinley wrote: > finally tracked things down. The issue is that it needs a valid > sessionid to get to the right place. I hacked around this by > internally making a request and parsing the sessionid from: > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <!-- > Copyright 2004-2011 H2 Group. > Multiple-Licensed under the H2 License, Version 1.0, > and under the Eclipse Public License, Version 1.0 > (http://h2database.com/html/license.html). > Initial Developer: H2 Group > --> > <html><head> > <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> > <title>H2 Console</title> > <link rel="stylesheet" type="text/css" href="stylesheet.css" /> > <script type="text/javascript"> > location.href = 'login.jsp?jsessionid=ae8d456f0d5cc092dcc3286be4fcbe13'; > </script> > </head> > <body style="margin: 20px;"> > > <h1>Welcome to H2</h1> > <h2>No Javascript</h2> > If you are not automatically redirected to the login page, then > Javascript is currently disabled or your browser does not support > Javascript. > For this application to work, Javascript is essential. > Please enable Javascript now, or use another web browser that supports it. > > </body></html> > > > On Mon, Apr 23, 2012 at 10:03 AM, Thomas Mueller > <[email protected]> wrote: > > Hi, > > > > I didn't test it myself, but I believe this should do the > > trick: action="/h2/console/login.do" (.do instead of .jsp). > > > > Regards, > > Thomas > > > > > > On Wednesday, April 11, 2012, Ryan McKinley wrote: > >> > >> I am running embedded H2 within a webapp. I want to expose the web > >> console in a management link. I can successfully link to the web > >> console login screen, but I would like to link directly to a database. > >> Running in jetty, my web.xml includes: > >> > >> <servlet> > >> <servlet-name>H2Console</servlet-name> > >> <servlet-class>org.h2.server.web.WebServlet</servlet-class> > >> </servlet> > >> <servlet-mapping> > >> <servlet-name>H2Console</servlet-name> > >> <url-pattern>/h2/console/*</url-pattern> > >> </servlet-mapping> > >> > >> In my app I have a page with: > >> > >> <form method="POST" action="/h2/console/login.jsp"> > >> <input type="hidden" name="user" value="sa" /> > >> <input type="hidden" name="password" value="" /> > >> <input type="hidden" name="driver" value="org.h2.Driver" /> > >> <input type="hidden" name="language" value="en" /> > >> <input type="hidden" name="setting" value="Generic H2 (Embedded)" /> > >> <input type="hidden" name="name" value="Generic H2 (Embedded)" /> > >> <input type="hidden" name="url" value="jdbc:h2:C:\path\to\my\h2\db" /> > >> <input type="submit" value="H2"/> > >> </form> > >> > >> everything I try keeps pointing to the initial login screen. > >> > >> Any suggestions on how to link to an open DB? > >> > >> Thanks > >> ryan > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "H2 Database" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> For more options, visit this group at > >> http://groups.google.com/group/h2-database?hl=en. > >> > > -- > > You received this message because you are subscribed to the Google Groups > > "H2 Database" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > > http://groups.google.com/group/h2-database?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
