java ee 7 with glassfish 4 application server

348 1.4K 0
java ee 7 with glassfish 4 application server

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info Java EE 7 with GlassFish 4 Application Server A practical guide to install and congure the GlassFish 4 application server and develop Java EE 7 applications to be deployed to this server David R. Heffelnger BIRMINGHAM - MUMBAI www.it-ebooks.info Java EE 7 with GlassFish 4 Application Server Copyright © 2014 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: October 2007 Second Edition: July 2010 Third Edition: March 2014 Production Reference: 1200314 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78217-688-6 www.packtpub.com Cover Image by Aniket Sawant (aniket_sawant_photography@hotmail.com) www.it-ebooks.info Credits Author David R. Heffelnger Reviewers Stefan Horochovec Tim Pinet Chirag Sangani Acquisition Editors Subho Gupta Rubal Kaur Content Development Editor Akshay Nair Technical Editors Pratik More Humera Shaikh Rohit Kumar Singh Pratish Soman Copy Editors Tanvi Gaitonde Dipti Kapadia Aditya Nair Kirti Pai Stuti Srivastava Project Coordinator Amey Sawant Proofreaders Maria Gould Sandra Hopper Linda Morris Indexers Mehreen Deshmukh Rekha Nair Graphics Yuvraj Mannari Production Coordinator Aparna Bhagat Cover Work Aparna Bhagat www.it-ebooks.info About the Author David R. Heffelnger is the Chief Technology Ofcer at Ensode Technology, LLC, a software consulting rm based in the Greater Washington DC area. He has been architecting, designing, and developing software professionally since 1995. He has been using Java as his primary programming language since 1996. He has worked on many large-scale projects for several clients including the U.S. Department of Homeland Security, Freddie Mac, Fannie Mae, and the U.S. Department of Defense. He has a master's degree in Software Engineering from Southern Methodist University. David is the Editor-in-chief of Ensode.net (http://www.ensode.net), a website on Java, Linux, and other technologies. David is a frequent speaker at Java conference such as JavaOne. You can follow David on Twitter, @ensode. www.it-ebooks.info About the Reviewers Stefan Horochovec is from Brazil. He has a graduate degree in Software Engineering and also in Project Management and currently works as a software architect. Over the past 10 years, he has been dedicated to the development of Enterprise Applications using Java as the backend technology and application servers, such as GlassFish, JBoss, Weblogic, and WildFly. With regards to frontend, Stefan has worked for 4 years with technologies such as Apache Flex (speaking for three consecutive years at FlexMania, the biggest event on Apache Flex in Latin America), Struts, and JSF. Today, his focus is on projects involving JSF 2 and JavaScript frameworks, with a strong focus on AngularJS. He has worked with the mobile world for about 6 years, having extensive experience on the Android platform. He was one of the rst Android instructors in Brazil and a speaker at the Android conference in Brazil. For about 2 years, he has been working with the HTML-based mobile development using frameworks such as PhoneGap to build enterprise applications. In 2014, Stefan was invited to join the BlackBerry Elite Member program, which gathers around 100 people worldwide, emphasizing the importance of mobile development, technologies for their development, and using the operating system and BlackBerry devices on the mobile platform. Stefan also teaches in University courses related to web and Mobile development and is an instructor of in-company courses related to Java, HTML/JS/CSS3, PhoneGap, Git, and Java application servers. www.it-ebooks.info Tim Pinet is a practicing software engineer and web developer currently residing in Ottawa, Canada. From an early age, he was always fascinated with all electronic things and went on to graduate with a bachelor's degree in Engineering in the Software Engineering stream. As Ottawa is a large capital city with a technology sector rich with opportunity, Tim has had the fortune to practice software engineering and systems integration in both private (Computer Associates, Emergis, Telus, Nortel) and public (City of Ottawa) companies and in numerous industries such as transportation and road/weather information systems, healthcare recording, communications and telephony infrastructure, and municipal citizen-centric services and payment handling. Tim's open source mantra helps him to focus on working for low cost, but high productivity in any environment and has him giving back to projects (such as Apache and SourceForge) and community knowledge bases (such as Stackoverow and his personal blog). He has brought open source tools to his employers, saving them thousands of dollars and giving them best-practice accelerated development and testing capabilities without giving up dollars or quality. Loving all things software and web, Tim constantly indulges himself in the newest technologies to better improve service to the end client. He has a vast experience in Java using enterprise technologies, web services, client GUI development, server backend development, database management integration, and SOA services integration. He is a very focused team player and works best in leading teams and architecting solutions. Chirag Sangani is a computer scientist living in the Seattle area. He obtained his MS from Stanford University, CA, and his B. Tech. from IIT Kanpur, India. He currently works as a software development engineer for Microsoft. www.it-ebooks.info www.PacktPub.com Support les, eBooks, discount offers and more You might want to visit www.PacktPub.com for support les and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub les available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Instant Updates on New Packt Books Get notied! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page. www.it-ebooks.info www.it-ebooks.info Table of Contents Preface 1 Chapter 1: Getting Started with GlassFish 7 An Overview of Java EE and GlassFish 7 What's new in Java EE 7? 8 JavaServer Faces (JSF) 2.2 8 Java Persistence API (JPA) 2.1 8 Java API for RESTful Web Services (JAX-RS) 2.0 9 Java Message Service (JMS) 2.0 9 Java API for JSON Processing (JSON-P) 1.0 10 Java API for WebSocket 1.0 10 GlassFish advantages 10 Obtaining GlassFish 11 Installing GlassFish 13 GlassFish dependencies 13 Performing the installation 13 Starting GlassFish 14 Deploying our rst Java EE application 16 Deploying an application through the Web Console 16 Undeploying an application through the GlassFish Admin Console 19 Deploying an application through the command line 20 GlassFish domains 23 Creating Domains 23 Deleting domains 25 Stopping a domain 25 Setting up Database Connectivity 26 Setting up connection pools 26 Setting up the data sources 30 Summary 31 www.it-ebooks.info [...]... WebSocket clients in Java [ iii ] www.it-ebooks.info 1 24 1 24 128 130 132 133 136 1 37 1 37 140 143 143 146 148 149 152 155 158 159 161 1 64 165 169 176 178 178 181 183 183 185 188 189 190 193 193 1 97 Table of Contents Additional information about the Java API for WebSocket Summary 201 201 Chapter 8: The Java Message Service 203 Chapter 9: Securing Java EE Applications 2 27 Setting up GlassFish for JMS Setting... [2013-08-02T10: 57: 45 .49 0- 040 0] [glassfish 4. 0] [INFO] [] [javax enterprise.system.tools.deployment.common] [tid: _ThreadID=91 _ ThreadName=AutoDeployer] [timeMillis: 1 375 45 546 549 0] [levelValue: 800] [[ visiting unvisited references]] [2013-08-02T10: 57: 45 .628- 040 0] [glassfish 4. 0] [INFO] [AS-WEB-GLUE-00 172 ] [javax.enterprise.web] [tid: _ThreadID=91 _ThreadName=AutoDeployer] [timeMillis: 1 375 45 546 5628] [levelValue:... [levelValue: 800] [[ Loading application [simpleapp] at [/simpleapp]]] [2013-08-02T10: 57: 45 .71 4- 040 0] [glassfish 4. 0] [INFO] [] [javax enterprise.system.core] [tid: _ThreadID=91 _ThreadName=AutoDeployer] [timeMillis: 1 375 45 546 571 4] [levelValue: 800] [[ simpleapp was successfully deployed in 302 milliseconds.]] [2013-08-02T10: 57: 45 .72 3- 040 0] [glassfish 4. 0] [INFO] [NCLSDEPLOYMENT-00035] [javax.enterprise.system.tools.deployment.autodeploy]... the completely revamped Java Messaging Service (JMS) API 2.0, the Java API for XML Web Services (JAX-WS) and the Java API for RESTful Web Services (JAX-RS), as well as securing Java EE applications The GlassFish application server is the reference implementation for Java EE; it is the first Java EE application server in the market to support Java EE 7 This book covers GlassFish 4. 0, the latest version... communication between the client and the server GlassFish advantages With so many options in Java EE application servers, why choose GlassFish? Besides the obvious advantage of GlassFish being available free of charge, it offers the following benefits: • Java EE reference implementation: GlassFish is the Java EE reference implementation What this means is that other application servers may use GlassFish to... directory] /glassfish4 /glassfish/ domains/domain1/logs /server. log The last few lines on this file should look something like the following: [2013-08-02T10: 57: 45 .3 87- 040 0] [glassfish 4. 0] [INFO] [NCLSDEPLOYMENT-000 27] [javax.enterprise.system.tools.deployment.autodeploy] [tid: _ThreadID=91 _ThreadName=AutoDeployer] [timeMillis: 1 375 45 546 53 87] [levelValue: 800] [[ Selecting file /home/heffel /GlassFish/ glassfish4 /glassfish/ domains/... out more about the CDDL license at http://opensource org/licenses/CDDL-1.0 Like all Java EE- compliant application servers, GlassFish provides the necessary libraries to allow us to develop and deploy Java applications compliant with Java EE specifications What's new in Java EE 7? Java EE 7, the latest version of the Java EE specification, includes several improvements and additions to the specification... reference Java EE specification, it tends to implement the latest specifications before any other application server in the market As a matter of fact, at the time of writing, GlassFish is the only Java EE application server in the market that supports the complete Java EE 7 specification [ 10 ] www.it-ebooks.info Chapter 1 Obtaining GlassFish GlassFish can be downloaded at https:/ /glassfish .java. net GlassFish. .. Started with GlassFish In this chapter, we will discuss how to get started with GlassFish The following are some of the topics discussed in this chapter: • An overview of Java EE and GlassFish • Obtaining GlassFish • Installing and starting GlassFish • Explaining the concept of GlassFish domains • Deploying Java EE applications • Setting up Database Connectivity An Overview of Java EE and GlassFish Java. .. Edition (Java EE, formerly called J 2EE or Java 2 Enterprise Edition) is a standard set of technologies for server- side Java development Java EE technologies include JavaServer Faces (JSF), Enterprise JavaBeans (EJBs), the Java Messaging Service (JMS), the Java Persistence API (JPA), the Java API for WebSocket, Contexts and Dependency Injection (CDI), the Java API for XML Web Services (JAX-WS), the Java . www.it-ebooks.info Java EE 7 with GlassFish 4 Application Server A practical guide to install and congure the GlassFish 4 application server and develop Java EE 7 applications to be deployed to this server David. 1 Chapter 1: Getting Started with GlassFish 7 An Overview of Java EE and GlassFish 7 What's new in Java EE 7? 8 JavaServer Faces (JSF) 2.2 8 Java Persistence API (JPA) 2.1 8 Java API for RESTful. the Java API for RESTful Web Services (JAX-RS), as well as securing Java EE applications. The GlassFish application server is the reference implementation for Java EE; it is the rst Java EE application

Ngày đăng: 01/08/2014, 17:06

Mục lục

  • Starting GlassFish

    • Deploying our first Java EE application

      • Deploying an application through the Web Console

      • Undeploying an application through the GlassFish Admin Console

      • Deploying an application through the command line

      • Setting up Database Connectivity

        • Setting up connection pools

        • Setting up the data sources

        • Chapter 2: JavaServer Faces

          • Introduction to JSF

            • Facelets

            • Developing our first JSF application

              • Facelets

              • Custom data validation

                • Creating custom validators

                • Customizing JSF's default messages

                  • Customizing message styles

                  • JSF 2.2 HTML5 support

                    • The HTML5-friendly markup

                    • Additional JSF component libraries

                    • Chapter 3: Object Relational Mapping with JPA

                      • The CustomerDB database

                      • Introducing the Java Persistence API

                        • Entity relationships

                          • One-to-one relationships

                          • Introducing the Java Persistence Query Language

                          • Introducing the Criteria API

                            • Updating data with the Criteria API

                            • Deleting data with the Criteria API

                            • Chapter 4: Enterprise JavaBeans

                              • Introduction to session beans

                                • Developing a simple session bean

                                • A more realistic example

                                • Invoking session beans from web applications

                                • Introduction to singleton session beans

Tài liệu cùng người dùng

Tài liệu liên quan