Tobias, Please see my other reply in your initial thread. Let us know if you still have issues.
Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -----Message d'origine----- De : Tobias Girschick [mailto:[email protected]] Envoyé : vendredi 7 août 2009 08:59 À : [email protected] Objet : Best way to write files to DirectoryResource Sorry for posting this again but it was sorted as a reply to a different topic....my fault Hi, I wonder what is the best way (security, convenience, ...) to write files to a directory on the server. The directory also is used to serve the files in a static way. What I did up to now is attach a Directory to the router to serve static files from a local directory. Now the question is how to proceed best so that I can PUT or POST a new file exactly this local directory? Here is my code for the server Component and the Application class: public class MyServer extends Component { public static void main(String[] args) throws Exception { MyServer server = new MyServer(); server.start(); } public MyServer() { super(); this.getServers().add(Protocol.HTTP, 8180); this.getClients().add(Protocol.FILE); MyApplicationTUM(getContext().createChildContext())); } } public class MyApplicationTUM extends Application { public MyApplicationTUM(Context context) { super(); setContext(context); } @Override public Restlet createRoot() { Router router = new Router(getContext()); String user_home = System.getProperty("user.home"); Directory fileRepository = new Directory(getContext(), "file://"+user_home+"/serverFiles/"); fileRepository.setListingAllowed(true); fileRepository.setModifiable(true); fileRepository.setDeeplyAccessible(true); router.attach("", MyIndexResourceTUM.class); router.attach("/fileRepository", fileRepository); return router; } } I'd appreciate your help and/or suggestions, Tobias -- Dipl.-Bioinf. Tobias Girschick Technische Universität München Institut für Informatik Lehrstuhl I12 - Bioinformatik Bolzmannstr. 3 85748 Garching b. München, Germany Room: MI 01.09.042 Phone: +49 (89) 289-18002 Email: [email protected] Web: http://wwwkramer.in.tum.de/people/girschic ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2381194 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2384449

