Posts

How to integrate Web Application with Salesforce via Oauth

Image
This tutorial shows you the basic of Oauth. We have created a Java Web Application that authenticates the user to salesforce via Oauth 2.0 and then we have performed few CRUD operation via the new API. Setup: SSL enabled Tomcat Server as we have deployed our Web Application on tomcat. Click here for instruction on How to enable SSL on apache Tomcat 7.0 Salesforce Remote Access Application. Click here for instruction on How to create Remote Access Application on Salesforce? Download the application from here and change the name to Services. Run the Project: Check out the project from the above URL, import into the eclipse and Run as a Server. Navigate your browser to https://localhost:8443/Services . You will see the following page: Click on the link and it will take you the salesforce page for Authentication : Once you are login into salesforce, It will ask you to allow the Oauth_Apps to access your data: ...

How to create Remote Access Application on Salesforce?

Image
Before I'll start with how to create Remote Access Application. First let me explain what is actually Remote Access Application. What is Remote Access Application? A remote access Application is an application external to salesforce that uses the Oauth protocol to verify both the salesforce user and the external data. All remote access applications have been integrated with salesforce, such that they can access a subset of your salesforce data once you explicitly grant each application permission. How to create Remote Access Application? To create an Remote application, You must have your developer account, If you don’t have it then You can create it from here . Step to create your First Remote Access Application: Login to salesforce.com then click Your Name |Create | Apps and click on “new” button. Check below screenshot :     When you click on new button, you will see a page like this: Enter the name of the Application. This i...

What is Maven repository ?

Maven Repository : A repository is a place where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily. There are three types of repository :  local central remote  Local Repository : The maven local repository is a local folder that is used to store all your project’s dependencies (plugin jars and other files which are downloaded by Maven). In simple, when you build a Maven project, all dependency files will be stored in your Maven local repository. The default name of the Maven's local repository is .m2. Central Repository Maven central repository is repository provided by Maven community. It contains a large number of commonly used libraries. When you build a Maven’s project, Maven will check your pom.xml file, to identify which dependency to download. First, Maven will get the dependency from your local repository, if not found, then get it from the default Maven central repo...

how to install MAVEN on linux

What is MAVEN ? Read here : http://maven.apache.org/ Here are the steps to download and install Maven on linux : Step 1 : Download the latest binary from the http://maven.apache.org/download.cgi.              apache-maven-3.0.4-bin.tar.gz Step 2 : Untar it using tar command.               tar -zxvf /usr/local/apache-maven-3.0.4-bin.tar.gz Step 3: Add Maven binary Path to the System Path i,e add in .bash_profile path           $ cd $HOME           $ vi ~/.bash_profile Set PATH and M2_HOME as follows M2_HOME=/usr/local/apache_maven-3.0.4 PATH=PATH=$PATH:$HOME/bin:/usr/local/apache_maven-3.0.4/bin save the file by pressing esc : wq button Note: Don't delete the previous PATH, Just append the M2_HOME path after : Now save and clos...

How ExceptionHandler return JSON in spring MVC

I am working on one project where client/server response is in JSON format. It is easy to send object in JSON format but what if some exception occured and you want to send the Exception also in JSON format ? After n number of trial. I finally able to do the above task .  Step 1 : Add following annotation " AnnotationMethodHandlerExceptionResolver " in your <CONTROLLER>-servlet.xml file. <!-- JSON format support for Exception -->     <bean id="methodHandlerExceptionResolver"         class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerExceptionResolver">         <property name="messageConverters">             <list>                 <ref bean="jacksonMessageConverter" />             </list> ...

What is Hibernate Caching?

Image
In a typical application, you perform lot of operations like instantiate objects, load object from the database and so on. Sometime in multiuser application you may face a situation in handling multiple call of databases. Hibernate offers caching functionality which is designed to reduces the amount of necessary database access. This is a very powerful feature if used correctly. It increases your application performance and works between your application and the database as it avoids the number of database hit as many as possible. Hibernate Cache Types : Hibernate uses different types of caches. Each type of cache is used for different purposes. Let us first have a look at this cache types. First level cache Second level cache Query level cache 1. First level cache : First-level cache is the session cache and is always Associates with the Session object. Hibernate uses this cache by default. The Session object keeps an object under its own cache before committing to th...

Useful java Keytool Command

Generate a Java keystore and key pair : keytool -genkey -alias mycert -keyalg RSA -keystore keystore.jks -keysize 1024 Generate a keystore and self-signed certificate :  keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048 keytool command to view certificate details from keyStore : keytool -list -v -keystore keystore.jks Check a particular keystore entry using an alias: keytool -list -v -keystore keystore.jks -alias mydomain keytool command option is -printcert which prints details of a certificate stored in .cer file : keytool -printcert -file test.cer Export a certificate from a keystore: keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks   keytool -export -alias mydomain -keypass keypass -keystore keystore.jks -storepass jkspass -rfc -file keytool_crt.pem Note : "keytool -export" command uses DER format by default. The "-rfc" option is to...