pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.service.event
Class DownloadEvent

java.lang.Object
  extended by org.torweg.pulse.service.event.DownloadEvent
All Implemented Interfaces:
Event

public class DownloadEvent
extends java.lang.Object
implements Event

is an Event that causes the pulse service to present a download instead of a view.

Version:
$Revision: 2025 $
Author:
Thomas Weber

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.torweg.pulse.service.event.Event
Event.Disposition
 
Constructor Summary
DownloadEvent(java.io.File dl)
          creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream" with Event.Disposition.ATTACHED and CacheMode.NONE.
DownloadEvent(java.io.File dl, CacheMode c)
          creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream" with Event.Disposition.ATTACHED and the given cache mode.
DownloadEvent(java.io.File dl, Event.Disposition disp)
          creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream", the given "Content-Disposition" and CacheMode.NONE.
DownloadEvent(java.io.File dl, Event.Disposition disp, CacheMode c)
          creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream", the given "Content-Disposition" and the given cache mode.
DownloadEvent(java.io.File dl, Event.Disposition disp, java.lang.String type)
          creates a new DownloadEvent for the specified file, using the specified MIME type and the given "Content-Disposition" and CacheMode.NONE.
DownloadEvent(java.io.File dl, Event.Disposition disp, java.lang.String type, CacheMode c)
          creates a new DownloadEvent for the specified file, using the specified MIME type and the given "Content-Disposition" and the given cache mode.
DownloadEvent(java.io.File dl, java.lang.String type)
          creates a new DownloadEvent for the specified file, using the specified MIME type with Event.Disposition.ATTACHED and CacheMode.NONE.
DownloadEvent(java.io.File dl, java.lang.String type, CacheMode c)
          creates a new DownloadEvent for the specified file, using the specified MIME type with Event.Disposition.ATTACHED and the given cache mode.
DownloadEvent(SerializableDataSource dl)
          create a new DownloadEvent for the specified data source with Event.Disposition.ATTACHED and CacheMode.NONE.
DownloadEvent(SerializableDataSource dl, CacheMode c)
          create a new DownloadEvent for the specified data source with Event.Disposition.ATTACHED and the given cache mode.
DownloadEvent(SerializableDataSource dl, Event.Disposition disp)
          create a new DownloadEvent for the specified data source, the given "Content-Disposition" and CacheMode.NONE.
DownloadEvent(SerializableDataSource dl, Event.Disposition disp, CacheMode c)
          create a new DownloadEvent for the specified data source, the given "Content-Disposition" and the given cache mode.
 
Method Summary
 CacheMode getCacheMode()
          returns the CacheMode.
 boolean isOutputEvent()
          Indicates if this Event will write to the OutputStream and so render the OutputStream unwritable for future results.
 boolean isSingularEvent()
          Indicates that the Event will only be added once to the EventManager and block all other Events.
 boolean isStopEvent()
          Indicates if the Invoker should proceed executing other bundles or if it should terminate after executing this Event .
 void run(ServiceRequest req)
          will start the download process, if the HttpServletResponse is still writable.
 void setCacheMode(CacheMode c)
          sets the CacheMode.
 java.lang.String toString()
          returns a string representation of the DownloadEvent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DownloadEvent

public DownloadEvent(SerializableDataSource dl)
create a new DownloadEvent for the specified data source with Event.Disposition.ATTACHED and CacheMode.NONE.

Parameters:
dl - the data source

DownloadEvent

public DownloadEvent(SerializableDataSource dl, CacheMode c)
create a new DownloadEvent for the specified data source with Event.Disposition.ATTACHED and the given cache mode.

Parameters:
dl - the data source
c - the cache mode

DownloadEvent

public DownloadEvent(SerializableDataSource dl, Event.Disposition disp)
create a new DownloadEvent for the specified data source, the given "Content-Disposition" and CacheMode.NONE.

Parameters:
dl - the data source
disp - the "Content-Disposition"

DownloadEvent

public DownloadEvent(SerializableDataSource dl, Event.Disposition disp, CacheMode c)
create a new DownloadEvent for the specified data source, the given "Content-Disposition" and the given cache mode.

Parameters:
dl - the data source
disp - the "Content-Disposition"
c - the cache mode

DownloadEvent

