Expresso 5-6

com.jcorporate.expresso.services.controller.dbmaint
Class ViewBlob

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.State
      extended bycom.jcorporate.expresso.services.controller.dbmaint.DynamicCmd
          extended bycom.jcorporate.expresso.services.controller.dbmaint.ViewBlob
All Implemented Interfaces:
Cloneable, Serializable

public class ViewBlob
extends DynamicCmd

This state allows for viewing of BLOB data types. It supports standard blob types by sending a mime type of application/x-unknown, and is supports MediaDbObjects be setting MIME type, file name, and size to that of the file that was originally uploaded to the database table.

Version:
$Revision: 1.11 $ on $Date: 2004/11/17 20:48:18 $
Author:
Michael Rimov
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jcorporate.expresso.services.controller.dbmaint.DynamicCmd
countTotalRecords, masterObjKey, showNext, showPrev
 
Fields inherited from class com.jcorporate.expresso.core.controller.State
NOTEMPTY_MASK, secure
 
Constructor Summary
ViewBlob()
          Constructor that sets the necessary description and key name.
 
Method Summary
 void run(ControllerRequest newRequest, ControllerResponse newResponse)
          Download the BLOB field.
protected  void sendBlobField(ControllerRequest newRequest, ControllerResponse newResponse, JDBCDataObject dbobj, String fieldName)
          Sends a BLOB field to the client browser.
protected  void sendMediaObjectField(ControllerRequest newRequest, ControllerResponse newResponse, MediaDBObject dbobj, String fieldName)
          Sends a Media DBObject's BLOB fields to the client.
protected  void sendStream(InputStream is, ServletResponse response)
          Sends the given stream to the client servlet output stream.
 
Methods inherited from class com.jcorporate.expresso.services.controller.dbmaint.DynamicCmd
addParams, decode, getControllerName, getCurrentDBObj, getDataObject, getFieldsParam, getFixedFields, getKeyParameter, getMyDataObject, getPageNumber, getSearchParam, initializeDBObj, isKeyField, retrieveMyDBObject, setFields, setFieldsParam, setMyDataObject, setSearchParam, showBlobViewLink, showEditLink, showEditLink, showOptions, showUserName
 
Methods inherited from class com.jcorporate.expresso.core.controller.State
add, addAutoInput, addAutoInput, addAutoInput, addBlock, addError, addInput, addOptionalParameter, addOutput, addParameter, addParameter, addParameter, addRequiredParameter, addTransition, autoValidate, autoValidate, calculateHandlerName, checkMask, checkParamMasks, clearFormCache, clone, equals, getAttribute, getController, getControllerRequest, getControllerResponse, getDataContext, getDBController, getDBName, getDescription, getErrors, getErrorState, getErrorTransition, getFileName, getFormCache, getHandlerName, getInitParameter, getName, getObjectParameter, getOptionalParameters, getOptionalParametersList, getParameter, getParameters, getPatternMatcher, getRequiredParametersList, getResponse, getReturnToSender, getSession, getStateFormClass, getString, getString, getSuccessTransition, getUid, getUser, hashCode, isFileParameter, isParameter, isSecure, perform, saveErrors, setController, setDescription, setErrorState, setErrorTransition, setFormCache, setHandlerName, setMask, setMask, setMaskError, setName, setResponse, setReturnToSender, setSecure, setStateFormClass, setSuccessTransition, toString, transition
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ViewBlob

public ViewBlob()
Constructor that sets the necessary description and key name.

Method Detail

run

public void run(ControllerRequest newRequest,
                ControllerResponse newResponse)
         throws NonHandleableException,
                ControllerException
Download the BLOB field.

Overrides:
run in class DynamicCmd
Parameters:
newRequest - The ControllerRequest Object
newResponse - The ControllerREsponse OBject
Throws:
NonHandleableException - upon fatal error
ControllerException

sendBlobField

protected void sendBlobField(ControllerRequest newRequest,
                             ControllerResponse newResponse,
                             JDBCDataObject dbobj,
                             String fieldName)
                      throws ControllerException,
                             NonHandleableException
Sends a BLOB field to the client browser.

Parameters:
newRequest - The ControllerRequest object
newResponse - The ControllerResponse object
dbobj - the DBObject to get the BLOB field from.
fieldName - the name of the field in the DBObject to send
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

sendMediaObjectField

protected void sendMediaObjectField(ControllerRequest newRequest,
                                    ControllerResponse newResponse,
                                    MediaDBObject dbobj,
                                    String fieldName)
                             throws ControllerException,
                                    NonHandleableException
Sends a Media DBObject's BLOB fields to the client.

Parameters:
newRequest - the controller request object
newResponse - the controller response object (Must be in a Servlet environment)
dbobj - THe Media DBObject derived class to send
fieldName - the field name in the dbobject to send
Throws:
ControllerException - upon error
NonHandleableException - upon fatal error

sendStream

protected void sendStream(InputStream is,
                          ServletResponse response)
                   throws IOException
Sends the given stream to the client servlet output stream.

Parameters:
is - The InputStream to send to the client.
response - The ServletResponse by which to get the OutputStream.
Throws:
IOException - upon error getting the OutputStream to the client.

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.