org.alfresco.repo.web.scripts.content
Class StreamContent

java.lang.Object
  extended by org.springframework.extensions.webscripts.AbstractWebScript
      extended by org.alfresco.repo.web.scripts.content.StreamContent
All Implemented Interfaces:
org.springframework.context.ResourceLoaderAware, org.springframework.extensions.webscripts.WebScript
Direct Known Subclasses:
ContentGet, NodeContentGet, StreamACP, StreamJMXDump, WorkflowInstanceDiagramGet

public class StreamContent
extends org.springframework.extensions.webscripts.AbstractWebScript
implements org.springframework.context.ResourceLoaderAware

Web script 'type' that can be used when the binary data of a content property needs to be streamed back to the client as the result of executing the web script.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
 
Field Summary
protected  org.alfresco.service.cmr.repository.ContentService contentService
           
protected  org.alfresco.service.cmr.repository.MimetypeService mimetypeService
           
protected  org.alfresco.service.cmr.repository.NodeService nodeService
           
protected  org.alfresco.service.cmr.security.PermissionService permissionService
          Services
protected  org.springframework.core.io.ResourceLoader resourceLoader
           
 
Constructor Summary
StreamContent()
           
 
Method Summary
 void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res)
           
protected  java.util.Map executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status)
          Deprecated.  
protected  java.util.Map executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)
          Execute custom Java logic
protected  java.util.Map executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptStatus status)
          Deprecated.  
protected  void renderFormatTemplate(java.lang.String format, java.util.Map model, java.io.Writer writer)
          Render a template (of given format) to the Web Script Response
protected  void setAttachment(org.springframework.extensions.webscripts.WebScriptResponse res, boolean attach, java.lang.String attachFileName)
          Set attachment header
 void setContentService(org.alfresco.service.cmr.repository.ContentService contentService)
           
 void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
           
 void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
           
protected  void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, java.io.File file, boolean attach)
          Streams content back to client from a given resource path.
protected  void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, java.io.File file, boolean attach, java.lang.String attachFileName)
          Streams content back to client from a given File.
protected  void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, java.io.File file, java.lang.Long modifiedTime, boolean attach, java.lang.String attachFileName)
          Streams content back to client from a given File.
protected  void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName propertyQName, boolean attach)
          Streams the content on a given node's content property to the response of the web script.
protected  void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName propertyQName, boolean attach, java.lang.String attachFileName)
          Streams the content on a given node's content property to the response of the web script.
protected  void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String resourcePath, boolean attach)
          Streams content back to client from a given resource path.
protected  void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, java.lang.String resourcePath, boolean attach, java.lang.String attachFileName)
          Streams content back to client from a given resource path.
protected  void streamContentImpl(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res, org.alfresco.service.cmr.repository.ContentReader reader, boolean attach, java.util.Date modified, java.lang.String eTag, java.lang.String attachFileName)
          Stream content implementation
 
Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

permissionService

protected org.alfresco.service.cmr.security.PermissionService permissionService
Services


nodeService

protected org.alfresco.service.cmr.repository.NodeService nodeService

contentService

protected org.alfresco.service.cmr.repository.ContentService contentService

mimetypeService

protected org.alfresco.service.cmr.repository.MimetypeService mimetypeService

resourceLoader

protected org.springframework.core.io.ResourceLoader resourceLoader
Constructor Detail

StreamContent

public StreamContent()
Method Detail

setResourceLoader

public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
Specified by:
setResourceLoader in interface org.springframework.context.ResourceLoaderAware

setMimetypeService

public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
Parameters:
mimetypeService -

setPermissionService

public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
Parameters:
permissionService -

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Parameters:
nodeService -

setContentService

public void setContentService(org.alfresco.service.cmr.repository.ContentService contentService)
Parameters:
contentService -

execute

public void execute(org.springframework.extensions.webscripts.WebScriptRequest req,
                    org.springframework.extensions.webscripts.WebScriptResponse res)
             throws java.io.IOException
Specified by:
execute in interface org.springframework.extensions.webscripts.WebScript
Throws:
java.io.IOException
See Also:
org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)

executeImpl

protected java.util.Map executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req,
                                    org.springframework.extensions.webscripts.WebScriptStatus status)
Deprecated. 

Execute custom Java logic

Parameters:
req - Web Script request
status - Web Script status
Returns:
custom service model

executeImpl

protected java.util.Map executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req,
                                    org.springframework.extensions.webscripts.Status status)
Deprecated. 

Execute custom Java logic

Parameters:
req - Web Script request
status - Web Script status
Returns:
custom service model

executeImpl

protected java.util.Map executeImpl(org.springframework.extensions.webscripts.WebScriptRequest req,
                                    org.springframework.extensions.webscripts.Status status,
                                    org.springframework.extensions.webscripts.Cache cache)
