Servlet
From BC$ MobileTV Wiki
Servlet is JAVA technology from Sun Microsystems for providing dynamic web applications, web pages, form/input collection and a number of other services.[1] A Servlet consists of a web.xml deployment descriptor, optional context.xml configuration file, and optional meta.xml metadata file. As of Java7, a Servlet can also be marked up via annotations using the @ predicates (@WebServlet,@WebListener,@WebFilter, etc).
Specification
- Servlet v3.0: http://jcp.org/en/jsr/detail?id=315[2][3][4]
- Java™ Servlet Specification v4.0: https://javaee.github.io/servlet-spec/downloads/servlet-4.0/servlet-4_0_FINAL.pdf
- HttpServlet -- JavaDoc: http://www.borelly.net/cb/docs/javaServlet/javax/servlet/http/HttpServlet.html
Methods
- Examining Java Servlets in detail. Servlet life cycle, HttpServlet class, ServletConfig and ServletContext Objects: http://www.stardeveloper.com/articles/display.html?article=2001061901&page=1
- The Servlet API: http://www.goldfish.org/books/O'Reilly Java Enterprise CD Bookshelf/servlet/ch02_02.htm
init
- What is the servlet's init() method used for?: https://stackoverflow.com/questions/5140416/what-is-the-servlets-init-method-used-for
doGet
- First Servlets - doGet Example: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-First-Servlets.html
doPost
- What is the difference between the doGet and doPost methods?: http://www.esus.com/javaindex/j2ee/servlets/servletdogetdopost.html
- Using doPost to send data to a REST Web Service: http://www.cs.usfca.edu/~parrt/course/601/lectures/servlets.html
doPut
- What is the purpose of doPUT() and doDELETE() method?: http://www.geekinterview.com/question_details/34819
- file upload using doPut(): http://www.coderanch.com/t/465853/Servlets/java/file-upload-using-doPut
doDelete
- Servlet Example To Delete Mysql Clob Data (using old method of calling a Delete<Object>.java using GET): http://www.roseindia.net/jdbc/delete-clob-example.shtml
- How to Delete a Table in MySQL (using old method of direct JDBC + GET Delete<Object>.java): http://www.roseindia.net/servlets/ServletDeletingTable.shtml
destroy
- Servlet init & destroy: https://docstore.mik.ua/orelly/java-ent/servlet/ch03_03.htm
Tools
- Tomcat: http://tomcat.apache.org/
- Jetty: http://jetty.codehaus.org/jetty/
- Glassfish: http://glassfish.java.net/
- jBoss AS: http://www.jboss.org/jbossas
- IBM WAS: http://www-01.ibm.com/software/websphere/
- Oracle WebLogic: http://www.oracle.com/technetwork/middleware/weblogic/overview/ (formerly BEA WebLogic server)
Resources
- Core Servlets: http://www.coreservlets.com/
- LearnNow - JAVA: https://www.learnnowonline.com/learnjavanow
- Oracle Java Certifications: http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=532&intcmp=WWOU11042424MPP055C002 (formerly Sun Certified Java Program, SCJP)
- DownloadServlet v. 2.0 - Simple component you may use for downloading files regardless of their location: http://www.servletsuite.com/servlets/download.htm
- HTTP Proxy Servlet for Ajax Calls with Authentication Support: http://www.jroller.com/ray/entry/http_proxy_servlet_for_ajax
- HTTP proxy servlet ver. 1.9 - lets you transparently pass all the incoming requests to the some predefined host: http://www.servletsuite.com/servlets/httpproxy.htm
Tutorials
- A Servlet and JSP Tutorial: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
- Servlet Essentials: http://www.novocode.com/doc/servlet-essentials/
- Servlet Tutorial - Handling Form Data: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-Form-Data.html
- Retrieving ALL Parameters to a Java Servlet: https://dzone.com/articles/retrieving-all-parameters-java
- Example of processing all URL params via getParameterMap() method of Servlet Request Object: https://www.java4s.com/java-servlet-tutorials/example-on-getparametermap-method-of-servlet-request-object/
- Story of a Servlet - An Instant Tutorial: http://java.sun.com/products/servlet/articles/tutorial/
- Java Servlet tutorial step-by-step for Beginners: https://o7planning.org/en/10169/java-servlet-tutorial
- HTML Forms, Components, and Servlets: http://www.sethi.org/classes/cis435/lab_notes/tutorial_servlet.html
- Servlet 3.0 Annotations: http://blogs.sun.com/swchan/entry/servlet_3_0_annotations
- Exploding Java - Servlet 3.0 Annotations: http://explodingjava.blogspot.com/2010/05/servlet-30-annotations.html
- Servlet without "web.xml" config file: http://javahowto.blogspot.ca/2009/10/servlet-without-webxml.html
- Servlet 4.0 -- @WebServlet annotation .vs. "web.xml" config - Tricky servlet mappings!: https://blog.frankel.ch/tricky-servlet-mappings/
- Introduction to Servlet Listener using Eclipse: http://www.java-tips.org/java-tutorials/tutorials/introduction-to-servlet-listener-using-eclipse.html
- How to work with ServletContextListener: http://www.java-tips.org/java-ee-tips/java-servlet/how-to-work-with-servletcontextlistener.html
- What is Listener – ServletContextListener Example: http://www.mkyong.com/servlet/what-is-listener-servletcontextlistener-example/
- How to use Servlet as a rest end point with Angulerjs (Basic CRUD): http://riddhimajava.blogspot.ca/2014/07/how-to-use-servlet-as-rest-end-point.html
- Overriding HttpServlet GET, POST, and PUT Methods: http://www.pearsonitcertification.com/articles/article.aspx?p=30082&seqNum=3
- Handling HTML form data with Java Servlet: http://www.codejava.net/java-ee/servlet/handling-html-form-data-with-java-servlet
- Dynamic Dependent Select Box in JSP & Servlet using JQuery and JSON via AJAX: http://www.simplecodestuffs.com/ajax-implementation-in-jsp-servlet-using-jquery-and-json/
- The Essentials of Filters: http://www.oracle.com/technetwork/java/filters-137243.html (Java Servlet "filter" XML configuration for processing/formatting special requests to a regular URL)
- Servlets - Session Tracking: http://www.tutorialspoint.com/servlets/servlets-session-tracking.htm
- How to Call (an external) RESTful API Web Service from within a Servlet: https://www.codeproject.com/Articles/1157120/How-to-Call-RESTful-API-Web-Service-in-Servlet
- HTTP Post With Body: https://stackoverflow.com/questions/6777929/http-post-with-body
- Read JSON message from HTTP POST request in Java: https://stackoverflow.com/questions/33896136/read-json-message-from-http-post-request-in-java
- Get the POST request body from HttpServletRequest: https://stackoverflow.com/questions/8100634/get-the-post-request-body-from-httpservletrequest
- Get Http Request Body from CXF message: https://stackoverflow.com/questions/39486877/get-http-request-body-from-cxf-message
- Java - sending HTTP parameters via POST method easily: https://stackoverflow.com/questions/4205980/java-sending-http-parameters-via-post-method-easily
- Session Management in Java (Web Apps/APIs) – HttpServlet, Cookies, URL Rewriting: https://www.journaldev.com/1907/java-session-management-servlet-httpsession-url-rewriting[5]
- File Upload Using Java: http://cit3.cdn.swin.edu.au/utilities/upload/File_Upload_Using_Java.html
- Ajax File Upload Example (illustrates how to upload a file using servlet through the Ajax technology): http://www.roseindia.net/ajax/File-Upload.shtml
- Ajax upload taglib ver. 1.1: http://www.servletsuite.com/servlets/ajaxuploadtag.htm
- Uploading Files with Beans: http://onjava.com/pub/a/onjava/2001/04/05/upload.html?page=1
- Sending files using POST with HttpURLConnection: https://stackoverflow.com/questions/11766878/sending-files-using-post-with-httpurlconnection
- How to use fluent of Apache Components: https://stackoverflow.com/questions/22095341/how-to-use-fluent-of-apache-components
- Apache HTTP Components - HttpClient Overview: https://hc.apache.org/httpcomponents-client-5.1.x/index.html | EXAMPLES
- Apache HTTP Components - Fluent API: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/fluent.html | EXAMPLES | DOCS
External Links
- wikipedia: Java Servlet
- Oracle - Java Servlet Technology: http://www.oracle.com/technetwork/java/index-jsp-135475.html
- Java Servlets: http://www.informit.com/articles/article.aspx?p=170963
- Servlet and JSP performance tips: http://www.javaperformancetuning.com/tips/j2ee_srvlt.shtml
- How Servlet Containers Work: http://onjava.com/pub/a/onjava/2003/05/14/java_webserver.html
- Office suite (JSOS). A rich set of servlets & filters : http://www.servletsuite.com/servlets.htm
- Proxy for Ajax requests (Twitter API): http://www.servletsuite.com/tips/twitter.htm
- Java™ Servlet 3.0 API: What's new and exciting -- VIDEO: http://developers.sun.com/learning/javaoneonline/sessions/2008/watch/TS-5415/index.html
- Java™ Servlet 3.0 API: What's new and exciting -- SLIDES: http://developers.sun.com/learning/javaoneonline/2008/pdf/TS-5415.pdf
- HTTP Proxy Servlet for Ajax Calls with Authentication Support: http://www.jroller.com/ray/entry/http_proxy_servlet_for_ajax
- Other approaches to Http Proxy Servlet: http://edwardstx.net/wiki/Wiki.jsp?page=HttpProxyServlet
- Starting process threads when Tomcat starts: http://www.coderanch.com/t/424944/Tomcat/Starting-process-threads-when-Tomcat
- Java Servlet - Constant Servlet Running: http://forums.sun.com/thread.jspa?threadID=5411839
- Why spawning threads in j2ee container is discouraged: http://stackoverflow.com/questions/533783/why-spawning-threads-in-j2ee-container-is-discouraged
- How to keep a java servlet running in the background?: http://www.coderanch.com/t/489680/Servlets/java/keep-java-servlet-running-background
- Servlet Basics: http://www.exforsys.com/tutorials/j2ee/servlet-basics.html
- Combining Servlets, JSP and JavaBeans: http://www.stardeveloper.com/articles/display.html?article=2001060501&page=2
- Asynchronous JavaScript Technology and XML (Ajax) With the Java Platform: http://java.sun.com/developer/technicalArticles/J2EE/AJAX/
- Mock HTTP Session: http://www.devdaily.com/java/jwarehouse/spring-framework-2.5.3/mock/org/springframework/mock/web/MockHttpSession.java.shtml
- myServlet WAR deployment - step-by-step: http://content.hccfl.edu/pollock/AJava/WAR/myServletWAR.htm
- Difference between Apache CXF & Axis: https://stackoverflow.com/questions/1243247/difference-between-apache-cxf-and-axis/1245386#1245386
- User (Session) count in Servlet(s) deployed within a Cluster: https://stackoverflow.com/questions/5935629/user-session-count-in-cluster (use an HttpSessionListener)
- How many instances are created for a HTTP servlet: https://stackoverflow.com/questions/22544152/how-many-instances-are-created-for-a-http-servlet (depends on how it was deployed, in a Cluster using "SingleThreadModel" or not - the default case - where online on instance per Servlet declaration)
- Maintain continuous availability while updating WebSphere Application Server enterprise applications: https://www.ibm.com/developerworks/websphere/techjournal/0412_vansickel/0412_vansickel.html
- Application Server High Availability Features: https://docs.oracle.com/cd/E19823-01/819-0216/ha_as_overview.html
- J2EE clustering, Part 1 -- Clustering technology is crucial to good Website design; do you know the basics?: https://www.javaworld.com/article/2075019/j2ee-clustering--part-1.html
- J2EE clustering, Part 2 -- Migrate your application from a single machine to a cluster, the easy way: https://www.javaworld.com/article/2075478/j2ee-clustering--part-2.html
- 5 Minute Guide to Clustering - Java Web Apps in Tomcat: http://www.richardnichols.net/2010/08/5-minute-guide-clustering-apache-tomcat/
- AWS -- Deploy a static web application on AWS, the right way: https://medium.com/faktiva/deploy-a-static-website-on-aws-the-right-way-e83f47d60fdc
- Azure -- Deployment Best Practices: https://docs.microsoft.com/en-us/azure/app-service/deploy-best-practices
References
- ↑ Sun's JAVA Servlet official page: http://java.sun.com/products/servlet/
- ↑ Oracle - Servlet 3.0 spec: http://download.oracle.com/otndocs/jcp/servlet-3.0-fr-oth-JSpec/
- ↑ Servlet 3.0: A Sneak Preview: http://www.devx.com/print/Java/Article/43256
- ↑ An Overview of Servlet 3.0: http://java.dzone.com/articles/an-overview-servlet-30
- ↑ How Tomcat handles session internally?: https://stackoverflow.com/questions/17834144/how-tomcat-handles-session-internally