class PluginMediaServlet extends BaseUploadServlet {

    @Override
    public void init(final ServletConfig config) throws ServletException {
        final String pattern = config.getInitParameter("url-pattern");
        if (pattern != null && !pattern.trim().isEmpty()) {
            if (pattern.endsWith("/")) {
                this.pattern = pattern;
            } else {
                this.pattern = pattern + "/";
            }
            if (this.pattern.startsWith("/")) {
                mediaServletURI.setURI(this.pattern.substring(1));
            } else {
                mediaServletURI.setURI(this.pattern);
            }
        }
        this.root = fileSystem.getRootDirectories().iterator().next();
    }

}