String version = request.getParameter("version");
PolicyUtil.checkPermission(PolicyConstants.EXTENSIONS_RESOURCE_TYPE,
PolicyConstants.PERM_CHANGE,
getSessionInfo(request).getUser());
ActionForward fwd = new RedirectWithMessages(mapping.findForward("refresh"), request);
URLConnection con = ExtensionStore.getInstance().downloadExtension(id, version);
try {
InputStream in = con.getInputStream();
ExtensionBundle bundle = ExtensionStore.getInstance().installExtensionFromStore(id, in, request, con.getContentLength());
ExtensionStore.getInstance().licenseCheck(bundle, request, fwd);
ExtensionStore.getInstance().postInstallExtension(bundle, request);
ActionMessages msgs = new ActionMessages();
msgs.add(Globals.MESSAGE_KEY, new ActionMessage("extensionStore.message.applicationInstalled", bundle.getName()));
saveMessages(request, msgs);