public DownloadEvent(java.io.File dl)
creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream" with Event.Disposition.ATTACHED and CacheMode.NONE.

Parameters:
dl - the File to be presented as a download

DownloadEvent

public DownloadEvent(java.io.File dl, CacheMode c)
creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream" with Event.Disposition.ATTACHED and the given cache mode.

Parameters:
dl - the File to be presented as a download
c - the cache mode

DownloadEvent

public DownloadEvent(java.io.File dl, Event.Disposition disp)
creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream", the given "Content-Disposition" and CacheMode.NONE.

Parameters:
dl - the File to be presented as a download
disp - the "Content-Disposition"

DownloadEvent

public DownloadEvent(java.io.File dl, Event.Disposition disp, CacheMode c)
creates a new DownloadEvent for the specified file, using the default MIME type "application/octet-stream", the given "Content-Disposition" and the given cache mode.

Parameters:
dl - the File to be presented as a download
disp - the "Content-Disposition"
c - the cache mode

DownloadEvent

public DownloadEvent(java.io.File dl,
                     java.lang.String type)
creates a new DownloadEvent for the specified file, using the specified MIME type with Event.Disposition.ATTACHED and CacheMode.NONE.

Parameters:
dl - the File to be presented as a download
type - the MIME type to be used for the download

DownloadEvent

public DownloadEvent(java.io.File dl,
                     java.lang.String type, CacheMode c)
creates a new DownloadEvent for the specified file, using the specified MIME type with Event.Disposition.ATTACHED and the given cache mode.

Parameters:
dl - the File to be presented as a download
type - the MIME type to be used for the download
c - the cache mode

DownloadEvent

public DownloadEvent(java.io.File dl, Event.Disposition disp,
                     java.lang.String type)
creates a new DownloadEvent for the specified file, using the specified MIME type and the given "Content-Disposition" and CacheMode.NONE.

Parameters:
dl - the File to be presented as a download
disp - the "Content-Disposition"
type - the MIME type to be used for the download

DownloadEvent

public DownloadEvent(java.io.File dl, Event.Disposition disp,
                     java.lang.String type, CacheMode c)
creates a new DownloadEvent for the specified file, using the specified MIME type and the given "Content-Disposition" and the given cache mode.

Parameters:
dl - the File to be presented as a download
disp - the "Content-Disposition"
type - the MIME type to be used for the download
c - the cache mode
Method Detail

run

public final void run(ServiceRequest req)
will start the download process, if the HttpServletResponse is still writable.

Specified by:
run in interface Event
Parameters:
req - the ServiceRequest
See Also:
Event.run(org.torweg.pulse.service.request.ServiceRequest)

isStopEvent

public final boolean isStopEvent()
Description copied from interface: Event
Indicates if the Invoker should proceed executing other bundles or if it should terminate after executing this Event .

Specified by:
isStopEvent in interface Event
Returns:
true
See Also:
Event.isStopEvent()

isOutputEvent

public final boolean isOutputEvent()
Description copied from interface: Event
Indicates if this Event will write to the OutputStream and so render the OutputStream unwritable for future results.

Please note: After writing to the OutputStream it should be flushed and closed.

Specified by:
isOutputEvent in interface Event
Returns:
true
See Also:
Event.isOutputEvent()

isSingularEvent

public final boolean isSingularEvent()
Description copied from interface: Event
Indicates that the Event will only be added once to the EventManager and block all other Events.

If an Event of the same type has already been added to the EventManager, subsequent calls to EventManager.addEvent(Event) will return without adding the given Event.

Specified by:
isSingularEvent in interface Event
Returns:
true
See Also:
Event.isSingularEvent()

getCacheMode

public final CacheMode getCacheMode()
returns the CacheMode.

Specified by:
getCacheMode in interface Event
Returns:
the cache mode
See Also:
Event.getCacheMode()

setCacheMode

public final void setCacheMode(CacheMode c)
sets the CacheMode.

Specified by:
setCacheMode in interface Event
Parameters:
c - the cache mode to set
See Also:
Event.setCacheMode(org.torweg.pulse.service.request.CacheMode)

toString

public java.lang.String toString()
returns a string representation of the DownloadEvent.

Overrides:
toString in class java.lang.Object
Returns:
a string representation