|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.context.IntegrationObjectSupport org.springframework.integration.handler.AbstractMessageHandler org.springframework.integration.handler.AbstractReplyProducingMessageHandler org.springframework.integration.file.FileWritingMessageHandler
public class FileWritingMessageHandler
A MessageHandler
implementation that writes the Message payload to a
file. If the payload is a File object, it will copy the File to the specified
destination directory. If the payload is a byte array or String, it will write
it directly. Otherwise, the payload type is unsupported, and an Exception
will be thrown.
If the 'deleteSourceFiles' flag is set to true, the original Files will be
deleted. The default value for that flag is false. See the
setDeleteSourceFiles(boolean)
method javadoc for more information.
Other transformers may be useful to precede this handler. For example, any
Serializable object payload can be converted into a byte array by the
PayloadSerializingTransformer
.
Likewise, any Object can be converted to a String based on its
toString()
method by the
ObjectToStringTransformer
.
Field Summary |
---|
Fields inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler |
---|
DEFAULT_SEND_TIMEOUT |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
FileWritingMessageHandler(File destinationDirectory)
|
Method Summary | |
---|---|
protected Object |
handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message. |
void |
onInit()
Subclasses may implement this for initialization logic. |
void |
setAutoCreateDirectory(boolean autoCreateDirectory)
Specify whether to create the destination directory automatically if it does not yet exist upon initialization. |
void |
setCharset(String charset)
Set the charset name to use when writing a File from a String-based Message payload. |
void |
setDeleteSourceFiles(boolean deleteSourceFiles)
Specify whether to delete source Files after writing to the destination directory. |
void |
setFileNameGenerator(FileNameGenerator fileNameGenerator)
Provide the FileNameGenerator strategy to use when generating
the destination file's name. |
Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler |
---|
getMessagingTemplate, handleMessageInternal, setChannelResolver, setOutputChannel, setRequiresReply, setSendTimeout, shouldCopyRequestHeaders |
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler |
---|
getComponentType, getOrder, handleMessage, setOrder, setShouldTrack |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getRequiredMetadataPersister, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.integration.context.NamedComponent |
---|
getComponentName |
Constructor Detail |
---|
public FileWritingMessageHandler(File destinationDirectory)
Method Detail |
---|
public void setAutoCreateDirectory(boolean autoCreateDirectory)
public void setFileNameGenerator(FileNameGenerator fileNameGenerator)
FileNameGenerator
strategy to use when generating
the destination file's name.
public void setDeleteSourceFiles(boolean deleteSourceFiles)
FileHeaders.ORIGINAL_FILE
header value containing either a
File instance or a String representing the original file path.
public void setCharset(String charset)
public final void onInit()
IntegrationObjectSupport
onInit
in class AbstractReplyProducingMessageHandler
protected Object handleRequestMessage(Message<?> requestMessage)
AbstractReplyProducingMessageHandler
handleRequestMessage
in class AbstractReplyProducingMessageHandler
|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |