The listFiles() method of org.apache.commons.net.ftp.FTPClient works fine with Filezilla server on 127.0.0.1 but returns null on the root directory of public FTP servers such as belnet.be.
There is an identical question on the link below but enterRemotePassiveMode() doesn't seem to help.
http://stackoverflow.com/questions/2339855/apache...
Is there anything in apache commons to convert a Object to byte array, like the following method does?
public static byte[] toByteArray(Object obj) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
oos.flush();
byte[] data = baos.to...
Google guice has a built-in logger binding (http://code.google.com/p/google-guice/wiki/BuiltInBindings). But what if I want to use a commons-logging or log4j logger?
Can I get guice to inject a Log created by
LogFactory.getLog(CLASS.class)
But having the same behavior as in built-in binding:
The binding automatically sets the log...
Can anyone explain me what's wrong with the following code? I tried different hosts, FTPClientConfigs, it's properly accessible via firefox/filezilla... The problem is I always get empty filelist without any exceptions (files.length == 0). I use commons-net-2.1.jar installed with Maven.
FTPClientConfig config = new FTPClientConfig(F...
Hi, friends
When using Apache Commons EmailValidator through Maven, I have the following problem that doesn't deploy my app:
Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
java.lang.LinkageError: loader constraints violated when linking org/xml/sax/EntityResolver class
I'v...
Does anyone have any experience with the Apache Commmons Math optimization package? More specifically, the Nelder-Mead method implementation? Is it pretty high quality?
...
This works very well:
out.println(DurationFormatUtils.formatPeriod(
new Date().getTime(),
match.getStartingTime().getTime(),
"d H"));
But now I would like to have some nicer format
out.println(DurationFormatUtils.formatPeriod(
new Date().g...
I have a junit test method that takes a CommonsMultipartFile object as a parameter.
I'm trying to create a FileItem object so I can pass it to the constructor,
CommonsMultipartFile(org.apache.commons.fileupload.FileItem fileItem)
To do that, I'm trying to create the FileItem object using the DiskFileItem constructor,
DiskFileItem(ja...
All I need to to do is to connect via https. Must I use commons client for this?
...
Is there any way to prevent NPE when accessing a nested bean using commons-beanutils?
Here is my code:
new BeanUtilsBean().getProperty(human, "parent.name");
In this case I want getProperty() to either return empty string ("") when human.getParent() == null or handle it in a way other that throwing an NPE.
...
I want to use functionality from a certain method in apache commons StringUtils. I currently do not have the option of just using the library as one would normally do. I found the source for the method I need and my question is: am I free (legally) to use this code (just a method out of the library) or do I have to use the entire libra...
Does the library Apache Commons HttpClient support Gzip? We wanted to use enable gzip compression on our Apache server to speed up the client/server communications (we have a php page that allows our Android application to sync files with the Server).
...
I have an application structured as follows:
dao
domain
main
services
utils
I've made a class that reads the application configuration from an XML file. The question is where should it be placed?
By reflex, I'd have placed it in utilities but utility classes have static methods and are stateless whereas this class uses an instance o...
Hi,
I'm using Apache common fileupload library with Netbeans 6.8 + Glassfish.I'm trying to change the current upload path to be in the current context path of the servlet , something like this:
WEB-INF/upload
so I wrote :
File uploadedFile = new File("WEB-INF/upload/"+fileName);
session.setAttribute("path",uploadedFile.getAbsolutePa...
Hello All,
I am using HC APACHE.
I have added both httpcore-4.0.1.jar and httpclient-4.0.1.jar in the classpath of netbeans.
I am getting error:
java.lang.NoClassDefFoundError: org/apache/http/impl/client/DefaultHttpClient
My Code is as follows. Please help.
import org.apache.http.client.HttpClient;
import org.apache.http.client.Resp...
My question is regarding the org.apache.commons.exec.DefaultExecutor.execute(CommandLine command) method in apache commons.
This is the codebit for executing ffmpeg:
command = FFMPEG_DIR + "ffmpeg -i \"" + file.getAbsolutePath() + "\"";
DefaultExecutor executor = new DefaultExecutor();
ByteArrayOutputStream baos = new ByteArrayOutputSt...
I'm using Apache Common library for HTTP operations:
HttpClient client = getClient();
PutMethod put = new PutMethod(url);
FileRequestEntity countingFileRequestEntity = new FileRequestEntity(file, "application/octet-stream");
put.setRequestEntity(countingFileRequestEntity);
client.executeMethod(put);
put.releaseConnection();
I wonder h...
I created a servlet wich works fine when deployed in a separate war file, but I intend to use it as part of a seam application.
I use commons-fileupload but the iterator (see snippet) returns false (only when included in the seam-app).
Any ideas?
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws S...
The FileUtils.writeStringToFile(fileName, text) function of Apache Commons I/O overwrites previous text in a file. I would like to append data to my file. Is there any way I could use Commons I/O for the same? I can do it using normal BufferedWriter from Java but I'm curious regarding the same using Commons I/O.
...
I am trying to decide as to whether to use ProcessBuilder or Commons exec, My requirements are that I am simply trying to create a daemon process whose stdout/stdin/stderr I do not care about. In addition I want to execute a kill to destroy this process when the time comes. I am using Java on Linux. I know that both have their pains and ...