Monthly Archives: February 2016

Send Push Notification to Android Device

Often you may need to write services for a mobile APP. we all know apps throw push notifications, Push notification bring us the important information about the app. How push notification is sent to user: STEPS 1. First we fetch the message form the database to our application server.  2. Send message to google GCM server. 3. Then the GCM server will push those messages when ever the mobile is      connected to the internet. 1. We all know how to fetch the data from the database. 2. Sending message to GCM server a) First we need to add gcm-server dependency to our pom.xml file.             com.ganyo             gcm-server             1.0.2             jar    b) Create a class and copy the below code.  import; import; import; import; import java.util.logging.Level; import java.util.logging.Logger; public class SendPushNotification {     // google server will profde this key ,      //when our app register for the push notification     private static final String GOOGLE_SERVER_KEY             … Continue reading

Posted in Android, push notification | Leave a comment

Configuring HTTPS in Tomcat

Pre Requisites: 1. Java   (i used version JDK 1.7)  2. Tomcat (i used version Apache-tomcat-7.0.61) We can do this in mainly 4 steps. 1. Create a keystore using java. 2. Configure Tomcat to use keystore. 3. Test it 4. Configuring our Application to work on HTTPS 1. Create a keystore using java a) Open cmd and type cd “Program Files\Java\jdk1.7.0_25\bin”    b) Now type keytool -genkey -alias tomcat -keyalg RSA   After you typing and enter , this will ask you to enter password, then type your password, and after that it will ask you a series of questions, type the answers. c) Lastly it will ask you: Enter key password for (RETURN if same as keystore  password): Now dont type anything hit the enter. d) It will create .keysotre file at user home direcotry C:\Users\[user]\.keystore. 2. Configure Tomcat to use keystore. a) Now goto your tomcat installation directory and enter into conf folder. There you will find the server.xml file b) Find the following snippet <!– <Connector port="8443"  protocol=”org.apache.coyote.http11.Http11Protocol”      maxThreads=”150″ SSLEnabled=”true” scheme=”https” secure=”true”        clientAuth=”false” sslProtocol=”TLS” /> –> Uncomment it and configure it to find the keystore location, and provide the keystore passoword. Chage it so that it shoutld look like below <Connector SSLEnabled="true" acceptCount="100" clientAuth="false"     disableUploadTimeout=”true” enableLookups=”false” maxThreads=”25″     port=”8443″ keystoreFile=”c:/Users/[user]/.keystore”  keystorePass=”password”     protocol=”org.apache.coyote.http11.Http11NioProtocol” scheme=”https” secure=”true” sslProtocol=”TLS” /> 3. Test it a) Now start the server, and open browser and type https://localhost:8443/ b) If you observe http://localhost:8080/ also working. 4. Configuring our application to work on HTTPS a) To make our application to work with the SSL, add the followg the snippet in the web.xml file              securedapp … Continue reading

Posted in SSL, Tomcat | 1 Comment

Java Weekly, Issue 1

At the very beginning of this year, I decided to track my reading habits and share the best stuff here, on Programing and me, So i am starting this weekly series, 1. Interview question of the week. Difference between HashSet and TreeSet in Java  2. Tutorial of the week. we all know about the eclipse, as a daily driver we use it daily, but most of us never read a tutorial about the eclipse. here is the eclipse tutorial for you 3. Best article of the week. How To Be an “In Demand” Java Developer in 2016 2015 is over. its the time for all to revisit what we have learn so far and what the latest trends in the market, and what we have to learn. so i go around the internet and got this article regarding the becoming the “In Demand” Java developer in 2016. here is the link for it.

Posted in Java weekly | Leave a comment

A KB (knowledge byte) a day, keeps you updated

Java world is evolving Every Day, lot of resources and article are generating daily, it is very difficult to keep track of all the updates and remembering them. It is good to read at least one good article per day; I … Continue reading

Posted in best books, knowledge bytes | Leave a comment

Book review “Effective Java”

I have being reading one of the classic book in java development “Effective Java”. I must say it is one of the must read book for every java developer. The author Joshua Bloch wrote this book in very convenient way, All the … Continue reading

Posted in best books | Leave a comment

About Me

Hi, I am SivaTeja and I live and work in Hyderabad, India. I am working as a Java Developer. I work on JavaEE, Angular, MongoDB stuff. I created this blog with the goal of learning and sharing. As a software developer, … Continue reading

Posted in Uncategorized | Leave a comment