Web

CORS Filter for J2EE Application

j2ee

CORS (Cross-origin resource sharing) helps in making Javascript based AJAX request from one domain to another, requesting domain is different from the domain where the request is made. This type of request is by default forbidden at the browser level and if this type of requet is made without proper settings, they will result in some origin security policy error. ... Read More »

Integrating Facebook Login

Jkoder.com

Integrating Facebook Login Facebook login is considered as one of the most preferable way for authenticating users. This approach is also very convenient for the users as Facebook has very deep reach among users. This post will illustrate as to how to integrate Facebook login as a way of authenticating users. We will be using Javascript SDK provided by Facebook. ... Read More »

jQuery load/parse JSON response

jQuery load/parse JSON response jQuery.parseJSON( json ); Takes a well-formed JSON string and returns the resulting JavaScript value, probably object or array of objects. Passing in a malformed JSON string results in a JavaScript exception being thrown. For example, the following are all invalid JSON strings: “{test: 1}” (test does not have double quotes around it). “{‘test’: 1}” (‘test’ is ... Read More »

jQuery detecting scroll- scroll reaching to the bottom of page

jQuery detecting scroll- scroll reaching to the bottom of page Detecting scroll and executing login based on scrolling has important significance in web development like implementing pagination, where more data gets loaded when user scrolls near the bottom of page. So, first basic question arises as to how to detect scroll. window.onscroll = function(ev) { //execute your logic here } ... Read More »

URL shortening using google API

Java

URL shortening using Google API Sometimes we need to share a long URL or we need to tweet them. But because of the length of the URL we are not able to do so. Google provides a service using which we can convert our long URL and squeezes them to fewer character URL. This service of Google is also known ... Read More »

Anti cross-site scripting (XSS) filter for Java web applications

j2ee

XSS (cross-site scripting)is the most prevalent web application security flaw. XSS flaws occur when an application includes user supplied data in a page sent to the browser without properly validating or escaping that content. Detection of most XSS flaws is fairly easy via testing or code analysis. How Do I Prevent ‘Cross-Site Scripting (XSS)’? HTML escaping Escaping of Input Escaping ... Read More »

Create a J2EE Web Application project with Apache Maven

apache

In this tutorial, we will learn how to create a J2EE Web Application project with Apache Maven, imports it into the Eclipse IDE, and package the Java project into a war file. Tools used : Maven 3.2.5 (For how to install, click here) Eclipse (Kepler Release) JDK 7 A. Create a Java Project from Maven Template In a terminal (*uix ... Read More »

How to handle jQuery cross domain AJAX request

Cross Domain jQuery AJAX request AJAX Requests are only possible if port, protocol and domain of sender and receiver are equal, means that the following below listed requests won’t work- Requesting https://serverA.com/a.php from http://serverA.com/b.php Requesting http://subdomain.serverA.com from http://serverA.com Requesting http://serverA.com:5000 from http://serverA.com Here in this tutorial we will cover the ways to handle this restriction. First lets look at the ... Read More »