By Abram Adams
@Abram_Adams
aadams@cfxchange.com
https://github.com/abramadams
http://cfml-slack.herokuapp.com/
"...a web application or web site that fits on a single web page with the goal of providing a more fluid user experience akin to a desktop application" - Wikipedia
This is in contrast to traditional web apps that rely on the Request/Response paradigm in which every page is requested from the server.
The Old Way
“REST, or REpresentational State Transfer, is a method for computer programs to talk to each other over networks.” -- Adam Tuttle, REST Assured: A Pragmatic Approach to API Design
“It is a set of generalized conventions that make it easier for API-client developers to understand how to manage data over network protocols —like HTTP— with very little additional context and documentation” -- Adam Tuttle, REST Assured: A Pragmatic Approach to API Design
HTTP:/1.1 200 OK Set-Cookie: cfid=1803 Set-Cookie: cftoken=c95c2c0f0e62813d-39..
"Authentication is the process of verifying who you are. When you log on to an PC with a user name and password you are authenticating." - ServerFault
"Authorization is the process of verifying that you have access to something. Gaining access to a resource (e.g. directory on a hard disk) because the permissions configured on it allow you access is authorization." - ServerFault
<cfheader name=“Content-disposition” value=“attachment;filename=#dafile#”>
<cfcontent file=“#dafile#” type=“application/pdf”>
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
// Start file download.
document.getElementById("dwn-btn").addEventListener("click", function(){
// Generate download of hello.txt file with some content
var text = document.getElementById("text-val").value;
var filename = "hello.txt";
download(filename, text);
}, false);
<a href="/assets/cf.pdf" download target="_self">
Download cf.Objective() Schedule
</a>
OR
<a href="http://myrestendpoint.com/download?filename=server.pdf"
download="server.pdf"
target="_self">
Download Server Details
</a>
// download photo using FileSaver.js
// https://github.com/eligrey/FileSaver.js/
photoService.downloadPhoto( formData ).then( function( data ) {
var blob = new Blob( [ data.data ], { 'type': "image/jpeg" } );
saveAs( blob, formData.fileName + '.jpg' );
} );
https://prerender.io/
@Abram_Adams
aadams@cfxchange.com
https://github.com/abramadams
http://cfml-slack.herokuapp.com/