Camel JailStartingDirectory example - apache-camel

I want to use the camel jailStartingDirectory feature to write the file outside of FTP server mapped/home directory. I have gone through the camel documents, but not able to find any example for usage.
Can someone please help me on this.
My route look like this-
from(file://<file-path>/?move=../processed&moveFailed=../failed&sendEmptyMessageWhenIdle=true)
.to(sftp://xx:22?binary=true&username=xxx&privateKeyFile=xxx)
Thanks

You should set jailStartingDirectory=true on the FTP endpoint. And then the file name should be a relative file name, eg ../foo/myfile.txt to save the file outside the starting folder. You can set/change the file name via the CamelFileName header; eg Exchange.FILE_NAME as constant.

Related

GAE Yaml handler to use URLS

I have configured a bucket and to access the files uploaded here what should be the Yaml handler statement?
For example: http://commondatastorage.googleapis.com/yii2assets/e896c38e/css/bootstrap.css
When I browse this CSS file it prompts to download and looks it doesn’t understand the MIME type.
I can’t provide a static directory since it’s hosted on Google Storage and to access I need to use the URL mentioned above.
Please let me if you have any IDEAS.
What I need is a handle like:
url: bootstrap.css
script : URL FROM where TO SERVER
Like if I have to use a JQuery CDN URL.
You can upload static file with your code then config Yaml with static_files please see in doc.
If you want to upload file to Google Storage you can access by sending parameter from python to html file. It depend how you implement it Java, Python have a difference way to implement this.

Camel FTP endpoint move to a folder based on date

I have a camel route consuming from an FTP server and storing any files it consumes to a directory with move=.dealtWith. However, the number of files in this .dealtWith directory can quickly become unmanageable for users to view, so I would like to move the file to a .dealtWith/{the_date} directory. Is there a way to specify this functionality in camel without bringing the route down?
Use Camel Simple Expression Language
ftp:url?move=.dealtWith/${date:now:yyyy-MM-dd}/${header.CamelFileName}

XPages and Apache CXF: what's the best place for WSDL files?

I am currently testing Apache CXF (2.7.11). Purpose is to build a Web Service client. I am roughly following Martin Vereecken's blog post (http://www.bizzybee.be/2013/01/23/creating-a-java-webservice-client-in-domino-using-apache-cxf/#more-451). I have a WSDL file and I created sample code with the wsdl2java tool.
My first thought was to store the wsdl file in the NSF (e.g. WebContent\WEB-INF\resources\wsdl). However, the code generated does not seem to find the WSDL file. Code looks something like this (class name Session comes form the WSDL):
Session.java:
URL url = Session.class.getResource("WEB-INF/wsdl/twinfield/session.wsdl");
if (url == null) {
url = Session.class.getClassLoader().getResource("WEB-INF/wsdl/twinfield/session.wsdl");
}
I tried both WEB-INF and /WEB-INF but neither seem to work.
If I put the WSDL file on the web (e.g. domino/html/wsdl folder) the url above works, but the code breaks later (it seems that it uses java.io.File trying to load the WSDL).
Local reference (e.g. C:\temp\wsdl) could work but does not really sound like a robust option.
The final java code will be in WebContent\WEB-INF\src, not in Code\Java.
So, what is the "best practice" for storing and referencing WSDL files in Domino environment?
UPDATE
I went with #stwissel's proposal and noticed that the wsdl2java tool can actually create the whole jar for you. Just specify option -clientJar and the resulting JAR file will contain all class files + the wsdl file.
When you generate the Java classes from the WSDL, you should pack them into a JAR file. Put the WSDL into the Jar file, so it never gets lost. This blog article and the comments explain it.
A potential issue could be the access rights (Java execution permissions) when you keep that jar inside the NSF.
The blog entry contains the sample code, so check it out!

Can i use a centralized external config file for c#?

I found an article on using external config files here. While I was able to extract my config settings, I was unable to put them in a central location.
When i tried to do something like this:
<connectionStrings configSource="C:/dev/Configs/ConnectionStrings.config" />
It causes a type initializer exception. If i put the file in a folder under the bin directory, it's ok. Problem is, I want to keep the config files central to all apps so i can reuse it in a lot of places.
Is it just not doable?
I ended up using Symbolic Links. I created a subfolder under each app that symlinked back to the master config folder. All apps share the same Connection Strings now.

Download file with resteasy

I have a rest app with resteasy, which creates files and stores them and return the path, so I can see the name in the screen. The problem: When I want to download the file, I create the url with "app url" + "file path" but that doesn't work. The message is:
Could not find resource for relative : /publications_report_486.doc of full path:
http://127.0.0.1:8080/SIISA-Rest-0.6/publications_report_486.doc
In this example, I store the file in the app's root, so I just have to add the filename to the url.
I think resteasy is trying to find that url within their resources(services) and it doesn't find the path, so it doesn't access to the file, it just search the services.
How could I fix this?
I'm not sure how to return the file from within Resteasy - I've been looking for that myself which is how I stumbled across this, but you could probably deal with this particular problem by tweaking the your web.xml so that it doesn't include the location where you store your files in the servlet-mapping to Resteasy. You may want to have a look at the approach in this answer.

Resources