31284 Lecture Notes - Glassfish, Web Service, Idempotence
Web Services Development
Week 1 - JSP Introduction:
Web Apps vs. Web Services:
Web App
Web Service
• Presentation-oriented
• Human oriented: User interacts w. page
• Pages - Supports interaction between
humans and computers
• Generates mark-up language
• Machine-oriented: application interacts w.
applications
• Provides services
• Request/response
• Supports communication between machines
HTML & JSP (Java Server Pages):
- HTML can only make static websites
- Embed Java code with <% … %> in an HTML file to make webpages dynamic
- Files are executed by a server (e.g. GlassFish)
- Whe page is loaded, it’s: (translation phase, processing phase)
o Converted as Java class, Compiled, Executed, Returned to browser as HTML
- //First phase: translation, Second phase: processing
Week 2 - JSP Requests & Responses:
HTTP Methods: GET and POST
- HTTP is designed to enable client-server communication
- Request-response protocol between a client and server
- Most used HTTP methods: GET and POST
GET
POST
• Retrieve data from a specified source/
request representation of the source
• Should NEVER be used to send sensitive
data (is visible after URL)
• Useful for submissions where user wants
to bookmark result
• Better for non-secure data, like query
strings in google.com
• Idempotent (will never change)
• Submits data to be processed to a specified
source (e.g. storing, updating, ordering a
product, sending e-mail)
• ALWAYS use if form data contains sensitive
or personal information
• Does not display in page address field
• Data is included in the body of the request
• Has no size limitation, can be used to send
large amounts of data
• Back/reload button is harmless
• Can be bookmarked
• Restricted length (data is added onto URL)
• Can be cached
• Parameters remain in browser history
• Data visible to everyone in URL
• Back/reload causes data resubmission
• Cannot be bookmarked
• No restrictions
• Cannot be cached
• Parameters are not saved in browser history
• Data is not displayed in URL
find more resources at oneclass.com
find more resources at oneclass.com