JSON.

Slides:



Advertisements
Similar presentations
Java Script Session1 INTRODUCTION.
Advertisements

Servlets and a little bit of Web Services Russell Beale.
Web Page Behavior IS 373—Web Standards Todd Will.
CSC 2720 Building Web Applications JavaScript. Introduction  JavaScript is a scripting language most often used for client-side web development.  JavaScript.
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
Prof. James A. Landay University of Washington Spring 2008 Web Interface Design, Prototyping, and Implementation Rich Internet Applications: AJAX, Server.
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
ASHIMA KALRA.  INTRODUCTION TO JSP INTRODUCTION TO JSP  IMPLICIT OBJECTS IMPLICIT OBJECTS  COOKIES COOKIES.
Presented by…. Group 2 1. Programming language 2Introduction.
JQuery CS 268. What is jQuery? From their web site:
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Cross Site Integration “mashups” cross site scripting.
Chapter 6 Server-side Programming: Java Servlets
PHOBOS Javascript Engine By Daniel Reeves. What is Phobos? Lightweight application framework for Java Used by NetBeans Supports multiple scripting languages.
How I spend my money Software architecture course Mohan, Maxim.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Servlet Filters JAVA Enterprise Edition. Servlet Filters Servlet Filters are Java classes that can be used in Servlet Programming for the following purposes:
Cookies (continue). Extracting Data From Cookies Data retrieved from a cookie is a simple text string. While there is no specific JavaScript function.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Web Technologies Lecture 7 Synchronous vs. asynchronous.
©SoftMoore ConsultingSlide 1 Filters. Filters can be used in a web application to intercept, examine, and possibly transform requests or responses associated.
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
(Some from Chapter 11.9 – “Web” 4 th edition and
IS2802 Introduction to Multimedia Applications for Business Lecture 8: JavaScript and Cookies Rob Gleasure
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
October 7 th, 2010 SDU Webship. What did we learn last week? jQuery makes it really easy to select elements and do stuff with them. jQuery can process.
Google Chrome Extensions var title = “ Google Chrome Extensions ”; $(this).attr(“title”, title); $(this).data({ description: ‘How to create and distribute’,
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Web Services Essentials. What is a web service? web service: software functionality that can be invoked through the internet using common protocols like.
AJAX. Objectives Understand and apply AJAX Using AJAX in DOJO library.
Building a Chrome extension Chance Feick |. Outline History Development – Manifest File – Content Scripts – chrome.* API Installation Deployment Live.
Server side. Internet technologies – Ohad © Server-side processing approaches  Server-side UI generation  PHP/ASP.net/JSP  Single Page Application.
Web Storage and Cookies Cookies, Local and Session Storage SoftUni Team Technical Trainers Software University
Ajax & Client-side Dynamic Web Gunwoo Park (Undergraduate)
National College of Science & Information Technology.
Web Security (cont.) 1. Referral issues r HTTP referer (originally referrer) – HTTP header that designates calling resource  Page on which a link is.
Servlets What is a Servlet?
Module 1 Introduction to JavaScript
Essential tools for implementing and testing websites
JavaScript and Ajax (Ajax Tutorial)
WWW and HTTP King Fahd University of Petroleum & Minerals
Java Servlets.
Pre assessment Questions
Web Software Model CS 4640 Programming Languages for Web Applications
Chapter 6 Server-side Programming: Java Servlets
AJAX.
Session V HTML5 APIs - AJAX & JSON
Web scraping tools, an introduction
Asynchronous Javascript And XML
CS320 Web and Internet Programming Cookies and Session Tracking
HTML Level II (CyberAdvantage)
HTML5 AJAX & JSON APIs
JavaScript & jQuery AJAX.
MIS JavaScript and API Workshop (Part 3)
CSc 337 Lecture 27: Cookies.
Tutorial 10: Programming with javascript
CS3220 Web and Internet Programming Cookies and Session Tracking
BOF #1 – Fundamentals of the Web
Introduction to AJAX and JSON
Client Side programming: Javascript, Cookies
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Client-Server Model: Requesting a Web Page
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Introduction to JavaScript
[Based in part on SWE 432 and SWE 632 materials by Jeff Offutt, GMU]
CSc 337 Lecture 25: Cookies.
Presentation transcript:

JSON

JSON JavaScript Object Notation a lightweight text-based open standard designed for human- readable data interchange. Derived from JavaScript for representing singleton

JSON Example { “someString: “asas”, “someNum” : 4, “someArr” : [“aa”,”bb”], “someJson”: { someStr2:”aaa”} }

JSON and AJAX JSON is the most standard data format for ajaxing http://localhost:8888/ajax.html

JSON and JavaScript String to Object: str.parseJSON(); Object to String JSON.stringify(obj);

JSON in Java GSON A free open source that helps translate object<-> JSON http://code.google.com/p/google-gson/ http://sites.google.com/site/gson/gson-user-guide

Cookies

Cookies A piece of text stored by a user's web browser Key-value format May be encrypted With or without an expiration date. Cookies without an expiration date exist until the browser terminates Cookies can’t be used as a virus

Usage HttpSession Personalization Tracking (e.g. “Remember me?”) 3rd parties cookies

Implementation

Cookies and HTTP Cookies are part of the Http request and Response headers Request: “Set-Cookie: name=value“ Response: “Cookie: name=value”

Cookies and JavaEE Adding a cookie: Reading cookies:  Cookie cookie = new Cookie("CName","Cookie Value");   cookie.setMaxAge(100); //in seconds   response.addCookie(cookie); Reading cookies: Cookie[] cookies = request.getCookies();

Cookies and JavaScript Creating a cookie: document.cookie = name+"="+value+expires+"; Reading all cookies: var cookiesArray = document.cookie.split(';'); Erasing a cookie Same as creating whereas “expires = -1”;

Session hijecking

HttpFilters

Filter is like a lightweight servlet that doesn't generate its own content instead it plugs into the request handling process and executes in addition to the normal page processing. Filters can be applied to any resource Filter implements the interface javax.servlet.Filter, and configured in the web application web.xml file doFilter()

Filter Example doFilter(request, response, FilterChain chain) { long startTime = System.currentTimeMillis(); chain.doFilter(request, response); long stopTime = System.currentTimeMillis(); System.out.println("Time to execute request: " + (stopTime - startTime) + " milliseconds"); {

In Web.xml <filter> <filter-name>Timer</filter-name> <filter-class>internet.demo.Timer</filter-class> </filter> <filter-mapping> <url-pattern>/*</url-pattern> // any file.. </filter-mapping

Other usages Auto-redirect to login page … Block access to resources such as pictures..

Servlet 3.0

New Version for servlets Annotations @Servlet(urlMappings={"/MyApp"}) // no web.xml @GET on @POST on any method @ServletFilter @FilterMapping("/foo") // no web.xml Asynchronous Support the Servlet Engine “understands” that this thread can be suspended

Chrome Extensions

Chrome Extension Chrome is a web browser developed by Google It was first released on September 2008 Chrome is the third most widely used browser, with 13.35% of worldwide usage Chrome includes V8 A JS VM

Extension An extension is a zipped bundle of files—HTML, CSS, JavaScript, images.. adds functionality to the Chrome browser. Extensions are essentially web pages.

Popup extension Manifast.json { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "browser_action": "default_icon": "icon.png" "popup": "popup.html" }, "permissions": [ "http://api.flickr.com/" ] }

Background extension Manifast.json { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "background_page": "bg.html", "permissions": [ "http://api.flickr.com/" ] }

The backgroundPage.html: <html> <body> <script type="text/javascript"> //the extension functionality here </script> </body> </html>

API for background chrome.browserAction.onClicked.addListener( function(tab){ //do something when someone click} ); chrome.tabs.executeScript(tabs[i].id, {“code”:code} chrome.management.onInstalled.addListener().. API: http://code.google.com/chrome/extensions/api_index. html

Tutorial http://project67555.appspot.com/extension.html

Q/A