This document discusses web applications and their structure. It begins by defining what a web application is - a single directory or file that bundles together related files like servlets, JSP pages, HTML files, and configuration files. It then discusses the standard structure of web applications, including where different file types like Java code, web content, and configuration files are typically located. The document provides an example of a typical deployment structure.
These slides were presented by Dan Gillean at the first ever AtoM Camp, held at the SFU Harbour Centre in Vancouver, BC, Canada, March 20-22, 2017. For more information on the Camp, see:
https://wiki.accesstomemory.org/Community/Camps/SFU2017
These slides introduce some of the primary Command Line tasks available in Access to Memory (AtoM), which can be used to support site maintenance and troubleshooting. For further information on AtoM CLI tasks, see:
* https://www.accesstomemory.org/docs/latest/admin-manual/maintenance/cli-tools/
* https://www.youtube.com/playlist?list=PLZiwlG5eSMeyeETe15EsEBSu5htPLK-wm
The CLI tasks introduced in these slides are based on the 2.4 AtoM release - some tasks or task options may not be available in earlier releases; tasks may be changed in future releases.
These slides accompanied a presentation by Steve Breker of Artefactual Systems, delivered as part of AtoM Camp Cambridge, a three-day boot camp held at St John's College, Cambridge University, May 9-11, 2017 For more information, see:
https://wiki.accesstomemory.org/Community/Camps/SJC2017
These slides are intended for developers who are interested in modifying the default look and feel of AtoM - known as the Dominion theme - and developing a custom theme plugin. They include some theme examples, how to register a plugin in Symfony, and some ideas of the elements you can modify via theming, with examples.
These slides accompanied a presentation by Steve Breker of Artefactual Systems, delivered as part of AtoM Camp Cambridge, a three-day boot camp held at St John's College, Cambridge University, May 9-11, 2017 For more information, see: https://wiki.accesstomemory.org/Community/Camps/SJC2017
These slides introduce users to the Access to Memory codebase. You can find AtoM's code at: https://github.com/artefactual/atom/
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on TomcatDavid Blevins
Having made its Java EE 6 Web Profile certification debut at JavaOne 2011 and having won a JavaOne Rock Star award in 2012, Apache TomEE combines the simplicity of Tomcat with the power of Java EE. This updated presentation traverses the world of TomEE and shows how Tomcat applications leveraging Java EE technologies can become simpler and lighter with a Java EE–certified solution built right on Tomcat. The first part jumps right into action and gives a coding tour of TomEE, including quickly bootstrapping projects, doing proper testing with Arquillian, and setting up environments. The second part gives insight into how TomEE was created and explores the budding TomEE ecosystem of tools, platforms, and the latest community advancements.
These slides were presented by Dan Gillean at the first ever AtoM Camp, held at the SFU Harbour Centre in Vancouver, BC, Canada, March 20-22, 2017. For more information on the Camp, see:
https://wiki.accesstomemory.org/Community/Camps/SFU2017
These slides introduce some of the primary Command Line tasks available in Access to Memory (AtoM), which can be used to support site maintenance and troubleshooting. For further information on AtoM CLI tasks, see:
* https://www.accesstomemory.org/docs/latest/admin-manual/maintenance/cli-tools/
* https://www.youtube.com/playlist?list=PLZiwlG5eSMeyeETe15EsEBSu5htPLK-wm
The CLI tasks introduced in these slides are based on the 2.4 AtoM release - some tasks or task options may not be available in earlier releases; tasks may be changed in future releases.
These slides accompanied a presentation by Steve Breker of Artefactual Systems, delivered as part of AtoM Camp Cambridge, a three-day boot camp held at St John's College, Cambridge University, May 9-11, 2017 For more information, see:
https://wiki.accesstomemory.org/Community/Camps/SJC2017
These slides are intended for developers who are interested in modifying the default look and feel of AtoM - known as the Dominion theme - and developing a custom theme plugin. They include some theme examples, how to register a plugin in Symfony, and some ideas of the elements you can modify via theming, with examples.
These slides accompanied a presentation by Steve Breker of Artefactual Systems, delivered as part of AtoM Camp Cambridge, a three-day boot camp held at St John's College, Cambridge University, May 9-11, 2017 For more information, see: https://wiki.accesstomemory.org/Community/Camps/SJC2017
These slides introduce users to the Access to Memory codebase. You can find AtoM's code at: https://github.com/artefactual/atom/
JavaOne 2013 - Apache TomEE, Java EE Web Profile {and more} on TomcatDavid Blevins
Having made its Java EE 6 Web Profile certification debut at JavaOne 2011 and having won a JavaOne Rock Star award in 2012, Apache TomEE combines the simplicity of Tomcat with the power of Java EE. This updated presentation traverses the world of TomEE and shows how Tomcat applications leveraging Java EE technologies can become simpler and lighter with a Java EE–certified solution built right on Tomcat. The first part jumps right into action and gives a coding tour of TomEE, including quickly bootstrapping projects, doing proper testing with Arquillian, and setting up environments. The second part gives insight into how TomEE was created and explores the budding TomEE ecosystem of tools, platforms, and the latest community advancements.
All the Laravel things: up and running to making $$Joe Ferguson
Laravel 5 has established itself as one of the best PHP rapid application development frameworks. Come learn about all the tools in the Laravel ecosystem designed to save you time and prevent you from writing the boring cruft you have to write for every application. We'll cover getting started with local development, building a basic application, and deploying to production. We'll review how Laravel easily handles vagrant, testing, oauth login services, billing and subscriptions services through Laravel Spark, and deploying your application with services such as Laravel Envoyer and Forge to manage your servers.
php[world] 2015 Laravel 5.1: From Homestead to the CloudJoe Ferguson
With the recent release of Laravel Forge, Envoyer, and Homestead, it has never been easier to go from nothing to something with an easy-to-use PHP framework. This talk will cover creating a basic Laravel application using the Laravel-specific Vagrant box Homestead, connecting to a server (Linode, Rackspace, Digital Ocean), and deploying the application via Forge. The talk will also cover tips and tricks on customizing Homestead to fit your custom needs, as well as how to use Forge & Envoyer to deploy new versions of our application.
DSpace UI Prototype Challenge: Spring Boot + ThymeleafTim Donohue
Presentation of my user interface prototype (#1) using Spring Boot + Thymeleaf for the DSpace UI Prototype Challenge:
https://wiki.duraspace.org/display/DSPACE/DSpace+UI+Prototype+Challenge
NOTE: As this was just a prototype/proof-of-concept there are NO GUARANTEES that this work will become a new User interface.
Abstract:
A apresentação centra-se na temática de ter forma de controlar, versionar e actualizar toda a parte de Base de Dados de um projecto. Estamos a falar, desde a produção de modelos ER, a versionamento de scripts, passando pelo deploy dos mesmos e terminado na documentação. A apresentação conta ainda com uma breve demonstração do uso da ferramenta Flyway para versionar e controlar a execução de scripts nos diversos ambientes de um projecto.
Sobre o Nuno Alves:
Chamo-me Nuno Alves nascido em Coimbra, Portugal e vivi maioritariamente em Leiria. Licenciado em Engenharia Informática na ESTG-IPLeiria (Escola Superior de Tecnologia e Gestão) onde o gosto por dados e bases de dados se começou a desenvolver. Daí, profissionalmente a minha área de actuação ser em torno de bases de dados e infra-estruturas. Tenho cerca de 10 anos de experiência repartidos pelas áreas Financeira, Seguros, Governo, Militar em tecnologias que vão desde Oracle, PostgreSQL, MSSQLServer a DB2.
Z-Ray: A customizable development tool belt (Zendcon 2016)Mathew Beane
Using Zend Z-Ray offers PHP developers a very powerful suite of tools out-of-the-box. Extending Z-Ray is easy and allows for nearly limitless customizable development tools. An exploration of Z-Ray plugin features will give attendees a foundation for creating their own Z-Ray extensions.
This session will show how to develop Z-Ray plugins for your applications and frameworks. Covering the Z-Ray plugins structure, storing and displaying data, tracing functions and files, utilizing the tree widget, how to format your data for use in Z-Ray, and modifying the way data is displayed in Z-Ray.
The new GraalVM from Oracle supports multiple language including JavaScript, Python, Ruby, R, C++ as well as Java and other JVM languages. This opens up interesting possibilities for polygot enterprise applications. Now you can use a Node library in a Java application or call an R statistical function from an EJB. Previously, this type of integration was extremely challenging. This session will provide recipes to get up and running along with best practices and some cool demos.
Code: https://github.com/rcuprak/graalvm_jee
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Gavin Pickin
Vagrant is a great solution for providing all of your devs a standard dev environment, but like all the other great technology out there, you have to learn it, and then implement it.
Not anymore, this session will give you a well used, documented Vagrant Setup, with the flexibility to use it for all of your future dev projects too. Learn how this Vagrant Environment is setup, and how to extend it. Kill the learning curve, and spin it up today.
This setup is being used by several devs, on several projects, and has simple flexibility built in. Drop your repos in the main folder, follow simple conventions, and add a small amount of configuration and be able to spin up your environment in minutes. This setup can configure a simple welcome page, configure the web server and cfml engine mappings, datasources, web server settings per site, host entries, and much more.
As great as this sounds, nothing is ever perfect, learn how some assumptions left me looking silly, and owing another developer a meal, and how I resolved that issue and made this vagrant setup even better.
All the Laravel things: up and running to making $$Joe Ferguson
Laravel 5 has established itself as one of the best PHP rapid application development frameworks. Come learn about all the tools in the Laravel ecosystem designed to save you time and prevent you from writing the boring cruft you have to write for every application. We'll cover getting started with local development, building a basic application, and deploying to production. We'll review how Laravel easily handles vagrant, testing, oauth login services, billing and subscriptions services through Laravel Spark, and deploying your application with services such as Laravel Envoyer and Forge to manage your servers.
php[world] 2015 Laravel 5.1: From Homestead to the CloudJoe Ferguson
With the recent release of Laravel Forge, Envoyer, and Homestead, it has never been easier to go from nothing to something with an easy-to-use PHP framework. This talk will cover creating a basic Laravel application using the Laravel-specific Vagrant box Homestead, connecting to a server (Linode, Rackspace, Digital Ocean), and deploying the application via Forge. The talk will also cover tips and tricks on customizing Homestead to fit your custom needs, as well as how to use Forge & Envoyer to deploy new versions of our application.
DSpace UI Prototype Challenge: Spring Boot + ThymeleafTim Donohue
Presentation of my user interface prototype (#1) using Spring Boot + Thymeleaf for the DSpace UI Prototype Challenge:
https://wiki.duraspace.org/display/DSPACE/DSpace+UI+Prototype+Challenge
NOTE: As this was just a prototype/proof-of-concept there are NO GUARANTEES that this work will become a new User interface.
Abstract:
A apresentação centra-se na temática de ter forma de controlar, versionar e actualizar toda a parte de Base de Dados de um projecto. Estamos a falar, desde a produção de modelos ER, a versionamento de scripts, passando pelo deploy dos mesmos e terminado na documentação. A apresentação conta ainda com uma breve demonstração do uso da ferramenta Flyway para versionar e controlar a execução de scripts nos diversos ambientes de um projecto.
Sobre o Nuno Alves:
Chamo-me Nuno Alves nascido em Coimbra, Portugal e vivi maioritariamente em Leiria. Licenciado em Engenharia Informática na ESTG-IPLeiria (Escola Superior de Tecnologia e Gestão) onde o gosto por dados e bases de dados se começou a desenvolver. Daí, profissionalmente a minha área de actuação ser em torno de bases de dados e infra-estruturas. Tenho cerca de 10 anos de experiência repartidos pelas áreas Financeira, Seguros, Governo, Militar em tecnologias que vão desde Oracle, PostgreSQL, MSSQLServer a DB2.
Z-Ray: A customizable development tool belt (Zendcon 2016)Mathew Beane
Using Zend Z-Ray offers PHP developers a very powerful suite of tools out-of-the-box. Extending Z-Ray is easy and allows for nearly limitless customizable development tools. An exploration of Z-Ray plugin features will give attendees a foundation for creating their own Z-Ray extensions.
This session will show how to develop Z-Ray plugins for your applications and frameworks. Covering the Z-Ray plugins structure, storing and displaying data, tracing functions and files, utilizing the tree widget, how to format your data for use in Z-Ray, and modifying the way data is displayed in Z-Ray.
The new GraalVM from Oracle supports multiple language including JavaScript, Python, Ruby, R, C++ as well as Java and other JVM languages. This opens up interesting possibilities for polygot enterprise applications. Now you can use a Node library in a Java application or call an R statistical function from an EJB. Previously, this type of integration was extremely challenging. This session will provide recipes to get up and running along with best practices and some cool demos.
Code: https://github.com/rcuprak/graalvm_jee
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Gavin Pickin
Vagrant is a great solution for providing all of your devs a standard dev environment, but like all the other great technology out there, you have to learn it, and then implement it.
Not anymore, this session will give you a well used, documented Vagrant Setup, with the flexibility to use it for all of your future dev projects too. Learn how this Vagrant Environment is setup, and how to extend it. Kill the learning curve, and spin it up today.
This setup is being used by several devs, on several projects, and has simple flexibility built in. Drop your repos in the main folder, follow simple conventions, and add a small amount of configuration and be able to spin up your environment in minutes. This setup can configure a simple welcome page, configure the web server and cfml engine mappings, datasources, web server settings per site, host entries, and much more.
As great as this sounds, nothing is ever perfect, learn how some assumptions left me looking silly, and owing another developer a meal, and how I resolved that issue and made this vagrant setup even better.
The Change! Tool is a comprehensive evaluation and project management
tool with a history of rigorous development and testing. The Tool enables
practitioners to evaluate the impact of community engagement projects
that bring about behaviour change towards sustainable lifestyles.
Extending Build to the Client: A Maven User's Guide to Grunt.jsPetr Jiricka
Maven is now established as the de facto standard build tool for Java web applications. But what if the application makes extensive use of modern client-side technologies like AngularJS or Ember framework, CSS processors like SASS/LESS, Bower package manager, what if we need to compress and minify JavaScript and CSS files? In that case it makes sense to have a dedicated build infrastructure for the client.
Enter Grunt.js, a build tool specifically made for the client side. In this BOF, we will explore combining the use of Maven for the server side with Grunt.js for the client.
APEX Application Lifecycle and Deployment 20220714.pdfRichard Martens
APEX application deployment is mostly done by exporting the application and importing it into the target environment.
But what if your team continuously develops (as they should), where do you stop developing to start preparing your release-deployment? You should be able to deploy based on features; without your developers having to halt their development.
Using the deployment-method explained in this presentation you will be able to do just that.
The method includes things like Code versioning (GIT), Feature-tickets (Jira), Code Review (Quality), Automated Deployment using Jenkins and Flyway. When implemented you will be able to successfully and predictively deploy your APEX applications (including underlying database objects) to the different deployment-environments.
With a few modifications you can even upgrade the methodology to be a "continuous delivery" methodology.
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
This presentation explores the features of Maven 2, a software build tool that has achieved prominence in the Java development arena. Find out how Maven can be leveraged to automate key project tasks.
Alfresco Share provides a rich platform for further development, allowing you to tweak and customize to your heart’s content, using only lightweight scripting and templating. But with great power, comes great responsibility, as they say. So this session looks at what it means to customize Share, before discussing how best to go about it, with tips and tricks based on real-world examples.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
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.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
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.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
2. Agenda
• Purpose of Web applications
• Structure of Web applications
• Setting up Web applications with Tomcat
• Sharing data among Web applications
4
Idea of Web Applications
• Single directory or file
– Servlets, JSP pages, HTML files, utility classes, beans,
tag libraries, etc. are bundled together in a single
directory hierarchy or filedirectory hierarchy or file
• Common URL prefix
– Access to content in the Web app is always through app y g
URL that has a common prefix
– http://host/webAppPrefix/blah/blah
eb ml controls man things• web.xml controls many things
– Many aspects of Web application behavior controlled
through deployment descriptor (web.xml)
5
through deployment descriptor (web.xml)
• The deployment descriptor is covered in detail in the next
section.
3. Purposes of Web Applications
• Organization
– Related files grouped together in a single file or directory
hierarchy.
• HTML files, JSP pages, servlets, beans, images, etc.p g g
• Portability
– All compliant servers support Web apps.
C d l b i i l fil– Can redeploy on new server by moving a single file.
• Separation
– Each Web app has its own:– Each Web app has its own:
• ServletContext
• Class loader
• Sessions
6
• Sessions
• URL prefix
• Directory structure
Structure of a Web Application
• JSP and regular Web content
(HTML style sheets images etc ):(HTML, style sheets, images, etc.):
– Main directory or a subdirectory thereof.
• Servlets:
WEB INF/classes (if servlet is unpackaged i e in default package)– WEB-INF/classes (if servlet is unpackaged – i.e. in default package)
– A subdirectory thereof that matches the package name.
• Unjarred beans and utility classes:
Same place as servlets (but always use packages!)– Same place as servlets (but always use packages!)
• JAR files:
– WEB-INF/lib.
• web xml:• web.xml:
– WEB-INF
• Tag Library Descriptor files:
WEB INF bdi t th f
7
– WEB-INF or subdirectory thereof
• Files in WEB-INF not directly accessible to clients
– Server can use RequestDispatcher to forward to pages in WEB-INF
4. Example Deployment Structure
8
Installing Eclipse
• Overview
E li i f d l i– Eclipse is a free open-source development environment
with support for Java and many other languages
• Downloadingg
– http://www.eclipse.org/downloads/
• Choose "Eclipse IDE for Java EE Developers"
• As of 8/2008, version 3.4, called Eclipse GanymedeAs of 8/2008, version 3.4, called Eclipse Ganymede
• Installing
– Unzip into directory of your choice
P h li d k– Put shortcut to eclipse.exe on your desktop
• Integrating Tomcat in Eclipse
– http://www coreservlets com/
9
http://www.coreservlets.com/
Apache-Tomcat-Tutorial/eclipse.html
5. Configuring Eclipse
• Make sure Eclipse
k b Tknows about Tomcat
– Click on Servers tab at bottom.
R-click in windowR-click in window.
– New, Server, Apache, Tomcat v6.0,
Next, navigate to folder, Finish.
• Suppress unnecessary
compiler warnings
Wi d P f – Window Preferences
Java Compiler
Errors/Warnings
10
g
• Change "Serializable class
without ..." to "Ignore"
Making Web Apps in Eclipse
• Make empty project
– File New Project
Web Dynamic Web Project
– Give it a name (e g "test")– Give it a name (e.g., test )
– Accept all other defaults
• Shortcut
– If you have made Dynamic
Web Project recently in
workspace you can just doworkspace, you can just do
File New
Dynamic Web Project
11
6. Adding Code to Eclipse Projects
• Locations
src– src
• Unpackaged Java code
• Packages strongly recommended
– src/somePackagesrc/somePackage
• Java code in somePackage package
– WebContent
• Web files (HTML, JavaScript,( p
CSS, JSP, images, etc.)
– WebContent/some-subdirectory
• Web content in subdirectory
W bC t t/WEB INF– WebContent/WEB-INF
• web.xml (will be discussed later)
• Can also click on
"Deployment Descriptor"
12
p y p
• Note
– Can cut/paste or drag/drop files into appropriate locations
Starting Server in Eclipse
• Start Tomcat
– Select "Servers" tab at bottom
– R-click on Tomcat
Choose "Start"– Choose "Start"
• Verify server startup
– Open browserOpen browser
– Enter http://localhost/
• You should see blank directory listing
– If you want pretty Tomcat
welcome page, search for a
folder called ROOT in your
Eclipse workspace.
13
p p
Copy files from
C:tomcat-dirwebappsROOT
to that folder
7. Deploying App in Eclipse
• Deploy project
– Select "Servers" tab at bottom
– R-click on Tomcat
Choose "Add and Remove Projects"– Choose "Add and Remove Projects"
– Choose project
– Press Add
– Click "Finish"
• Restart
Server
– R-click Tomcat
at bottom
14
at bottom
– Restart
Testing Deployed Apps in Eclipse
• Start a browser
Eclipse also has builtin browser– Eclipse also has builtin browser,
but I prefer to use Firefox or
Internet Explorer
• Test base URLTest base URL
– http://localhost/test/
• Test Web content
http://localhost/test/Hello html– http://localhost/test/Hello.html
(case sensitive!)
– http://localhost/test/Hello.jsp
– If you used subdirectoriesyou used subd ecto es
• http://localhost/test/
some-subdirectory/blah.html
• Test servlets
15
– http://localhost/test/servlet/HelloServlet
– http://localhost/test/servlet/coreservlets.HelloServlet2
• Note: custom URLs discussed in next section
8. Eclipse Structure (IDE-specific) vs.
Deployment Structure (Standard)Deployment Structure (Standard)
Eclipse Deployed
J d
• Java code
– src/subDirMatchingPackage
• Java code
– deployDir/webAppName/
WEB-INF/classes/src/subDirMatchingPackage
• HTML, JSP, Images
– WebContent
W bC / d Di
subDirMatchingPackage
• HTML, JSP, Images
– deployDir/webAppName
– WebContent/randomDir
• web.xml
– WebContent/WEB-INF
deployDir/webAppName
– deployDir/webAppName/
randomDir
• web xml• web.xml
– deployDir/webAppName/
WEB-INF
N t
16
• Note
– On Tomcat, deployDir is
tomcat_installdir/webapps
Making Custom Web Apps
ManuallyManually
1. Make a directory called app-blank
• app blank/WEB INF/web xml (copy from mine)• app-blank/WEB-INF/web.xml (copy from mine)
• app-blank/WEB-INF/classes (empty)
2. Copy/rename
E bl k d ll it A• E.g., copy app-blank and call it myApp
3. Put code in proper place in myApp
• Web content (HTML , JSP, images, etc.) goes in the top-level
directory (myApp) or any subdirectory other than WEB INF (e gdirectory (myApp) or any subdirectory other than WEB-INF (e.g.,
myApp/someDir)
• Servlets and other classes go in a subdirectory of WEB-
INF/classes that matches the package name.N /c asses t at atc es t e pac age a e.
4. Copy app to deployment directory
• On Tomcat, entire directory goes in install_dir/webapps
5 Update your CLASSPATH
17
5. Update your CLASSPATH.
• Add webAppDir/WEB-INF/classes to it.
• Not usually needed if you have ".." in the CLASSPATH
9. Manual Web App Development
Strategy with TomcatStrategy with Tomcat
• Development
– Keep the original of your Web app directory in your
development directory. Have all the files in the proper
location within that Web app directory.location within that Web app directory.
• Deployment
– Copy the entire Web app directory to the server'spy pp y
deployment location (e.g., to install_dir/webapps).
• I keep a shortcut to webapps and drag the Web app dir
onto the shortcut with the R mouse and then say "Copy".y py
• CLASSPATH
– Must include the top-level development directory
18
• That now means WEB-INF/classes dir of your Web app
• If your CLASSPATH has "..", you can leave CLASSPATH
unchanged as long as you avoid nested packages
Changing the Web App Prefix
• Eclipse default: project name is Web App
prefixprefix
– So, if project is named foo, when you deploy locally the
URL is http://localhost/foo/whatever
• Tomcat default: folder name is Web App
prefix
So if you deploy the folder bar to tomcat dir/webapps– So, if you deploy the folder bar to tomcat_dir/webapps,
the URL is http://localhost/bar/whatever.
• Custom prefix in Eclipse
– R-click on project, then Properties Web Project
Settings Context Root
• Custom prefix in Tomcat
19
Custom prefix in Tomcat
– Edit tomcat_dir/conf/server.xml
10. Defining Custom URLs
• Java code
package myPackage;package myPackage; ...
public class MyServlet extends HttpServlet { ... }
• web.xml entry (in <web-app...>...</web-app>)
Gi t l t– Give name to servlet
<servlet>
<servlet-name>MyName</servlet-name>
<servlet class>myPackage MyServlet</servlet class><servlet-class>myPackage.MyServlet</servlet-class>
</servlet>
– Give address (URL mapping) to servlet
<servlet-mapping><servlet-mapping>
<servlet-name>MyName</servlet-name>
<url-pattern>/MyAddress</url-pattern>
</servlet-mapping>
20
• Resultant URL
– http://hostname/webappPrefix/MyAddress
Defining Custom URLs: Example
(Assume Eclipse Project is "test")(Assume Eclipse Project is test )
<?xml version="1.0" encoding="UTF-8"?>
<web-app
Don't edit this manually.
Should refer to version 2.4<web app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
...
or 2.5 (Tomcat 6 only).
version="2.5">
<!-- Use the URL http://hostname/intro/hi instead
of http://hostname/intro/servlet/HelloServlet -->of http://hostname/intro/servlet/HelloServlet -->
<servlet>
<servlet-name>Second Hello Servlet</servlet-name>
<servlet-class>coreservlets.HelloServlet2</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Second Hello Servlet</servlet-name>
l tt /hi2 / l tt
Any arbitrary name.
But must be the same both times.
Fully qualified classname.
21
<url-pattern>/hi2</url-pattern>
</servlet-mapping>
</web-app>
The part of the URL that comes after the app (project) name.
Should start with a slash.
11. Defining Custom URLs: Result
• Eclipse details
f li j i– Name of Eclipse project is "test"
– Servlet is in src/coreservlets/HelloServlet2.java
– Deployed by right-clicking on Tomcat Add and Remove
22
– Deployed by right-clicking on Tomcat, Add and Remove
Projects, Add, choosing test project, Finish, right-clicking
again, Start
Failing to Define Custom URLs
• You should always use custom URLs on
d l d jdeployed projects
– URLs look cleaner and simpler and shorter
URLs have more meaningful names– URLs have more meaningful names
– You don't expose possibly proprietary class file names
– You can use web.xml to assign init params laterg p
• Does not work with …/servlet/myPackage.MyServlet
– You can apply filters and security settings later (via
web xml) in a more predictable and controllable mannerweb.xml) in a more predictable and controllable manner
– Most importantly of all, you can avoid being added to
Marty’s “Hall of Shame”
23
• The kiss of death for any self-respecting Java EE
developer
12. The Hall of Shame (Deployed Sites
with Ugly /servlet/ URLs)with Ugly …/servlet/… URLs)
24
The Art of WAR (Files)
• WAR files are simply JAR files with a different file
extensionextension
– And JAR files are simply ZIP files
• All servers are required to support Web apps that
are in WAR filesare in WAR files
– Technically, they are not absolutely required to support unbundled
Web apps.
• To create a WAR file change directory to top level• To create a WAR file, change directory to top-level
Web app directory and do:
– jar cvf webAppName.war *
O Wi Zi ( "C t C d F ld " XP)– Or use WinZip (or "Create Compressed Folder" on XP)
– Eclipse can build WAR files automatically
• R-click project, Export WAR file
• Registering is still server specific
25
• Registering is still server-specific
– Tomcat: just drop WAR file in install_dir/webapps
– webAppName becomes Web application URL prefix
13. Handling Relative URLs:
ProblemProblem
• Individual JSP or HTML page: easy to load
i f l i l iimage from relative location
– <IMG SRC="EvilEmpire.gif" …>
<IMG SRC="redmond/EvilEmpire jpg" >– <IMG SRC= redmond/EvilEmpire.jpg …>
• What about servlets?
– Same strategy doesn't workgy
– Default servlet URL: http://host/prefix/servlet/Name
– Browser, not server, resolves relative URL
Wh t if i i d b JSP HTML• What if same image is used by JSP or HTML
pages scattered throughout app?
– Same problem
26
Same problem
• Also same problem:
– Style sheets, applets, even regular hypertext links
Handling Relative URLs:
SolutionsSolutions
• Use the Web application name in the URL.
– <IMG SRC="/webAppPrefix/redmond/Borg.gif" ...>
• Use web.xml to assign URLs that are at the
top level of the Web applicationtop level of the Web application
– Change http://host/webAppPrefix/servlet/SomeName to
just http://host/webAppPrefix/SomeNamej p pp
– More useful for servlets than for JSP
• Use getContextPath
– Call request.getContextPath()
and add result to URLs by hand
27
14. Velocity, WebMacro, and Other
Alternatives to JSP TechnologyAlternatives to JSP Technology
• Issues
– Standardization
– Portability
Integration– Integration
– Industry support
– Technical features
• Arguments for alternatives focus almost
exclusively on last issue
– Even if proponents were right about all their technical
arguments, would that matter?
28
Alternatives to JSP Technology:
Integration IssuesIntegration Issues
• Web apps give standard location for:
S l t JSP d l W b t t– Servlets, JSP pages, and regular Web content
– Not for Velocity or WebMacro pages
• Security settings apply to
– Servlets, JSP pages, and regular Web content
– Not Velocity or WebMacro pages
• Initialization parameters defined forp
– Servlets and JSP pages
– Not Velocity or WebMacro pages
• Filters apply to• Filters apply to
– Servlets, JSP pages, and regular Web content
– Not Velocity or WebMacro pages
Listeners apply to
29
• Listeners apply to
– Servlets, JSP pages, and regular Web content
– Not Velocity or WebMacro pages
15. Sharing Data Among Web
ApplicationsApplications
• Failure:
Sessions Each Web app has its own set of sessions– Sessions. Each Web app has its own set of sessions.
– Standard ServletContext. Each Web app has a separate one.
– Static methods or fields. Each Web app uses a different
ClassLoader.ClassLoader.
• Success:
– Explicit cookies. Cookies are shared by the whole site (even the
whole top-level domain if set appropriately).p pp p y)
• Be sure to do cookie.setPath("/"), however.
– ServletContext associated with a specific URL.
ServletContext myContext =y
getServletContext();
String url = "/someWebAppPrefix";
ServletContext otherContext =
30
myContext.getContext(url);
Object someData =
otherContext.getAttribute("someKey");
Setting Shared Data: Example
public class SetSharedInfo extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(true);
session.setAttribute("sessionTest","Session Entry One");
ServletContext context = getServletContext();
context.setAttribute("servletContextTest",
"Servlet Context Entry One");
Cookie c1 = new Cookie("cookieTest1", "Cookie One");
c1.setMaxAge(3600); // One hour
response.addCookie(c1); // Default path
Cookie c2 = new Cookie("cookieTest2", "Cookie Two");
c2.setMaxAge(3600); // One hour
c2.setPath("/"); // Explicit path: all URLs
response.addCookie(c2);
String url = request.getContextPath() +
"/servlet/moreservlets.ShowSharedInfo";
31
// In case session tracking is based on URL rewriting.
url = response.encodeRedirectURL(url);
response.sendRedirect(url);
}}
16. Displaying Shared Data:
ExampleExample
public class ShowSharedInfo extends HttpServlet {
public void doGet(HttpServletRequest request,public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Shared Info";
out.println(ServletUtilities.headWithTitle(title) +
"<BODY BGCOLOR="#FDF5E6">n" +<BODY BGCOLOR= #FDF5E6 >n +
"<H1 ALIGN="CENTER">" + title + "</H1>n"+
"…");
HttpSession session = request.getSession(true);
…
ServletContext application = getServletContext();
…
li ti li ti tC t t("/ h T t1")
32
application = application.getContext("/shareTest1");
…
Cookie[] cookies = request.getCookies();
Accessing Web App Data:
Case 1Case 1
– SetSharedInfo run
from shareTest1from shareTest1
– ShowSharedInfo
also run from
shareTest1
– Results
• Found: session dataFound: session data
• Found: servlet context
data from normal
servlet contextservlet context
• Found: servlet context
data when explicitly
requesting servlet
33
requesting servlet
context from
shareTest1
• Found: all cookies
17. Accessing Web App Data:
Case 2Case 2
– SetSharedInfo run
from shareTest1from shareTest1
– ShowSharedInfo
run from shareTest2
R lt– Results
• Not found: session data
• Not found: servlet
context data fromcontext data from
normal servlet context
• Found: servlet context
data when explicitly
ti l trequesting servlet
context from
shareTest1
• Not found: cookies that
34
had default path
• Found: cookies with /
as path
Summary
• Web application benefits
Easy organization and deployment– Easy organization and deployment
– Isolation from other applications
• Structure
Top level directory or subdirectory other than WEB INF:– Top-level directory or subdirectory other than WEB-INF:
• JSP, HTML, other Web content
– WEB-INF
• web.xml
– WEB-INF/classes/directoryMatchingPackage
• Servlets, beans, utilities
• Creating a Web app in Eclipse
M k D i W b j– Make a new Dynamic Web project.
– Eclipse will create deployment structure automatically.
• Creating a Web app in Tomcat
M k di t ith t t ( WEB INF d
35
– Make a directory with proper structure (e.g. WEB-INF and
WEB-INF/classes subdirectories)
– Copy to tomcat_dir/webapps.