Announcement Announcement Module
Collapse
No announcement yet.
Unable to write String from Web form to a file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to write String from Web form to a file

    I created a simple text box
    Code:
    <form action="write">
    	Input a String <input type="text" name="data" />
    	<br/><input type="submit">
    </form>
    This is the integration.xml

    Code:
    <int:channel id="input">
    		<int:interceptors>
    			<int:wire-tap channel="logger"/>
    		</int:interceptors>
    	</int:channel>
    	
    	<int:logging-channel-adapter id="logger" level="DEBUG"></int:logging-channel-adapter>
    	<int-file:outbound-channel-adapter auto-create-directory="true" directory="file:/output" channel="input"></int-file:outbound-channel-adapter>
    and this is my controller
    Code:
    @RequestMapping("write")
    	public void write(@RequestParam("data") String data){
    		ApplicationContext ctx=new ClassPathXmlApplicationContext("integration.xml");
    		MessageChannel channel= ctx.getBean("input",MessageChannel.class);
    		channel.send(MessageBuilder.withPayload(data).setHeader(FileHeaders.FILENAME, "myfile.txt").build());
    	}
    but no directory is being created. Where am i wrong?

    Thanks

  • #2
    I suggest you run with DEBUG logging and follow the message through your app.

    Comment

    Working...
    X