Can a Wicket application trigger a restart of itself without a manager password?

It's mostly irrelevant to your question that your app is using Wicket. It's a java web application using the Wicket framework. Worded like this, your looking for how to restart a web app, using the Tomcat container.

If you choose another web application container (jetty etc) then you would need to change the procedure.

It's mostly irrelevant to your question that your app is using Wicket. It's a java web application using the Wicket framework. Worded like this, your looking for how to restart a web app, using the Tomcat container.

If you choose another web application container (jetty etc) then you would need to change the procedure. You can hit this URL to start an app: http://localhost:8080/manager/start? Path=/myapp and http://localhost:8080/manager/stop?

Path=/myapp to stop your app. Change /myapp to your applications context, and you have start/stop control. You can then deal with password issues internally in your code.

In light of your clarification you might look at this tomcat documentation and use JMX. However, even JMX is password protected. There is no standard for getting at the container controls from your web app.

But that would require the user to have the manager password (as well as a second account to access the manager interface since I block direct access to port 8080 and proxy it through an Apache with HTTP Authentication). The question title may not have been precise enough: The user should be able to restart the app but neither the app itself nor the user should have to access the manager this way, using any manager password. I was thinking of something like getServletContext().

RestartApplication(); (which does not exist with such a name, obviously) – Energiequant Dec 4 '09 at 23:24 Using something like HttpClient, and those URLs you can enter the password for the user, so the user never sees it, and never has to enter it. There is no access to the containers controls from the web application. – Jim Barrows Dec 4 '09 at 23:42 a cron job and wget will fix this up nicely.

A quick bash script with something like: wget --save-cookies cookies. Txt \ --post-data 'user=admin&password=mypassword' \ localhost:8080/manager/stop? Path=/myapp Make the script readable to only root and you won't have to worry about losing control of your password.

Wget --load-cookies cookies. Txt \ -p localhost:8080/manager/start? Path=/myapp – perilandmishap Dec 5 '09 at 18:31.

I'm trying to think if/what other web frameworks really support this. I think Jim is on to pointing to the right level of the solution. Regardless of what framework being used a web container should allow for the restart of a contained web app.

Tomcat would require the manager application to be available. It appears that (from my googling) that Jetty exposes this functionality through JMX MBeans. So the restart functionality may not be portable between URL1 make this portable, in any framework, I think you'd have to isolate what things are needed to restart.

If it's hibernate re-initialize the session factory. If it's spring configuration, this may certainly be more intrusive, but replacing or reconfiguring beans seems the way to go. If it's i18n or markup resources wicket I believes can help with that already.

I also encourage you to take a look at JMX. You can turn off authentication for JMX in which case make sure the JMX port is not reachable from the internet (filter the port on your host based firewall, or bind it only to a local ip address). JMX was intended to standardize remote monitoring and control of applications, containers in a Java EE world, so it more or less provides the infrastructure you're looking for.

Or alternatively use another web container (preferably an embedded one) and handle even container restarts from your java code.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions