* @see org.apache.wicket.markup.html.form.Button#onSubmit()
*/
@Override
public void onSubmit()
{
AbstractAdminWebApplication app = ((AbstractAdminWebApplication)getApplication());
FeedbackPanel feedback = (FeedbackPanel) UploadPortletApp.this.get("feedback");
final FileUpload upload = fileUpload;
if (upload != null)
{
InputStream warStream = null;
File tempFile = null;
try
{
warStream = upload.getInputStream();
tempFile = File.createTempFile(upload.getClientFileName(), "");
String tmpDir = System.getProperty("java.io.tmpdir");
tempFile = new File(tmpDir, upload.getClientFileName());
if (tempFile.exists())
tempFile.delete();
FileOutputStream fos = new FileOutputStream(tempFile);
drain(warStream, fos);
fos.close();
UploadPortletApp.this.dm.deploy(tempFile);
feedback.info("Deployed 1 portlet application to server: " + upload.getClientFileName());
app.getServiceLocator().getAuditActivity().logAdminRegistryActivity(
app.getUserPrincipalName(), app.getIPAddress(), AuditActivity.REGISTRY_DEPLOY, ApplicationsListHome.PORTLET_REGISTRY_MANAGER);
}
catch (Exception e)
{
String msg = "Failed to upload document: " + upload.getClientFileName();
log.error(msg, e);