/*
This file is part of Airsonic.
Airsonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Airsonic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Airsonic. If not, see
The directory " + home + " does not exist. Please create it and make it writable, " + "then restart the servlet container.
" + "(You can override the directory location by specifying -Dairsonic.home=... when " + "starting the servlet container.)
"); } else if (!directoryWritable(home)) { error(res, "The directory " + home + " is not writable. Please change file permissions, " + "then restart the servlet container.
" + "(You can override the directory location by specifying -Dairsonic.home=... when " + "starting the servlet container.)
"); } else { airsonicHomeVerified = true; logServerInfo(req); chain.doFilter(req, res); } } private void logServerInfo(ServletRequest req) { if (!serverInfoLogged.getAndSet(true) && req instanceof HttpServletRequest) { String serverInfo = ((HttpServletRequest) req).getSession().getServletContext().getServerInfo(); LOG.info("Servlet container: " + serverInfo); } } private boolean directoryExists(File dir) { return dir.exists() && dir.isDirectory(); } private boolean directoryWritable(File dir) { try { File tempFile = File.createTempFile("test", null, dir); return tempFile.delete(); } catch (IOException x) { return false; } } private void error(ServletResponse res, String error) throws IOException { ServletOutputStream out = res.getOutputStream(); out.println("" + "