Execute custom Java logic

Parameters:
req - Web Script request
status - Web Script status
cache - Web Script cache
Returns:
custom service model

renderFormatTemplate

protected final void renderFormatTemplate(java.lang.String format,
                                          java.util.Map model,
                                          java.io.Writer writer)
Render a template (of given format) to the Web Script Response

Parameters:
format - template format (null, default format)
model - data model to render
writer - where to output

streamContent

protected void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req,
                             org.springframework.extensions.webscripts.WebScriptResponse res,
                             org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             org.alfresco.service.namespace.QName propertyQName,
                             boolean attach)
                      throws java.io.IOException
Streams the content on a given node's content property to the response of the web script.

Parameters:
req - Request
res - Response
nodeRef - The node reference
propertyQName - The content property name
attach - Indicates whether the content should be streamed as an attachment or not
Throws:
java.io.IOException

streamContent

protected void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req,
                             org.springframework.extensions.webscripts.WebScriptResponse res,
                             org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             org.alfresco.service.namespace.QName propertyQName,
                             boolean attach,
                             java.lang.String attachFileName)
                      throws java.io.IOException
Streams the content on a given node's content property to the response of the web script.

Parameters:
req - Request
res - Response
nodeRef - The node reference
propertyQName - The content property name
attach - Indicates whether the content should be streamed as an attachment or not
attachFileName - Optional file name to use when attach is true
Throws:
java.io.IOException

streamContent

protected void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req,
                             org.springframework.extensions.webscripts.WebScriptResponse res,
                             java.lang.String resourcePath,
                             boolean attach)
                      throws java.io.IOException
Streams content back to client from a given resource path.

Parameters:
req - The request
res - The response
resourcePath - The classpath resource path the content is required for
attach - Indicates whether the content should be streamed as an attachment or not
Throws:
java.io.IOException

streamContent

protected void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req,
                             org.springframework.extensions.webscripts.WebScriptResponse res,
                             java.lang.String resourcePath,
                             boolean attach,
                             java.lang.String attachFileName)
                      throws java.io.IOException
Streams content back to client from a given resource path.

Parameters:
req - The request
res - The response
resourcePath - The classpath resource path the content is required for.
attach - Indicates whether the content should be streamed as an attachment or not
attachFileName - Optional file name to use when attach is true
Throws:
java.io.IOException

streamContent

protected void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req,
                             org.springframework.extensions.webscripts.WebScriptResponse res,
                             java.io.File file,
                             boolean attach)
                      throws java.io.IOException
Streams content back to client from a given resource path.

Parameters:
req - The request
res - The response
resourcePath - The resource path the content is required for
attach - Indicates whether the content should be streamed as an attachment or not
Throws:
java.io.IOException

streamContent

protected void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req,
                             org.springframework.extensions.webscripts.WebScriptResponse res,
                             java.io.File file,
                             boolean attach,
                             java.lang.String attachFileName)
                      throws java.io.IOException
Streams content back to client from a given File. The Last-Modified header will reflect the given file's modification timestamp.

Parameters:
req - The request
res - The response
file - The file whose content is to be streamed.
attach - Indicates whether the content should be streamed as an attachment or not
attachFileName - Optional file name to use when attach is true
Throws:
java.io.IOException

streamContent

protected void streamContent(org.springframework.extensions.webscripts.WebScriptRequest req,
                             org.springframework.extensions.webscripts.WebScriptResponse res,
                             java.io.File file,
                             java.lang.Long modifiedTime,
                             boolean attach,
                             java.lang.String attachFileName)
                      throws java.io.IOException
Streams content back to client from a given File.

Parameters:
req - The request
res - The response
file - The file whose content is to be streamed.
modifiedTime - The modified datetime to use for the streamed content. If null the file's timestamp will be used.
attach - Indicates whether the content should be streamed as an attachment or not
attachFileName - Optional file name to use when attach is true
Throws:
java.io.IOException

streamContentImpl

protected void streamContentImpl(org.springframework.extensions.webscripts.WebScriptRequest req,
                                 org.springframework.extensions.webscripts.WebScriptResponse res,
                                 org.alfresco.service.cmr.repository.ContentReader reader,
                                 boolean attach,
                                 java.util.Date modified,
                                 java.lang.String eTag,
                                 java.lang.String attachFileName)
                          throws java.io.IOException
Stream content implementation

Parameters:
req - The request
res - The response
reader - The reader
attach - Indicates whether the content should be streamed as an attachment or not
modified - Modified date of content
eTag - ETag to use
attachFileName - Optional file name to use when attach is true
Throws:
java.io.IOException

setAttachment

protected void setAttachment(org.springframework.extensions.webscripts.WebScriptResponse res,
                             boolean attach,
                             java.lang.String attachFileName)
Set attachment header

Parameters:
res -
attach -
attachFileName -


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.