Developing Java Servlets 2nd Edition James Goodwill - Read the ebook online or download it to own the full content
Developing Java Servlets 2nd Edition James Goodwill - Read the ebook online or download it to own the full content
com
https://ebookgate.com/product/developing-java-servlets-2nd-
edition-james-goodwill/
OR CLICK BUTTON
DOWLOAD EBOOK
https://ebookgate.com/product/apache-jakarta-tomcat-1st-edition-james-
goodwill/
ebookgate.com
https://ebookgate.com/product/murach-s-java-servlets-and-jsp-3rd-
edition-edition-joel-murach/
ebookgate.com
https://ebookgate.com/product/java-2-micro-edition-java-in-small-
things-james-white/
ebookgate.com
https://ebookgate.com/product/developing-a-dream-destination-james-
mak/
ebookgate.com
The Java Language Specification Third Edition James
Gosling
https://ebookgate.com/product/the-java-language-specification-third-
edition-james-gosling/
ebookgate.com
https://ebookgate.com/product/developing-applications-with-java-tm-
and-uml-1st-edition-paul-r-reed/
ebookgate.com
Developing Web Services with Java APIs for XML 1st Edition
Robert Hablutzel
https://ebookgate.com/product/developing-web-services-with-java-apis-
for-xml-1st-edition-robert-hablutzel/
ebookgate.com
https://ebookgate.com/product/the-java-language-specification-java-
se-8-edition-james-gosling-bill-joy-guy-l-steele/
ebookgate.com
https://ebookgate.com/product/java-9-modularity-patterns-and-
practices-for-developing-maintainable-applications-1st-edition-sander-
mak/
ebookgate.com
™
Developing Java
Servlets
James Goodwill
All rights reserved. No part of this book shall be reproduced, stored in a ACQUISITIONS EDITOR
retrieval system, or transmitted by any means, electronic, mechanical, photo- Carol Ackerman
copying, recording, or otherwise, without written permission from the pub-
DEVELOPMENT EDITOR
lisher. No patent liability is assumed with respect to the use of the information
Tiffany Taylor
contained herein. Although every precaution has been taken in the preparation
of this book, the publisher and author assume no responsibility for errors or MANAGING EDITOR
omissions. Nor is any liability assumed for damages resulting from the use of Matt Purcell
the information contained herein.
PROJECT EDITOR
International Standard Book Number: 0-672-32107-6 Christina Smith
Library of Congress Catalog Card Number: 00-111799
COPY EDITOR
Printed in the United States of America Cynthia Fields
First Printing: June 2001 INDEXER
04 03 02 01 4 3 2 1 Erika Millen
PROOFREADER
Trademarks Benjamin Berg
All terms mentioned in this book that are known to be trademarks or service
marks have been appropriately capitalized. Sams Publishing cannot attest to TECHNICAL EDITOR
the accuracy of this information. Use of a term in this book should not be Rob Tiffany
regarded as affecting the validity of any trademark or service mark.
TEAM COORDINATOR
Warning and Disclaimer Lynne Williams
Every effort has been made to make this book as complete and as accurate as INTERIOR DESIGNER
possible, but no warranty or fitness is implied. The information provided is on Anne Jones
an “as is” basis. The author and the publisher shall have neither liability nor
responsibility to any person or entity with respect to any loss or damages aris- COVER DESIGNER
ing from the information contained in this book. Aren Howell
PAGE LAYOUT
Ayanna Lacey
Heather Hiatt Miller
Stacey Richwine-DeRome
Overview
Contents at a Glance
Introduction 1
1 Web Applications and the Model View Controller (MVC) Design Pattern 7
PART IV Appendixes
A Web Applications and Configuring the Servlet Engine 419
B The javax.servlet Package 429
C The javax.servlet.http Package 461
D The javax.servlet.jsp Package 489
E The javax.servlet.jsp.tagext Package 513
F WML (The Wireless Markup Language) 543
G WMLScript 547
Index 559
Contents
Introduction 1
3 Servlet Basics 25
The Life Cycle of a Servlet ..................................................................26
The init() Method ............................................................................26
The service() Method ......................................................................26
The destroy() Method ......................................................................27
A Basic Servlet ......................................................................................27
The BasicServlet Source ..................................................................27
Dissecting the BasicServlet ..................................................................29
Where Does the BasicServlet Fit into the Servlet Framework? ......29
The Methods Overridden by the BasicServlet ................................30
Summary ................................................................................................31
vi
DEVELOPING JAVA SERVLETS, SECOND EDITION
5 Servlet Sessions 41
What Is Session Tracking? ....................................................................42
Using Hidden Form Fields ....................................................................42
Working with Cookies ..........................................................................46
URL Rewriting ......................................................................................50
Session Tracking with the Servlet API ..................................................51
Summary ................................................................................................58
6 HTTP Tunneling 59
What Is HTTP Tunneling? ....................................................................60
Object Serialization................................................................................60
Creating an HTTP Tunneling Client......................................................66
Creating an HTTP Tunneling Servlet ....................................................71
A Practical HTTP Tunneling Example..................................................73
The OrderStatusApplet ....................................................................74
The OrderStatusServlet ....................................................................80
Pros and Cons of Applet-to-Servlet Communication ............................83
Summary ................................................................................................84
Views....................................................................................................367
Trader Layout ................................................................................367
Index View......................................................................................370
Get Quote View ..............................................................................371
Buy/Sell View ................................................................................372
Controllers............................................................................................375
The GetQuote Service ....................................................................375
The Buy Service ............................................................................377
The Sell Service..............................................................................380
Using the Trader Application ..............................................................382
Summary ..............................................................................................383
PART IV Appendixes
A Web Applications and Configuring the Servlet Engine 419
Web Applications ................................................................................420
The ServletContext in Relation to the Web Application................420
The Directory Structure..................................................................420
Web Application Deployment Descriptors ....................................421
Web Archive (WAR) Files ..................................................................422
Servlet Requirements ..........................................................................422
Apache Tomcat ....................................................................................422
Installing the Tomcat Server ..........................................................422
Adding the DJS Web Application ..................................................424
Building and Installing the BasicServlet........................................426
Summary ..............................................................................................427
Classes..................................................................................................479
The Cookie Class............................................................................479
The HttpServlet Class ....................................................................483
The HttpSessionBindingEvent Class..............................................486
The HttpUtils Class ........................................................................487
G WMLScript 547
Lang Library ........................................................................................548
abort()—The abort Function ..........................................................548
abs()—The abs Function ................................................................548
characterSet()—The characterSet Function ..................................548
exit()—The exit Function ..............................................................548
float()—The float Function ............................................................548
xiv
DEVELOPING JAVA SERVLETS, SECOND EDITION
Index 559
About the Authors
Lead Author
James Goodwill is the co-founder and chief architect at Virtuas Solutions, LLC., located in
Denver, Colorado. He has extensive experience in designing and architecting e-business appli-
cations. James is also the author of Pure JavaServer Pages, which provides a thorough exami-
nation of the JavaServer Pages technology. James is currently leading Virtuas’s efforts in
developing cutting edge tools designed for J2EE e-business acceleration.
You can find the source code and support for this text at the Virtuas Solutions Web site,
http://www.virtuas.com. Select the Publications link.
Contributing Author
Bryan Morgan is an experienced writer and software developer and founder of the Wireless
Developer Network (http://www.wirelessdevnet.com) in 1999. He is a respected voice in the
wireless industry, is a regular contributor to industry publications, and has been a featured
speaker at numerous events. He holds a B.S. in electrical engineering from Clemson University
and lives in Pensacola, FL with his wife Becky and beautiful daughter Emma.
Dedication
To my girls Christy, Abby, and Emma.
Acknowledgments
Before I start thanking those close to home, I need to thank the people who made this book
what it is. They are the people who took my words and molded and shaped them into some-
thing that I hope will help you become an effective Web application developer. I would like to
thank Carol Ackerman, my acquisitions editor, who answered all my questions and resolved
any issues that came up. I would especially like to thank Tiffany Taylor for her excellent edit-
ing. I would like to thank Rob Tiffany for his great technical comments and recommendations.
I would also like to thank Cynthia Fields for her excellent copy-editing. And finally, I would
like to thank Christina Smith for managing the entire project. Each and every person made this
book what it is.
On a closer note, I would first like to thank everyone at my company, Virtuas Solutions, Inc.
for their support while I was completing this text. The entire staff contributed by picking up
my assignments when my plate was too full. In particular I would like to thank those
“UNREAL” people that I worked with on a daily basis including Matthew “Deckard” Filios,
Karen “Blue Bullet” Jackson, Eric “Crazy Mary” Johnson, Jason “Cutt” Nordyke, David
“Busta” Goedecke, Mike “Ivan” Day, Gary “Monica” Goodrum, and especially Aaron “Ronin”
Bandell, for his contribution of Chapters 11 and 12.
Finally, the most important contributors to this book are my wife Christy, and our daughters
Abby and Emma. They supported me throughout the entire book, with complete understand-
ing. They listened to me complain and took care of things when I disappeared into the office.
With their support, I can do anything.
Tell Us What You Think!
As the reader of this book, you are our most important critic and commentator. We value your
opinion and want to know what we’re doing right, what we could do better, what areas you’d
like to see us publish in, and any other words of wisdom you’re willing to pass our way.
As an executive editor for Sams Publishing, I welcome your comments. You can fax, e-mail, or
write me directly to let me know what you did or didn’t like about this book—as well as what
we can do to make our books stronger.
Please note that I cannot help you with technical problems related to the topic of this book,
and that due to the high volume of mail I receive, I might not be able to reply to every
message.
When you write, please be sure to include this book’s title and author’s name as well as your
name and phone or fax number. I will carefully review your comments and share them with the
author and editors who worked on the book.
Fax: 317-581-4770
E-mail: feedback@samspublishing.com
Mail: Michael Stephens
Executive Editor
Sams Publishing
201 West 103rd Street
Indianapolis, IN 46290 USA
Introduction
Structure of This Book
Before you begin reading this book, you might want to take a look at its basic structure. This
will help you outline your reading plan, if you choose not to read it from cover to cover. This
introduction gives you an overview of what each chapter covers.
Appendix G, “WMLScript”
Appendix G describes the libraries and functions used in WMLScript.
Web Applications and the CHAPTER
1
Model View Controller (MVC)
Design Pattern
IN THIS CHAPTER
• The Model View Controller (MVC) Design
Pattern 8
This chapter is the foundation for this entire text. We will look at a design pattern that lever-
ages the strengths of both servlets and Java Server Pages (JSPs) to create maintainable and
reusable Web applications: the Model View Controller (MVC). In this study we will also look
at exactly where and why both servlets and JSPs fit in this pattern. Because you have not yet
covered servlet and JSP technologies, you will have to accept some of the statements made in
this chapter. My goal for the remainder of this text is to show how and why this pattern and
these technologies work so well when developing server-side Java Web applications.
The major advantage of using the MVC design pattern is that it separates the Views and
Models. As a result, you can separate presentation from business logic, and, in turn, create or
change Views without having to change the Models or the Controller logic that manipulates the
Models. The MVC also allows Models to be represented by multiple Views.
Application Server 1
WEB APPLICATIONS
DESIGN PATTERN
AND THE MVC
3. EJB/
2. Servlet BEAN
(Controller)
EJB/
1. BEAN
Web Client Web 4.
Server DBMS
6.
EJB/
JSP BEAN
5.
(View)
EJB/
BEAN
FIGURE 1.1
The steps in a server-side implementation of the MVC.
Summary
In this chapter, we laid the foundation for the rest of this text. We looked at the MVC design
pattern and saw how we could combine servlets and JSPs to implement a server-side solution
for Web applications.
Web Applications and the Model View Controller (MVC) Design Pattern
11
CHAPTER 1
In the rest of this text we will study servlets and JSPs in the context of this model. We will 1
examine how servlets and JSPs work separately and then we will complete the text by combin-
WEB APPLICATIONS
DESIGN PATTERN
AND THE MVC
ing what we have learned into Web application case studies that implement the MVC.
PART
Servlet Fundamentals
I
IN THIS PART
2 Servlet Overview and Architecture
3 Servlet Basics
5 Servlet Sessions
6 HTTP Tunneling
9 Servlet Security
13 A Servlet Controller
Servlet Overview and CHAPTER
2
Architecture
IN THIS CHAPTER
• Movement to Server-Side Java 16
Request
Servlet
Response
Web Browser
Web Server
FIGURE 2.1
Execution of a Java Servlet.
• Developing e-commerce “store fronts” will become one of the most common uses for
Java servlets. A servlet can build an online catalog based on the contents of a database. It
can then present this catalog to the customer using dynamic HTML. The customer will
choose the items to be ordered, enter the shipping and billing information, and then sub-
mit the data to a servlet. When the servlet receives the posted data, it will process the
orders and place them in the database for fulfillment. Every one of these processes can
easily be implemented using Java servlets.
• Servlets can be used to deploy Web sites that open up large legacy systems on the
Internet. Many companies have massive amounts of data stored on large mainframe sys-
tems. These businesses do not want to re-architect their systems, so they choose to pro-
2
OVERVIEW AND
vide inexpensive Web interfaces into them. Because you have the entire JDK at your
ARCHITECTURE
disposal and security provided by the Web server, you can use servlets to interface into
SERVLET
these systems using anything from TCP/IP to CORBA.
• Servlets also make very good HTTP-enabled clients to Enterprise Java Bean (EJB) appli-
cations. Using servlets as clients to EJB applications creates very secure Web applica-
tions that are able to handle very high volumes.
These are just a few examples of the power and practicality of using Java servlets. Servlets are
very viable options for most Web applications.
servers are configured to run a limited number of processes. If the server runs out, it will
not be able to handle the client’s requests.
• Although CGI code can be implemented in almost any language, the most common plat-
form-independent language is Perl. Perl is very powerful at processing text, but it
requires the server to start a new interpreter for every request. This takes longer than
starting compiled code and still eats up available processes and resources.
• CGI runs in a completely separate process from the Web server. If a client submits a
request to a CGI program that terminates before responding to the Web server, the
browser has no way of knowing what happened. It just sits there waiting for a response
until it times out.
Request CGI1
Client New CGI1 Process
Request CGI1
Client New CGI1 Process
Request CGI1
Client New CGI1 Process
Web Server
FIGURE 2.2
The interaction of a CGI solution.
Proprietary APIs
Many Web servers include APIs that extend their functionality. The most common examples
include Netscape’s NSAPI, Microsoft’s ISAPI, and O’Reilly’s Web site API called WSAPI.
The problem with these solutions is that they are proprietary. You cannot decide to change
servers without porting your code. These APIs are also developed using languages such as C or
C++ that can contain memory leaks or core dumps that can crash the Web server.
Server-Side JavaScript
Server-side JavaScript is another solution for implementing dynamic Web sites. With this solu-
tion you embed JavaScript into precompiled HTML pages. By precompiling the Web pages
you improve performance, but the only servers that implement server-side JavaScript are
Netscape’s Enterprise, FastTrack Servers, and Microsoft’s IIS. This again ties you to a particu-
lar vendor.
also similar to server-side JavaScript in that it is tied to a particular Web server: Microsoft’s
Internet Information Server. Some third-party products implement ASP, but you must purchase
them separately at additional costs.
OVERVIEW AND
ARCHITECTURE
ing sections discuss some of the advantages offered by servlets.
SERVLET
Efficiency
A servlet’s initialization code is executed only the first time the Web server loads it. Once the
servlet is loaded, it is only a matter of calling a service method to handle new requests. This is
a much more efficient technique than loading a completely new executable with every request.
Persistency
Servlets can maintain state between requests. Once a servlet is loaded, it stays resident in
memory while serving incoming requests. A simple example of this is a Vector that holds a list
of categories used in an online catalog. When the servlet is initialized, it queries the database
for a list of categories and stores these categories in a Vector. As it services requests, the
servlet accesses the Vector that holds the categories instead of querying the database again.
Taking advantage of the persistent characteristics of servlets can improve your application’s
performance drastically.
Portability
Servlets are developed using Java; therefore, they are portable. This portability enables servlets
to be moved to a new operating system without changing the source. You can take code that
was compiled on a Windows NT platform and move it to a Solaris box without making any
changes.
Robustness
Because servlets are developed with access to the entire JDK, they are very powerful and
robust solutions. Java provides a well-defined exception hierarchy for error handling. It has a
garbage collector to prevent problems with memory leaks. In addition, it includes a very large
class library that includes network support, file support, database access, distributed object
components, security, and many other classes.
Servlet Fundamentals
20
PART I
Extensibility
Another advantage servlets gain by being developed in an object-oriented language such as
Java is that they can be extended and polymorphed into new objects that better suit your needs.
A good example of this is an online catalog. You might want to display the same catalog search
tool at the top of every dynamic page throughout your Web site. You definitely don’t want to
add this code to every one of your servlets. So, you implement a base servlet that builds and
initializes the search tool and then extend it to display transaction-specific responses.
Security
Servlets run on the server side, inheriting the security provided by the Web server. Servlets can
also take advantage of the Java Security Manager.
init() getInitParameter()
getServletConfig() getServletContext()
service() getInitParameterNames()
getServletInfo() getServletName()
destroy()
javax.servlet.GenericServlet
getServletContext() 2
getInitParameter()
getInitParameterNames()
OVERVIEW AND
ARCHITECTURE
log()
SERVLET
getServletInfo()
init()
getServletConfig()
service()
destroy()
getServletName()
javax.servlet.http.HttpServlet
doDelete()
doGet()
doOptions()
doPost()
doPut()
doTrace()
getLastModified()
service()
BasicServlet
FIGURE 2.3
A high-level object model of the servlet framework.
The two objects that the service() method receives are ServletRequest and
ServletResponse. The ServletRequest object holds the information that is being sent to the
servlet, whereas the ServletResponse object is where you place the data you want to send
back to the client. Figure 2.4 diagrams the flow of a GenericServlet request.
Servlet Fundamentals
22
PART I
Request GenericServlet
Client
Response service()*
Web Server
* abstract method
FIGURE 2.4
A GenericServlet Request.
Unlike the GenericServlet, when you extend HttpServlet, you don’t usually implement the
service() method. The HttpServlet class has already implemented it for you. The following
is the prototype:
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException;
When the HttpServlet.service() method is invoked, it reads the method type stored in the
request and determines which method to invoke based on this value. These are the methods
that you will want to override. If the method type is GET, the service() method will call
doGet(). If the method type is POST, it will call doPost(). Five other method types exist; they
are discussed in Chapter 3, “Servlet Basics.” All these methods have the same parameter list as
the service() method.
You might have noticed the different request/response types in the parameter list of the
HttpServlet and the GenericServlet classes. The HttpServletRequest and
HttpServletResponse classes are just extensions of ServletRequest and ServletResponse
with HTTP-specific information stored in them. Figure 2.5 diagrams the flow of a
HttpServlet request.
HttpServlet
doDelete()
Request doGet()
Client doOptions()
service()
Response doPost()
doPut()
Web Server
doTrace()
FIGURE 2.5
A HttpServlet Request.
Servlet Overview and Architecture
23
CHAPTER 2
Summary
In this chapter, you learned about Java servlet basics, practical applications for servlets, servlet
alternatives, reasons to use servlets over the alternatives, and the basic architecture of servlets.
At this point, you should have a high-level understanding of the flow of a servlet request and
what objects are involved.
In the next chapter we will look at the life cycle of a servlet. We will also create and dissect a
basic servlet.
2
OVERVIEW AND
ARCHITECTURE
SERVLET
Servlet Basics CHAPTER
3
IN THIS CHAPTER
• The Life Cycle of a Servlet 26
• A Basic Servlet 27
The init() method takes a ServletConfig object as a parameter. You should save this object
so that it can be referenced later. The most common way of doing this is to have the init()
method call super.init() passing it the ServletConfig object.
You will also notice that the init() method can throw a ServletException. If, for some rea-
son, the servlet cannot initialize the resources necessary to handle requests, the init() method
should throw a ServletException.
The cowboy jumped from his weary horse, loosened the cinches
to give the animal’s lungs greater freedom, and came into the office
to wait for the doctor.
The cowboy was excited, and tramped up and down, rolling a
cigarette.
“You’re from Hank Phelps’ ranch?” asked the scout.
“That’s me,” was the answer. “My name’s Quiller, an’ I’ve worked
fer Hank for two years. He’s all right, Hank is.”
“How was Jake Phelps hurt?”
“Looks like he’d been hit on the head with a club er somethin’.”
“Then he wasn’t shot?”
“Not as Jeems an’ me could see. But I didn’t tarry long arter we
found Jake; I jest hustled right in arter the doc. There was some
queer things about Jake’s fix. The feller that swiped the pay-roll
money took Jake’s saddle along. What’s this I hear about Jake’s
havin’ a row with Nate Dunbar afore leavin’ fer home?”
“They had some words, Quiller,” answered the scout.
“I’m wonderin’—I’m wonderin’——”
Quiller was leaning against the counter, holding a lighted match to
his cigarette.
“You’re wondering,” spoke up the scout, “whether Nate Dunbar
had anything to do with what happened to Jake Phelps. Well, stop
your wondering. He didn’t.”
“But the’ was bad blood between ’em, wasn’t they?” went on the
cowboy, wrinkling his brows. “When they separated didn’t they both
say they’d git even with each other? An’ didn’t Dunbar hit the trail
right arter Jake did?”
“All that happened, yes. But that doesn’t prove anything against
Nate. I’m rather thinking that it makes the future dark for Red
Steve.”
Old Nomad jumped at that; and Quiller, the match going out
without lighting his cigarette, flung away the burnt firestick and
groped in his pocket for another.
“What about Red Steve?” demanded Quiller.
“He’s loose in the Brazos country,” answered the scout. “Benner
was going to bring him to Hackamore for the shooting of Ace
Hawkins, but Red Steve slipped away from the Circle-B ranch on
foot.”
“On foot, hey? Then why didn’t Red Steve, if he done this, take
Jake’s hoss? Red Steve wouldn’t never hev let the hoss git away
from him arter he had nabbed the money.”
“Perhaps Red Steve had a horse already,” suggested the scout.
“It’s possible he picked up a horse without any gear, and that he
took the saddle to ride in.”
“It’s possible, I reckon.”
But it was plain that Quiller’s mind was running on Nate Dunbar.
Circumstances seemed to point more decisively in the direction of
the Star-A rancher than toward Red Steve.
“The man who took the money,” pursued the scout, noting the
trend of the cowboy’s thoughts, “was the man who look the saddle.
Nate Dunbar’s not a thief.”
“It’s hard ter tell what a man is when he makes a play o’ this
kind.”
“And certainly Nate wouldn’t take the saddle. Why should he? He
had a good saddle of his own.”
This fact seemed to make some impression on Quiller. Before he
could express himself, however, the doctor came riding up in front.
With the doctor was Bloom and Sim Pierce, both ready for the trail.
“Come on, you there!” roared Bloom.
Quiller ran out, tightened his cinches, swung into the saddle, and
the four riders fared out of town at a gallop.
“See how it is, Nick?” queried the scout. “Already suspicion is
leveled at Nate Dunbar. You can gamble that Bloom will do
everything possible to make it bad for the boy. I reckon we had also
better be getting saddle leather between our knees.”
“Ter go whar, Buffler?”
“Why, to the H-P ranch. I want to watch this thing and find out
just what develops. We must keep in touch with every detail. It’s
liable to mean a whole lot for Nate.”
“Waugh! Ye’re shore right thar. But et’s Red Steve as turned ther
trick, ye kin take et from me. When’ll we ride?”
“Now.”
“Whoop! When ye tune up like thet, ye shore ketch me plumb
whar I live. Spurs an’ quirts an’ a call on Hank Phelps. This hyar
peace bizness is gittin’ some excitin’.”
Pinkney brought out their saddles and bridles. Bear Paw and old
Hide-rack seemed surprised at the sudden getaway. Probably, in
their brute minds, they had been expecting an all-night stay in the
comfortable corral.
“It beats the nation,” remarked the scout, when he and his old
pard were galloping along the trail, “what beastly luck comes Nate
Dunbar’s way.”
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookgate.com