public void saveDefaultMensagem() { if (msgsFile == null) { msgsFile = new File(getDataFolder(), "mensagens.yml"); } if (!msgsFile.exists()) { saveResource("mensagens.yml", false); } }
protected void download() { /* Long id = download.getId(); org.hibernate.Session hibSession = HibernateUtilConfigured.getSessionFactory().openSession(); hibSession.beginTransaction(); hibSession.setFlushMode(org.hibernate.FlushMode.MANUAL); utils.File download = (utils.File)hibSession.load(utils.File.class,id); */ try { javax.servlet.ServletOutputStream outstream; outstream = response.getOutputStream(); java.sql.Blob blob = download.getContent(); java.io.InputStream in; in = blob.getBinaryStream(); response.setContentType(download.getContentType()); response.setHeader("Content-Disposition", "attachment; filename=" + download.getFileName()); java.io.BufferedOutputStream bufout = new java.io.BufferedOutputStream(outstream); byte bytes[] = new byte[32768]; int index = in.read(bytes, 0, 32768); while (index != -1) { bufout.write(bytes, 0, index); index = in.read(bytes, 0, 32768); } bufout.flush(); } catch (java.sql.SQLException ex) { System.out.println("exception in download serve"); ex.printStackTrace(); } catch (IOException ex) { System.out.println("exception in download serve"); ex.printStackTrace(); } /* hibSession.flush(); hibSession.getTransaction().commit(); */ }