-
How to use Post Method using Apache HttpClient 4
[tweet-dzone]HttpClient is an apache java library that can be used to read pages over http. It can be used mainly for webpages and provide a well defined API that can handle Cookies, Sessions,… It offers support for both Get and Post methods, so it’s very useful for writing http java clients that can login and […]
-
How to Convert InputStream to String
[tweet-dzone]Sometimes I feel there are too many classes in java to work with streams and files. InputStream is the base class of all the classes in Java IO API. The input stream class is intended to be used to read the data from different sources in chunks. This is useful for large streams that don’t […]
-
Method Chaining
[tweet-dzone]Method chaining is a simple programming technique that can be implemented in almost any programming language. In simple words, it means that a method performs some operations on “this” object and then returns it so it can be used further more. It allows us to invoke several methods one after another, on one or different […]
-
A few thoughts about memory cache
I was starting today to look on different approaches and techniques that are used in scalable web or non web applications. One technique used in many large systems is simply called “memory cache”. It means that data are cached in memory so the data will not be queried again. Cache and memory cache exists for […]
-
Guice Servlets Integration
Using Google Guice in web applications can raise some issues. First of all when we talk about web applications we talk about servlets and we talk about managed environments. The creation of servlets in not controlled by us, when we write the application, it is controlled by the web application container. This generates some problems: […]
-
Using VBS to set the environment variables
I use windows and I hate when I have to switch on another computer or when I have to do any change related to windows especially changing the environment variables. I like to download the tool, framework, … I use as a zip and then to do minimal operations to install it. The thing I […]
-
Wrapping (evil)checked exceptions in Java
What? There are various reasons when we have to wrap java exceptions. Often those reasons are called: Checked Exceptions. According to the definition there are 2 types of exceptions:
-
How to Avoid Generics Related Warnings in Eclipse
I get tones of exceptions in my code because I tend to use Generics in the old-fashioned way. I have my reasons for that. And I have tons of warnings like those: HashMap is a raw type. References to generic type HashMap should be parameterized Type safety: The method put(Object, Object) belongs to the raw […]
-
Storing parameters in web.xml: context-param & init-param
There are two options to store parameters in web.xml: – context parameters – available to the entire scope of the web application – init parameters – available in the context of a servlet or filter in the web application Context Parameters
-
How to Read/Write Java Properties Files
Java properties files are just simple text files that are widely used in Java to store different properties which should not be hard coded in java source files. By convention, properties files should have the .properties extension. They have a simple structure, each line defining a key/value pair. It is also possible to define larger […]