In this session you will learn:
Format of the HTTP response
How to set status codes
What the status codes are good for
Shortcut methods for redirection and error pages
A servlet that redirects users to browser-specific pages
A front end to various search engines
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
"Please don't touch the slow parts" version 3 given by me at From The Front, Camp Nou Edition on March 18th 2011 in Modena.
It's about improving web applications speed. Based on Steve Souders work. Compared to V2, I improved and expanded on how browsers work and how to optimize dom/css
Also
http://www.ideato.it/
http://federico.galassi.net/
http://www.stevesouders.com/
http://www.bettersoftware.it/
http://www.phpday.it/
http://fromthefront.it/
Follow me on Twitter!
https://twitter.com/federicogalassi
This presentation describe how you can use standard web techniques like Ajax and JSON to work with data in your existing IBM Domino (formerly Lotus Domino) database. It shows how to use jQuery and Bootstrap to build a modern web interface, and explains how to create your own REST API on the Domino server to serve up and process data.
"Please don't touch the slow parts" version 3 given by me at From The Front, Camp Nou Edition on March 18th 2011 in Modena.
It's about improving web applications speed. Based on Steve Souders work. Compared to V2, I improved and expanded on how browsers work and how to optimize dom/css
Also
http://www.ideato.it/
http://federico.galassi.net/
http://www.stevesouders.com/
http://www.bettersoftware.it/
http://www.phpday.it/
http://fromthefront.it/
Follow me on Twitter!
https://twitter.com/federicogalassi
This presentation describe how you can use standard web techniques like Ajax and JSON to work with data in your existing IBM Domino (formerly Lotus Domino) database. It shows how to use jQuery and Bootstrap to build a modern web interface, and explains how to create your own REST API on the Domino server to serve up and process data.
My presentation at MWLUG 2015. I show how to build and connect a modern looking website, built with HTML, CSS, and Javascript/jQuery, to your existing IBM Domino backend data using Ajax and JSON and some simple Lotusscript code.
Ajax Performance Tuning and Best PracticesDoris Chen
Ajax Performance Tuning and Best Practices
Perhaps the most primary motivation to develop Ajax application is to have better user experience hence how to achieve the optimized response time becomes an important aspect in Ajax performance optimization. In this session, we will focus on discussing the improvement of the network transfer time and the JavaScript processing time as the server response is already generally well understood. We will use an Ajax framework case study to show how an Ajax optimization process can be used to optimize the performance. During the optimization process, we will demonstrate how to measure the performance, how to determine the bottlenecks and how to resolve the problems by applying various best practice. Various tools like NetBeans, Firebug, and YSlow will be illustrated to show when to use what and how to use them. The list of Ajax Performance tuning tips on combining CSS and JavaScript resources, setting the correct headers, using minifed JavaScript, GZip contents, and Strategically placing of CSS links and JavaScript tags will be discussed in the session.
Intermediate level Ajax and Enterprise developers can really benefit from this session.
After the session, the audience will be able to:
-apply Ajax Performance Optimization process
-choose the right tool and use them
-lleverage various best practice and performance tuning tips
-improve their Ajax application response time ultimately
Perhaps the most primary motivation to develop Ajax application is to have better user experience hence how to achieve the optimized response time becomes an important aspect in Ajax performance optimization. In this session, we will focus on discussing the improvement of the network transfer time and the JavaScript processing time as the server response is already generally well understood. We will use an Ajax framework case study to show how an Ajax optimization process can be used to optimize the performance. During the optimization process, we will demonstrate how to measure the performance, how to determine the bottlenecks and how to resolve the problems by applying various best practice. Various tools like NetBeans, Firebug, and YSlow will be illustrated to show when to use what and how to use them. The list of Ajax Performance tuning tips on combining CSS and JavaScript resources, setting the correct headers, using minifed JavaScript, GZip contents, and Strategically placing of CSS links and JavaScript tags will be discussed in the session.
Intermediate level Ajax and Enterprise developers can really benefit from this session.
After the session, the audience will be able to:
-apply Ajax Performance Optimization process
-choose the right tool and use them
-lleverage various best practice and performance tuning tips
-improve their Ajax application response time ultimately
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5Cengage Learning
Over the past few years, HTML5 has changed web browsers and coding alike with a stream of new elements,
attributes, and possibilities. In this session we’ll explore the major features that HTML5 offers developers, including
semantic elements, form enhancements, and browser-native audio and video. We’ll also survey the landscape of
browser support and get familiar with strategies for maintaining compatibility with legacy browsers like IE 7 and 8.
Finally, we’ll look at the fundamental changes happening to the process of revising HTML as a language and we’ll
consider some of the likeliest scenarios for the evolution of HTML in coming years.
PPT contains all the data related to J2EE Servlet and JDBC.
Please see the content and share it.
The ppt includes database drivers and servlet related content.
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
In this session, you will learn:
1. Deployment Descriptor
2. Configuring and Mapping a Servlet
3. The flow of the demo web apps
4. JDBC Best practices
5. Design Patterns
Presentation by @aaronpeters at Dutch Web Performance Meetup on August 22 2012.
The presentation covers new stuff in WPT UI, the WPT API, scripting and hidden gems. Awesome tool, but also room for improvement.
My presentation at MWLUG 2015. I show how to build and connect a modern looking website, built with HTML, CSS, and Javascript/jQuery, to your existing IBM Domino backend data using Ajax and JSON and some simple Lotusscript code.
Ajax Performance Tuning and Best PracticesDoris Chen
Ajax Performance Tuning and Best Practices
Perhaps the most primary motivation to develop Ajax application is to have better user experience hence how to achieve the optimized response time becomes an important aspect in Ajax performance optimization. In this session, we will focus on discussing the improvement of the network transfer time and the JavaScript processing time as the server response is already generally well understood. We will use an Ajax framework case study to show how an Ajax optimization process can be used to optimize the performance. During the optimization process, we will demonstrate how to measure the performance, how to determine the bottlenecks and how to resolve the problems by applying various best practice. Various tools like NetBeans, Firebug, and YSlow will be illustrated to show when to use what and how to use them. The list of Ajax Performance tuning tips on combining CSS and JavaScript resources, setting the correct headers, using minifed JavaScript, GZip contents, and Strategically placing of CSS links and JavaScript tags will be discussed in the session.
Intermediate level Ajax and Enterprise developers can really benefit from this session.
After the session, the audience will be able to:
-apply Ajax Performance Optimization process
-choose the right tool and use them
-lleverage various best practice and performance tuning tips
-improve their Ajax application response time ultimately
Perhaps the most primary motivation to develop Ajax application is to have better user experience hence how to achieve the optimized response time becomes an important aspect in Ajax performance optimization. In this session, we will focus on discussing the improvement of the network transfer time and the JavaScript processing time as the server response is already generally well understood. We will use an Ajax framework case study to show how an Ajax optimization process can be used to optimize the performance. During the optimization process, we will demonstrate how to measure the performance, how to determine the bottlenecks and how to resolve the problems by applying various best practice. Various tools like NetBeans, Firebug, and YSlow will be illustrated to show when to use what and how to use them. The list of Ajax Performance tuning tips on combining CSS and JavaScript resources, setting the correct headers, using minifed JavaScript, GZip contents, and Strategically placing of CSS links and JavaScript tags will be discussed in the session.
Intermediate level Ajax and Enterprise developers can really benefit from this session.
After the session, the audience will be able to:
-apply Ajax Performance Optimization process
-choose the right tool and use them
-lleverage various best practice and performance tuning tips
-improve their Ajax application response time ultimately
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5Cengage Learning
Over the past few years, HTML5 has changed web browsers and coding alike with a stream of new elements,
attributes, and possibilities. In this session we’ll explore the major features that HTML5 offers developers, including
semantic elements, form enhancements, and browser-native audio and video. We’ll also survey the landscape of
browser support and get familiar with strategies for maintaining compatibility with legacy browsers like IE 7 and 8.
Finally, we’ll look at the fundamental changes happening to the process of revising HTML as a language and we’ll
consider some of the likeliest scenarios for the evolution of HTML in coming years.
PPT contains all the data related to J2EE Servlet and JDBC.
Please see the content and share it.
The ppt includes database drivers and servlet related content.
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
In this session, you will learn:
1. Deployment Descriptor
2. Configuring and Mapping a Servlet
3. The flow of the demo web apps
4. JDBC Best practices
5. Design Patterns
Presentation by @aaronpeters at Dutch Web Performance Meetup on August 22 2012.
The presentation covers new stuff in WPT UI, the WPT API, scripting and hidden gems. Awesome tool, but also room for improvement.
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...Amazon Web Services
In this series of 15-minute technical flash talks you will learn directly from Amazon CloudFront engineers and their best practices on debugging caching issues, measuring performance using Real User Monitoring (RUM), and stopping malicious viewers using CloudFront and AWS WAF.
Organizations focus process optimization of
Data Tier
Application Tier
Presentation Tier is usually ignored.
Presentation Tier is responsible for more than 30% of Client/Server application performance.
Building production websites with Node.js on the Microsoft stackCellarTracker
Node.js on Windows, in production, may not be the most common configuration – but it’s immensely powerful with the help of edge.js, iisnode, and other open source projects. In fact, it’s a great tool for building highly performant, scalable front- and back-end websites on the Microsoft stack (IIS, .NET, SQL Server, etc).
In this talk, I’ll share some details, tips-and-tricks, and experiences building a production website on Windows, using CellarTracker – the world’s largest collection of community wine reviews and tools for cellar management – as an example.
This session introduces tools that can help you analyze and troubleshoot performance with SharePoint 2013. This sessions presents tools like perfmon, Fiddler, Visual Round Trip Analyzer, IIS LogParser, Developer Dashboard and of course we create Web and Load Tests in Visual Studio 2013.
At the end we also take a look at some of the tips and best practices to improve performance on SharePoint 2013.
Code for Startup MVP (Ruby on Rails) Session 1Henry S
First Session on Learning to Code for Startup MVP's using Ruby on Rails.
This session covers the web architecture, Git/GitHub and makes a real rails app that is deployed to Heroku at the end.
Thanks,
Henry
In this session you will learn:
background and goals of generic programming
basics of generic classes = parameterized types
generic methods for general algorithms
inheritance rules for generic types
bounded type parameters
generic code and the Java Virtual Machine
restrictions and limitations
wildcard types and wildcard type capture
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Objects
Collections
Garbage Collection
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Flow Control
Exceptions
Assertions
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Object Orientation
Overloading
Overriding
Constructor
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Declarations and Access Control
Class Modifiers
Access Modifiers for Members
Non-Access Modifiers for Members
More Member Modifiers
Modifiers for Inner Classes
Class Declarations
Interface Declarations
Implementing an Interface
main() Method
Extra points to remember
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Introduction to Databases
Advantages of Database Systems
Database Languages
Distributed Database
Relational Database Model
Structured Query Language (SQL)
Basic Ingredients of JDBC
Supplying Values for Prepared Statement Parameters
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Threads
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Inner Classes
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Including Files at Request Time: jsp:include
Understanding jsp:include vs. <%@ include … %>
Options for Deploying Applets
Using jsp:plugin
Attributes of the jsp:plugin Element
Using JavaBeans Components in JSP Documents
Background: What Are Beans?
Using Beans: Basic Tasks
Setting Simple Bean Properties: jsp:setProperty
JSP Page That Uses StringBean(Code)
Conditional Bean Operations
Sharing Beans in Four Different Ways
Session-Based Sharing: Code
Application-Based Sharing: Code
Application-Based Sharing: Result
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
The Need for JSP
The JSP Framework
Benefits of JSP
Advantages of JSP Over Competing Technologies
Setting Up Your Environment
Invoking Java Code with JSP Scripting Elements
Uses of JSP Constructs
Design Strategy: Limit Java Code in JSP Pages
Basic Syntax
Types of Scripting Elements
JSP Expressions
JSP/Servlet Correspondence
Predefined Variables
Controlling the Structure of Generated Servlets
Purpose of the page Directive
The import Attribute
The contentType and page encoding Attributes
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Streams
Using a stream
Manipulating the input data
Basics of the LineReader constructor
The LineWriter class
Flushing the buffer
PrintWriter
About FileDialogs
Typical FileDialog window
FileDialog constructors
Useful FileDialog methods I
Useful FileDialog methods II
Serialization
Conditions for serializability
Writing objects to a file
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Introduction
Architecture
The Persistence Lifecycle
Getting Started
Relationships and Associations
Advanced Mapping Concepts
Hibernate Queries
Hibernate Transactions
Hibernate Extensions
Hibernate Cache
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
In this session you will learn:
Java History
Features of Java
Java Versions
Application Area
For more information, visit this link: https://www.mindsmapped.com/courses/software-development/online-java-training-for-beginners/
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
2. Page 2Classification: Restricted
Agenda
• Format of the HTTP response
• How to set status codes
• What the status codes are good for
• Shortcut methods for redirection and error pages
• A servlet that redirects users to browser-specific pages
• A front end to various search engines
4. Page 4Classification: Restricted
• response.setStatus(int statusCode)
– Use a constant for the code, not an explicit int.
Constants are in HttpServletResponse
– Names derived from standard message.
E.g., SC_OK, SC_NOT_FOUND, etc.
• response.sendError(int code,
String message)
– Wraps message inside small HTML document
• response.sendRedirect(String url)
– Sets status code to 302
– Sets Location response header also
Setting Status Codes
5. Page 5Classification: Restricted
• 200 (OK)
– Everything is fine; document follows.
– Default for servlets.
• 204 (No Content)
– Browser should keep displaying previous document.
• 301 (Moved Permanently)
– Requested document permanently moved elsewhere (indicated in
Location header).
– Browsers go to new location automatically.
Common HTTP 1.1 Status Codes
6. Page 6Classification: Restricted
• 302 (Found)
– Requested document temporarily moved elsewhere (indicated in Location
header).
– Browsers go to new location automatically.
– Servlets should use sendRedirect, not setStatus, when setting this header.
See example.
• 401 (Unauthorized)
– Browser tried to access password-protected page without proper
Authorization header.
• 404 (Not Found)
– No such page. Servlets should use sendError to set this.
– Problem: Internet Explorer and small (< 512KB) error pages. IE ignores
error page by default.
– Fun and games: http://www.plinko.net/404/
Common HTTP 1.1 Status Codes (Continued)
7. Page 7Classification: Restricted
• public class WrongDestination extends HttpServlet {
• public void doGet(HttpServletRequest request,
• HttpServletResponse response)
• throws ServletException, IOException {
• String userAgent = request.getHeader("User-Agent");
• if ((userAgent != null) &&
• (userAgent.indexOf("MSIE") != -1)) {
• response.sendRedirect("http://home.netscape.com");
• } else {
• response.sendRedirect("http://www.microsoft.com");
• }
• }
• }
A Servlet That Redirects Users to Browser-Specific Pages
10. Page 10Classification: Restricted
Agenda
• Format of the HTTP response
• Setting response headers
• Understanding what response headers are good for
• Building Excel spread sheets
• Sending incremental updates
to the browser
12. Page 12Classification: Restricted
• public void setHeader(String headerName,
String headerValue)
– Sets an arbitrary header
• public void setDateHeader(String name,
long millisecs)
– Converts milliseconds since 1970 to a date string
in GMT format
• public void setIntHeader(String name,
int headerValue)
– Prevents need to convert int to String before calling setHeader
• addHeader, addDateHeader, addIntHeader
– Adds new occurrence of header instead of replacing
Setting Arbitrary Response Headers
13. Page 13Classification: Restricted
• setContentType
– Sets the Content-Type header.
– Servlets almost always use this.
– See table of common MIME types.
• setContentLength
– Sets the Content-Length header.
– Used for persistent HTTP connections.
– See Connection request header.
• addCookie
– Adds a value to the Set-Cookie header.
– See separate section on cookies.
• sendRedirect
– Sets the Location header (plus changes status code).
Setting Arbitrary Response Headers
14. Page 14Classification: Restricted
Type Meaning
application/msword Microsoft Word document
application/octet-stream Unrecognized or binary data
application/pdf Acrobat (.pdf) file
application/postscript PostScript file
application/vnd.ms-excel Excel spreadsheet
application/vnd.ms-powerpoint Powerpoint presentation
application/x-gzip Gzip archive
application/x-java-archive JAR file
application/x-java-vm Java bytecode (.class) file
application/zip Zip archive
audio/basic Sound file in .au or .snd format
audio/x-aiff AIFF sound file
audio/x-wav Microsoft Windows sound file
audio/midi MIDI sound file
text/css HTML cascading style sheet
text/html HTML document
text/plain Plain text
text/xml XML document
image/gif GIF image
image/jpeg JPEG image
image/png PNG image
image/tiff TIFF image
video/mpeg MPEG video clip
video/quicktime QuickTime video clip
Common MIME Types
15. Page 15Classification: Restricted
• Cache-Control (1.1) and Pragma (1.0)
– A no-cache value prevents browsers from caching page.
• Content-Disposition
– Lets you request that the browser ask the user to save the response to
disk in a file of the given name
• Content-Disposition: attachment; filename=file-name
• Content-Encoding
– The way document is encoded. See earlier compression example
• Content-Length
– The number of bytes in the response.
– See setContentLength on previous slide.
– Use ByteArrayOutputStream to buffer document before sending it, so
that you can determine size. See discussion of the Connection request
header
Common HTTP 1.1 Response Headers
16. Page 16Classification: Restricted
• Content-Type
– The MIME type of the document being returned.
– Use setContentType to set this header.
• Expires
– The time at which document should be considered out-of-date and thus
should no longer be cached.
– Use setDateHeader to set this header.
• Last-Modified
– The time document was last changed.
– Don’t set this header explicitly; provide a getLastModified method
instead. See lottery number example in book (Chapter 3).
Common HTTP 1.1 Response Headers (Continued)
17. Page 17Classification: Restricted
• Location
– The URL to which browser should reconnect.
– Use sendRedirect instead of setting this directly.
• Refresh
– The number of seconds until browser should reload page. Can also
include URL to connect to.
See following example.
• Set-Cookie
– The cookies that browser should remember. Don’t set this header
directly; use addCookie instead. See next section.
• WWW-Authenticate
– The authorization type and realm needed in Authorization header. See
security chapters in More Servlets & JSP.
Common HTTP 1.1 Response Headers (Continued)
19. Page 19Classification: Restricted
Agenda
• Understanding the benefits and drawbacks of cookies
• Sending outgoing cookies
• Receiving incoming cookies
• Tracking repeat visitors
• Specifying cookie attributes
• Differentiating between session cookies and persistent cookies
• Simplifying cookie usage with utility classes
• Modifying cookie values
• Remembering user preferences
20. Page 20Classification: Restricted
• Idea
– Servlet sends a simple name and value to client.
– Client returns same name and value when it connects to same site (or
same domain, depending on cookie settings).
• Typical Uses of Cookies
– Identifying a user during an e-commerce session
• Servlets have a higher-level API for this task
– Avoiding username and password
– Customizing a site
– Focusing advertising
The Potential of Cookies
22. Page 22Classification: Restricted
• The problem is privacy, not security.
– Servers can remember your previous actions
– If you give out personal information, servers can link that information to
your previous actions
– Servers can share cookie information through use of a cooperating third
party like doubleclick.net
– Poorly designed sites store sensitive information like credit card numbers
directly in cookie
– JavaScript bugs let hostile sites steal cookies (old browsers)
• Moral for servlet authors
– If cookies are not critical to your task, avoid servlets that totally fail when
cookies are disabled
– Don't put sensitive info in cookies
Some Problems with Cookies
24. Page 24Classification: Restricted
• Create a Cookie object.
– Call the Cookie constructor with a cookie name and a cookie value, both
of which are strings.
• Cookie c = new Cookie("userID", "a1234");
• Set the maximum age.
– To tell browser to store cookie on disk instead of just in memory, use
setMaxAge (argument is in seconds)
• c.setMaxAge(60*60*24*7); // One week
• Place the Cookie into the HTTP response
– Use response.addCookie.
– If you forget this step, no cookie is sent to the browser!
• response.addCookie(c);
Sending Cookies to the Client
25. Page 25Classification: Restricted
• Call request.getCookies
– This yields an array of Cookie objects.
• Loop down the array, calling getName on each entry until you find the
cookie of interest
– Use the value (getValue) in application-specific way.
– String cookieName = "userID";
– Cookie[] cookies = request.getCookies();
– if (cookies != null) {
– for(int i=0; i<cookies.length; i++) {
– Cookie cookie = cookies[i];
– if (cookieName.equals(cookie.getName())) {
– doSomethingWith(cookie.getValue());
– }
– }
– }
Reading Cookies from the Client
26. Page 26Classification: Restricted
• public class RepeatVisitor extends HttpServlet {
• public void doGet(HttpServletRequest request,
• HttpServletResponse response)
• throws ServletException, IOException {
• boolean newbie = true;
• Cookie[] cookies = request.getCookies();
• if (cookies != null) {
• for(int i=0; i<cookies.length; i++) {
• Cookie c = cookies[i];
• if ((c.getName().equals("repeatVisitor"))&&
• (c.getValue().equals("yes"))) {
• newbie = false;
• break;
• }
• }
• }
Using Cookies to Detect First-Time Visitors
27. Page 27Classification: Restricted
• String title;
• if (newbie) {
• Cookie returnVisitorCookie =
• new Cookie("repeatVisitor", "yes");
• returnVisitorCookie.setMaxAge(60*60*24*365);
• response.addCookie(returnVisitorCookie);
• title = "Welcome Aboard";
• } else {
• title = "Welcome Back";
• }
• response.setContentType("text/html");
• PrintWriter out = response.getWriter();
• … // (Output page with above title)
Using Cookies to Detect First-Time Visitors (Continued)
29. Page 29Classification: Restricted
• getDomain/setDomain
– Lets you specify domain to which cookie applies. Current host must be
part of domain specified.
• getMaxAge/setMaxAge
– Gets/sets the cookie expiration time (in seconds). If you fail to set this,
cookie applies to current browsing session only. See LongLivedCookie
helper class given earlier.
• getName
– Gets the cookie name. There is no setName method; you supply name to
constructor. For incoming cookie array, you use getName to find the
cookie of interest.
Using Cookie Attributes
30. Page 30Classification: Restricted
• getPath/setPath
– Gets/sets the path to which cookie applies. If unspecified, cookie applies
to URLs that are within or below directory containing current page.
• getSecure/setSecure
– Gets/sets flag indicating whether cookie should apply only to SSL
connections or to all connections.
• getValue/setValue
– Gets/sets value associated with cookie. For new cookies, you supply value
to constructor, not to setValue. For incoming cookie array, you use
getName to find the cookie of interest, then call getValue on the result. If
you set the value of an incoming cookie, you still have to send it back out
with response.addCookie.
Using Cookie Attributes
31. Page 31Classification: Restricted
• public class CookieTest extends HttpServlet {
• public void doGet(HttpServletRequest request,
• HttpServletResponse response)
• throws ServletException, IOException {
• for(int i=0; i<3; i++) {
• Cookie cookie =
• new Cookie("Session-Cookie-" + i,
• "Cookie-Value-S" + i);
• // No maxAge (ie maxAge = -1)
• response.addCookie(cookie);
• cookie = new Cookie("Persistent-Cookie-" + i,
• "Cookie-Value-P" + i);
• cookie.setMaxAge(3600);
• response.addCookie(cookie);
• }
Differentiating Session Cookies from Persistent Cookies
32. Page 32Classification: Restricted
Differentiating Session Cookies from Persistent Cookies (Cont)
• … // Start an HTML table
• Cookie[] cookies = request.getCookies();
• if (cookies == null) {
• out.println("<TR><TH COLSPAN=2>No cookies");
• } else {
• Cookie cookie;
• for(int i=0; i<cookies.length; i++) {
• cookie = cookies[i];
• out.println
• ("<TR>n" +
• " <TD>" + cookie.getName() + "n" +
• " <TD>" + cookie.getValue());
• }
• }
33. Page 33Classification: Restricted
• Result of initial visit to CookieTest servlet
– Same result as when visiting the servlet, quitting the browser, waiting an
hour, and revisiting the servlet.
Differentiating Session Cookies from Persistent Cookies
34. Page 34Classification: Restricted
• Result of revisiting CookieTest within an hour of original visit (same browser
session)
– I.e., browser stayed open between the original visit and the visit shown
here
Differentiating Session Cookies from Persistent Cookies
36. Page 36Classification: Restricted
• Implementing session tracking from scratch
• Using basic session tracking
• Understanding the session-tracking API
• Differentiating between server and browser sessions
• Encoding URLs
• Storing immutable objects vs. storing mutable objects
• Tracking user access counts
• Accumulating user purchases
• Implementing a shopping cart
• Building an online store
Agenda
37. Page 37Classification: Restricted
• Idea: associate cookie with data on server
– String sessionID = makeUniqueString();
– HashMap sessionInfo = new HashMap();
– HashMap globalTable = findTableStoringSessions();
– globalTable.put(sessionID, sessionInfo);
– Cookie sessionCookie =
– new Cookie("JSESSIONID", sessionID);
– sessionCookie.setPath("/");
– response.addCookie(sessionCookie);
• Still to be done:
– Extracting cookie that stores session identifier
– Setting appropriate expiration time for cookie
– Associating the hash tables with each request
– Generating the unique session identifiers
Rolling Your Own Session Tracking: Cookies
38. Page 38Classification: Restricted
• Idea
– Client appends some extra data on the end of each URL that identifies the
session
– Server associates that identifier with data it has stored about that session
– E.g., http://host/path/file.html;jsessionid=1234
• Advantage
– Works even if cookies are disabled or unsupported
• Disadvantages
– Must encode all URLs that refer to your own site
– All pages must be dynamically generated
– Fails for bookmarks and links from other sites
Rolling Your Own Session Tracking: URL-Rewriting
39. Page 39Classification: Restricted
• Idea:
– <INPUT TYPE="HIDDEN" NAME="session" VALUE="...">
• Advantage
– Works even if cookies are disabled or unsupported
• Disadvantages
– Lots of tedious processing
– All pages must be the result of form submissions
Rolling Your Own Session Tracking: Hidden Form Fields
40. Page 40Classification: Restricted
• Session objects live on the server
• Sessions automatically associated with client via cookies or URL-rewriting
– Use request.getSession to get session
• Behind the scenes, the system looks at cookie or URL extra info and
sees if it matches the key to some previously stored session object. If
so, it returns that object. If not, it creates a new one, assigns a cookie
or URL info as its key, and returns that new session object.
• Hashtable-like mechanism lets you store arbitrary objects inside session
– setAttribute stores values
– getAttribute retrieves values
Session Tracking in Java
41. Page 41Classification: Restricted
• Access the session object
– Call request.getSession to get HttpSession object
• This is a hashtable associated with the user
• Look up information associated with a session.
– Call getAttribute on the HttpSession object, cast the return value to the
appropriate type, and check whether the result is null.
• Store information in a session.
– Use setAttribute with a key and a value.
• Discard session data.
– Call removeAttribute discards a specific value.
– Call invalidate to discard an entire session.
– Call logout to log the client out of the Web/app server
Session Tracking Basics
42. Page 42Classification: Restricted
• HttpSession session = request.getSession();
• SomeClass value =
• (SomeClass)session.getAttribute("someID");
• if (value == null) {
• value = new SomeClass(...);
• session.setAttribute("someID", value);
• }
• doSomethingWith(value);
– Do not need to call setAttribute again (after modifying value) if the
modified value is the same object. But, if value is immutable, modified
value will be a new object reference, and you must call setAttribute again.
Session Tracking Basics: Sample Code
43. Page 43Classification: Restricted
• Session tracking code:
– No change
• Code that generates hypertext links back to same site:
– Pass URL through response.encodeURL.
• If server is using cookies, this returns URL unchanged
• If server is using URL rewriting, this appends the session info to the
URL
• E.g.:
String url = "order-page.html";
url = response.encodeURL(url);
• Code that does sendRedirect to own site:
– Pass URL through response.encodeRedirectURL
What Changes if Server Uses URL Rewriting?
44. Page 44Classification: Restricted
• getAttribute
– Extracts a previously stored value from a session object. Returns null if no
value is associated with given name.
• setAttribute
– Associates a value with a name. Monitor changes: values implement
HttpSessionBindingListener.
• removeAttribute
– Removes values associated with name.
• getAttributeNames
– Returns names of all attributes in the session.
• getId
– Returns the unique identifier.
HttpSession Methods
45. Page 45Classification: Restricted
• isNew
– Determines if session is new to client (not to page)
• getCreationTime
– Returns time at which session was first created
• getLastAccessedTime
– Returns time at which session was last sent from client
• getMaxInactiveInterval, setMaxInactiveInterval
– Gets or sets the amount of time session should go without access before
being invalidated
• invalidate
– Invalidates current session
• logout
– Invalidates all sessions associated with user
HttpSession Methods (Continued)