Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use
<dependency>
    <groupId>org.grapheco</groupId>
    <artifactId>elfinder-servlet-2</artifactId>
    <version>1.4</version>
    <version>1.5</version>
    <classifier>classes</classifier>
</dependency>

Expand Down
27 changes: 17 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.grapheco</groupId>
<artifactId>elfinder-servlet-2</artifactId>
<version>1.4</version>
<version>1.5</version>
<name>elfinder-servlet-2</name>
<description>Java backend for "elFinder".</description>
<url>https://github.com/bluejoe2008/elfinder-2.x-servlet</url>
Expand All @@ -27,8 +27,8 @@
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- This makes the JavaDoc generation quieter -->
<quiet>true</quiet>
</properties>
Expand All @@ -46,12 +46,12 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -77,17 +77,24 @@
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</dependency>


<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>elfinder</artifactId>
<version>2.1.11</version>
<version>2.1.59</version>
<exclusions>
<!-- The exclusions are because the bower versions don't have concat/min versions -->
<exclusion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.util.Streams;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

Expand All @@ -30,7 +31,8 @@
@Controller
@RequestMapping("connector")
public class ConnectorController {
Logger _logger = Logger.getLogger(this.getClass());
private static final Logger LOGGER = LoggerFactory.getLogger(ConnectorController.class);

@Resource(name = "commandExecutorFactory")
private CommandExecutorFactory _commandExecutorFactory;

Expand Down Expand Up @@ -214,7 +216,7 @@ private File getTempDir(HttpServletRequest request) throws IOException {
}

_tempDir.mkdirs();
_logger.info(String.format("using temp dir: %s", _tempDir.getCanonicalPath()));
LOGGER.info(String.format("using temp dir: %s", _tempDir.getCanonicalPath()));
return _tempDir;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletRequest;
import java.io.*;
Expand All @@ -19,7 +20,7 @@
* @author bluejoe
*/
public class MultipleUploadItems {
Logger _logger = Logger.getLogger(this.getClass());
private static final Logger LOGGER = LoggerFactory.getLogger(MultipleUploadItems.class);
List<FileItemStream> _items = new ArrayList<FileItemStream>();
File _tempDir;

Expand Down Expand Up @@ -61,7 +62,7 @@ public void addItemProxy(final FileItemStream item) throws IOException {
os.close();
//final byte[] bs = os.toByteArray();
stream.close();
_logger.debug(String.format("saving item: %s", source.getCanonicalPath()));
LOGGER.debug(String.format("saving item: %s", source.getCanonicalPath()));
addItem((FileItemStream) Proxy.newProxyInstance(this.getClass()
.getClassLoader(), new Class[]{FileItemStream.class, Finalizable.class},
new InvocationHandler() {
Expand All @@ -74,7 +75,7 @@ public Object invoke(Object proxy, Method method,
}
if ("finalize".equals(method.getName())) {
source.delete();
_logger.debug(String.format("removing item: %s", source.getCanonicalPath()));
LOGGER.debug(String.format("removing item: %s", source.getCanonicalPath()));
return null;
}
return method.invoke(item, args);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.grapheco.elfinder.controller.executor;

import org.grapheco.elfinder.service.FsItemFilter;
import org.grapheco.elfinder.service.FsService;
import org.grapheco.elfinder.util.FsItemFilterUtils;
import org.grapheco.elfinder.util.FsServiceUtils;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
Expand All @@ -9,21 +17,8 @@
import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import org.grapheco.elfinder.service.FsItemFilter;
import org.grapheco.elfinder.service.FsService;
import org.grapheco.elfinder.util.FsItemFilterUtils;
import org.grapheco.elfinder.util.FsServiceUtils;

public abstract class AbstractCommandExecutor implements CommandExecutor
{
protected static Logger LOG = Logger
.getLogger(AbstractCommandExecutor.class);

protected FsItemFilter getRequestedFilter(HttpServletRequest request)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
import org.grapheco.elfinder.controller.executor.CommandExecutor;
import org.grapheco.elfinder.controller.executor.FsItemEx;
import org.grapheco.elfinder.service.FsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This returns the dimensions on an image.
*/
public class DimCommandExecutor extends AbstractJsonCommandExecutor implements
CommandExecutor
{
private static final Logger LOGGER = LoggerFactory.getLogger(DimCommandExecutor.class);

@Override
protected void execute(FsService fsService, HttpServletRequest request,
ServletContext servletContext, JSONObject json) throws Exception
Expand All @@ -43,13 +47,13 @@ protected void execute(FsService fsService, HttpServletRequest request,
{
String message = "Failed load image to get dimensions: "
+ item.getPath();
if (LOG.isDebugEnabled())
if (LOGGER.isDebugEnabled())
{
LOG.debug(message, ioe);
LOGGER.debug(message, ioe);
}
else
{
LOG.warn(message);
LOGGER.warn(message);
}

}
Expand All @@ -63,7 +67,7 @@ protected void execute(FsService fsService, HttpServletRequest request,
}
catch (IOException ioe)
{
LOG.debug(
LOGGER.debug(
"Failed to close stream to: " + item.getPath(),
ioe);
}
Expand All @@ -73,7 +77,7 @@ protected void execute(FsService fsService, HttpServletRequest request,
}
else
{
LOG.debug("dim command called on non-image: " + item.getPath());
LOGGER.debug("dim command called on non-image: " + item.getPath());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.fileupload.FileItemStream;
import org.apache.log4j.Logger;
import org.json.JSONObject;

import org.grapheco.elfinder.controller.MultipleUploadItems;
Expand All @@ -22,11 +21,13 @@
import org.grapheco.elfinder.controller.executor.FsItemEx;
import org.grapheco.elfinder.service.FsItemFilter;
import org.grapheco.elfinder.service.FsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class UploadCommandExecutor extends AbstractJsonCommandExecutor
implements CommandExecutor
{
Logger _logger = Logger.getLogger(this.getClass());
private static final Logger LOGGER = LoggerFactory.getLogger(UploadCommandExecutor.class);

// large file will be splitted into many parts
class Part
Expand Down Expand Up @@ -239,17 +240,17 @@ private void processChunkUpload(HttpServletRequest request,
long start = Long.parseLong(tokens[0]);
long size = Long.parseLong(tokens[1]);

_logger.debug(String.format("uploaded part(%d/%d) of file: %s",
LOGGER.debug(String.format("uploaded part(%d/%d) of file: %s",
index, total, fileName));

parts.addPart(index, new Part(start, size, uploads
.items("upload[]").get(0)));
_logger.debug(String.format(">>>>%d", parts._parts.size()));
LOGGER.debug(String.format(">>>>%d", parts._parts.size()));
if (parts.isReady())
{
parts.checkParts();

_logger.debug(String.format("file is uploadded completely: %s",
LOGGER.debug(String.format("file is uploadded completely: %s",
fileName));

fw.createAndSave(fileName, parts.openInputStream());
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/org/grapheco/elfinder/impl/DefaultFsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Map.Entry;

import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;

import org.grapheco.elfinder.controller.executor.FsItemEx;
import org.grapheco.elfinder.service.FsItem;
Expand All @@ -18,9 +17,13 @@
import org.grapheco.elfinder.service.FsService;
import org.grapheco.elfinder.service.FsServiceConfig;
import org.grapheco.elfinder.service.FsVolume;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DefaultFsService implements FsService
{
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultFsService.class);

FsSecurityChecker _securityChecker;

FsServiceConfig _serviceConfig;
Expand All @@ -37,7 +40,7 @@ public class DefaultFsService implements FsService
* find files by name pattern, this provides a simple recursively iteration based method
* lucene engines can be introduced to improve it!
* This searches across all volumes.
*
*
* @param filter The filter to apply to select files.
* @return A collection of files that match the filter and gave the root as a parent.
*/
Expand All @@ -55,7 +58,7 @@ public FsItemEx[] find(FsItemFilter filter)

/**
* find files recursively in specific folder
*
*
* @param filter
* The filter to apply to select files.
* @param root
Expand Down Expand Up @@ -187,22 +190,19 @@ public void setVolumeMap(Map<String, FsVolume> volumeMap)
*/
public void setVolumes(FsVolume[] volumes) throws IOException
{
Logger.getLogger(getClass())
.warn("calling setVolumes() is deprecated, please use setVolumeMap() to specify volume id explicitly");
LOGGER.warn("calling setVolumes() is deprecated, please use setVolumeMap() to specify volume id explicitly");
char vid = 'A';
for (FsVolume volume : volumes)
{
_volumeMap.put("" + vid, volume);
Logger.getLogger(this.getClass()).info(
String.format("mounted %s: %s", "" + vid, volume));
LOGGER.info(String.format("mounted %s: %s", "" + vid, volume));
vid++;
}
}

public void addVolume(String name, FsVolume fsVolume)
{
_volumeMap.put(name, fsVolume);
Logger.getLogger(this.getClass()).info(
String.format("mounted %s: %s", name, fsVolume));
LOGGER.info(String.format("mounted %s: %s", name, fsVolume));
}
}