Results 1 to 2 of 2

Thread: Unable to write String from Web form to a file

  1. #1

    Default 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. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,021

    Default

    I suggest you run with DEBUG logging and follow the message through your app.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •