Questions tagged [apache-commons]

The Apache Commons project provides reusable, open source Java software components. Consider using a component specific tag (such as apache-commons-lang) rather than this general tag.

248
votes
19answers
364k views

What is the best Java email address validation method? [closed]

What are the good email address validation libraries for Java? Are there any alternatives to commons validator?
119
votes
10answers
340k views

Http Basic Authentication in Java using HttpClient?

I am trying to mimic the functionality of this curl command in Java:curl --basic --user username:password -d "" http://ipaddress/test/loginI wrote the following using Commons HttpClient 3.0 but ...
455
votes
20answers
176k views

How to convert byte size into human readable format in java?

How to convert byte size into human-readable format in Java? Like 1024 should become "1 Kb" and 1024*1024 should become "1 Mb".I am kind of sick of writing this utility method for each project. Are ...
113
votes
4answers
124k views

What does the arrow operator, '->', do in Java?

While hunting through some code I came across the arrow operator, what exactly does it do? I thought Java did not have an arrow operator.return (Collection<Car>) CollectionUtils.select(...
118
votes
10answers
347k views

How can I get an http response body as a string in Java?

I know there used to be a way to get it with apache commons as documented here:http://hc.apache.org/httpclient-legacy/apidocs/org/apache/commons/httpclient/HttpMethod.htmland an example here:http:/...
5
votes
5answers
5k views

Getting NoClassDefFoundError when using common.lang.StringUtils in android java code?

I am getting this error:-NoClassDefFoundError wherever the code is using StringUtils class or methods .I have correctly added the jar files to the code and is not showing any kind of error in my code(...
61
votes
3answers
136k views

How to Serialize a list in java?

I would like to deep clone a List. for that we are having a method// apache commons method. This object should be serializableSerializationUtils.clone ( object ) so now to clone my List i should ...
151
votes
8answers
72k views

Apache Commons equals/hashCode builder [closed]

I'm curious to know, what people here think about using org.apache.commons.lang.builder EqualsBuilder/HashCodeBuilderfor implementing the equals/hashCode? Would it be a better practice than writing ...
63
votes
6answers
67k views

Bi-directional Map in Java? [duplicate]

I have a simple integer-to-string mapping in Java, but I need to be able to easily retrieve string from integer, and also integer from string. I've tried Map, but it can retrieve only string from ...
198
votes
5answers
57k views

Google Guava vs. Apache Commons [closed]

I was looking for a bidirectional map implementation in Java, and stumbled upon these two libraries:Google Guava (formerly "Google Collections")Apache Commons CollectionsBoth are free, have the ...
108
votes
3answers
108k views

Logging framework incompatibility

I'm building a small Java app and hoping to use logback for logging.My app has a dependency on an older project that does its logging via org.apache.commons | com.springsource.org.apache.commons....
83
votes
7answers
55k views

How to send java.util.logging to log4j?

I have an existing application which does all of its logging against log4j. We use a number of other libraries that either also use log4j, or log against Commons Logging, which ends up using log4j ...
16
votes
8answers
9k views

Map that could be iterated in the order of values

I need a Map that could be iterated in the decreasing order of its values. Does any of the standard libraries like Apache Commons or Guava provide this kind of map ?
20
votes
5answers
19k views

Preventing HttpClient 4 from following redirect

I'm connecting to my AppEngine application using the Apache HttpComponents library. In order to authenticate my users, I need to pass an authentication token along to the application's login address (...
9
votes
5answers
13k views

Copy POJO content from one bean to another

I have few Pojos in different packages, each POJO contains set of the another pojo from the same package. I need to copy all items with the same name from Package B Pojos to objects in Package A. ...
65
votes
6answers
45k views

tomcat-dbcp vs commons-dbcp

It seems there is a lot of confusion between these two connection pooling libraries. What I want to know is which one is better (if at all)?Here are some points which I would like to put up... Could ...
26
votes
6answers
27k views

Lightweight JDBC helper library alternative to Apache Commons DbUtils [closed]

I've just developed my own tiny little JDBC helper library, and I've already realized what a maintenance nightmare it will be.I'm not looking for a full fledged ORM, like Hibernate, just something ...
19
votes
4answers
18k views

SpringBoot: Large Streaming File Upload Using Apache Commons FileUpload

Am trying to upload a large file using the 'streaming' Apache Commons File Upload API.The reason I am using the Apache Commons File Uploader and not the default Spring Multipart uploader is that it ...
20
votes
5answers
62k views

Secure FTP with org.apache.commons.net.ftp.FTPClient

Is there a way I can implement a secure FTP with org.apache.commons.net.ftp.FTPClient?If not, what are other options for Java?
26
votes
7answers
23k views

Does Apache Commons HttpClient support GZIP?

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 ...
21
votes
2answers
15k views

How to fetch parameters when using the Apache Commons CLI library

I'm using the Apache Commons CLI to handle command line arguments in Java.I've declared the a and b options and I'm able to access the value using CommandLine.getOptionValue().Usage: myapp [OPTION]...
15
votes
3answers
5k views

What is the difference between maven dependencies org.apache.commons:commons-io and commons-io:commons-io?

Maven repositories contain these two dependencies: org.apache.commons:commons-io:1.3.2 and commons-io:commons-io:1.3.2. What is the difference and which one I should be using in my pom.xml?In ...
67
votes
8answers
54k views

How can I generate a list or array of sequential integers in Java?

Is there a short and sweet way to generate a List<Integer>, or perhaps an Integer[] or int[], with sequential values from some start value to an end value?That is, something shorter than, but ...
33
votes
3answers
34k views

Apache Commons Net FTPClient and listFiles()

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 ...
122
votes
3answers
26k views

What are the big improvements between guava and apache equivalent libraries?

We currently use apache collections, string utils, etc. I need to decide if we should switch from the apache foundations implementation.The important criteria is ease of developers use. Performance/...
8
votes
1answer
9k views

Monitoring progress using Apache Commons FTPClient

I have a simple FTPClient class that downloads files form an FTP server. I also need to monitor progress of the download, but I do not see a way how. The actually download files function is a simple ...
33
votes
4answers
35k views

Range of valid character for a base 64 encoding

I am interested in the following:Is there a list of characters that would never occur as part of a base 64 encoded string?For example *. I am not sure if this would occur or not. If the original ...
30
votes
7answers
36k views

Append data into a file using Apache Commons I/O

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 ...
9
votes
6answers
6k views

How to disable echo when sending a terminal command using apache-commons-net TelnetClient

So, I have this class that uses the org.apache.commons.net.telnet.TelnetClient class. It attempts to send commands and read the response.public class AutomatedTelnetClient{private TelnetClient ...
32
votes
5answers
65k views

Copy specific fields by using BeanUtils.copyProperties?

springframework.beans.BeanUtils is very useful to copy objects, and I use the "ignoreProperties" option frequently. However, sometimes I want to copy only specific objects (basically, the opposite of "...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,