apache-commons

Apache Commons Net FTPClient retrievefile method issue with Sterling Commerce Connect

Hi All, We have been using apache commons net FTP classes to connect using a proxy to a Sterling commerce FTP gateway located outside our network to pull files. We do not list the files since we know the name of the file to be pulled so we pull it directly using the below method. boolean isTransferred = ftp.retrieveFile(remoteFileName...

Can ServletFileUpload.parseRequest() only be called once per request?

I'm working a custom SpringSecurityFilter for my Grails application and I'm trying to use the commons upload library to process the request. I'm able to process the request in the filter but once it gets to my controller, none of the values are available. Can the HttpRequest only be processed once by the upload library? I'm guessing it...

apache HttpClient make connection for url1 ,if url1 failed connect url2

Hi using apache HttpClinet i have to connect to two different URLs based on conditions. we have given two urls URL1 and URl2. initially i have to connect to URL1 .if it fails due to communication errors retry for 3 times,then also it failed Now connect to URL2 and repeat the same process.finally if URL2 also fails.read from database....

Apache Commons FTPClient.listFiles

I am using org.apache.commons.net.ftp.FTPClient in one of my applications to work with a FTP server. I am able to connect, login, pwd and cwd. However, when I try to list the files it doesn't return the list of files in that directory, where I know for sure that there are files. I am using the method FTPFile[] listFiles(), it returns an ...

JSP can't resolve import of org.apache.commons.lang

I am trying to include the library StringEscapeUtils and everything that I can find indicates that I can import the Apache Org page as follows: <%@ page import="org.apache.commons.lang.StringEscapeUtils" %> however, I can only resolve the URL down to this: <%@ page import="org.apache.commons.*" %> and when I do that, the compile st...

Why doesn't Google Collections support MultiKeyMap like Apache Collections?

Is the decision by Google similar to the one for SortedMultiSet (stackoverflow question) or is it because there is no use of MultiKeyMap? I am aware that an alternate for MultiKeyMap can be to use a custom Class as a key which contains the multiple keys as its class members. On the contrary, I like the concept of specifying multiple keys...

How safe is apache Commons-javaflow while using jasperreports

Hi, I am using jasperreport and trying to pass an alternate report runner. • net.sf.jasperreports.engine.fill.JRThreadSubreportRunner: The initial thread-based implementation • net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner: A Javaflow-based implementation I am using the second one (for the reason, it runs on tomcat se...

How do I upload a file from a Java servlet to a location on a web server within Tomcat/webapps

How do I upload a file from a Java servlet to a location on a web server within Tomcat/webapps. I am using Commons upload. I have a location such as myserver:8080/myapp/mylocation where I want to put the files that are uploaded. I tried using getServletContext().getRealPath("/"); to find where I am and then appended that with mylocatio...

ConfigurationException in Java?

Decided to use Apache's Common Configuration package to parse an XML File. I decided to do a: XMLConfiguration xmlConfig = new XMLConfiguration(file); To which Eclipse complained that I haven't caught an exception(Unhandled exception type ConfigurationException), so I hit the trusty surround with try/catch and it added the following ...

Apache commons 2.4 FileUtils.writeStringToFile bug?

Hi, We're switching to commons for our file IO. But when i try to write a string to a file where the directory doesn't exist it gets a FNF exception. Pretty right you think. Javadoc says: public static void writeStringToFile(File file, String data, String encod...

Is there a utility method to separate a list by given string?

Is there something like the following in Apache Common Lang or Spring Utils or do you write your own Util method for this? List<String> list = new ArrayList<String>(); list.add("moo"); list.add("foo"); list.add("bar"); String enumeratedList = Util.enumerate(list, ", "); assert enumeratedList == "moo, foo, bar"; I remember the use of...

How do I compile a Java application that uses Apache Commons IO at the command line

Hi all, I made an application in NetBeans and I used the Apache Commons IO jar file. The application works fine in NetBeans, but I want to be able to compile it from the command line. The Apache Commons IO jar is with my *.java files but I get a commpiler error that says package org.apache.commons.io does not exist. ...

Java: Set<E> collection, where items are identified by its class

I need Set collection, where its items will be identified by items class. Something like ReferenceIdentityMap from Appache Collections, but on class scope i.e. two different instances of same class must be identified as same in this collection. You know, it is a violation of equals()/hashCode() identity principle but in occasional use ...

Java - Trying to log into website with invalid ssl certificate using httpclient

I'm trying to log into site with invalid ssl certificate and I have the following code. I bypass the the invalid cert by using my all certificate and then bypass the invalid Hostname by using hostnameverifier. However, the hostnameverifier does not seem to work and I still get the error message javax.net.ssl.SSLException: hostname in ...

Apache commons-vfs setting FTP/SFTP file permissions/umask

Hi, I'm working with Apache commons-vfs API for writing files to a FTP/SFTP server. ¿There is a way to specify file permissions after upload to the server or the umask for current FTP/SFTP session? ¿Can you show me an example? Thanks in advance ...

What part of Apache Commons saves you the most time?

Community wiki'ed already, folks. What part of Apache Commons saves you the most time? I'm curious to get together a list of these to browse and see what I don't know about, or what I should be using more often than not. ...

Is there an updated javabean reflection library that includes generics?

Before re-inventing the wheel, I thought I'd see if anyone is aware of an updated version of something like apache commons-beanutils (basically interested in using reflection-based services for populating and extracting bean values), especially one that supports generics. ...

Is there a fast concat method for linked list in Java?

How can I concat two linked lists in O(1) with Java via jdk1.6, google or apache commons collection or whatever? E.g. in the jdk there is only the addAll method which is O(n). Another feature I miss is to concat two lists where each of them could be in inverse order. To illustrate this assume two lists a->b->c and e->f->g could merged ...

Netbeans platform projects - problems with wrapped jar files that have dependencies

For starters, this question is not so much about programming in the NetBeans IDE as developing a NetBeans project (e.g. using the NetBeans Platform framework). I am attempting to use the BeanUtils library to introspect my domain models and provide the properties to display in a property sheet. Sample code: public class MyNode extends ...

How do I authenticate to a Proxy Server from clj-apache-http?

I'm trying to get up an running using http://github.com/rnewman/clj-apache-http (http/get (java.net.URI. url) :headers {"User-Agent" user-agent} :parameters (http/map->params {:default-proxy (http/http-host :host "localhost" :port 8888)}) :as :string) Problem is...