com.javaranch.common
Class ObjectServlet

java.lang.Object
  |
  +--HttpServlet
        |
        +--com.javaranch.common.LogServlet
              |
              +--com.javaranch.common.ObjectServlet

public abstract class ObjectServlet
extends LogServlet

Used for passing objects back and forth between applets and servlets.

All objects are passed via the post method.

Override doObject() to provide functionality to the servlet.

- - - - - - - - - - - - - - - - -

Copyright (c) 1999-2004 Paul Wheaton

Copyright (c) 1999-2000 EarthWatch, Inc. You are welcome to do whatever you want to with this source file provided that you maintain this comment fragment (between the dashed lines). Modify it, change the package name, change the class name ... personal or business use ... sell it, share it ... add a copyright for the portions you add ...

My goal in giving this away and maintaining the copyright is to hopefully direct developers back to JavaRanch.

I originally developed this class while working as a contractor at EarthWatch, Inc. in Longmont, Colorado. They gave me permission to distribute this code this way provided that their message would also be carried along. Their message is that they hire Java programmers and would like you to consider working with them. I have to say that my experience with them was first rate and I would encourage engineers to work there. Check out their web site at http://www.digitalglobe.com.

The original source can be found at JavaRanch

- - - - - - - - - - - - - - - - -

Author:
Paul Wheaton
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.javaranch.common.LogServlet
getCount, postCount
 
Constructor Summary
ObjectServlet()
           
 
Method Summary
 java.lang.Object doObject(java.lang.Object obj)
          You receive an object and you give an object back.
 java.lang.Object doObject(java.lang.Object obj, HttpServletRequest req)
          You receive an object and you give an object back.
 void doPost(HttpServletRequest req, HttpServletResponse resp)
          Internal use only.
 
Methods inherited from class com.javaranch.common.LogServlet
checkConsoleLogging, debugReport, doGet, doPost, emailMessage, emailMessage, logMessage, reportProblem, setAccessParameterName, setAccessParameterValue, setLogConsole, setLogMemory, usable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectServlet

public ObjectServlet()
Method Detail

doObject

public java.lang.Object doObject(java.lang.Object obj)
                          throws java.lang.Exception
You receive an object and you give an object back.

Use this if you don't need the req object.

java.lang.Exception

doObject

public java.lang.Object doObject(java.lang.Object obj,
                                 HttpServletRequest req)
                          throws java.lang.Exception
You receive an object and you give an object back.

Use this if you need the req object.

java.lang.Exception

doPost

public final void doPost(HttpServletRequest req,
                         HttpServletResponse resp)
                  throws ServletException,
                         java.io.IOException
Internal use only.

It must be made public so the servlet server can find it. It will catch the POST request, collect the object from the client and pass it to you via doObject(). The object you return from doObject() will be passed back to the client.

Overrides:
doPost in class LogServlet
ServletException
java.io.IOException


Copyright ©2004 Paul Wheaton All Rights Reserved