vaadin - Is it possible to change the path in dynamic resources? - vaadin

I use the StreamResource to generate an url for dynamically download resource like PDF files that I build dynamiccaly in my application.
The url generated is like :
VAADIN/dynamic/resource/0/a82e9736-8d39-4960-873a-eaf57943b71f/pdf-file.pdf
Is it possible to change this path (remove words VAADIN/dynamic for example) ? and if yes, how ?
I use vaadin 14
Thank you

Related

How to translate urls in Gatsby.js with i18next

I try to make my gatsby page multilingual.
I am using gatsby-plugin-react-i18next, i18next and react-i18next like in documentation.
i18n adds language prefix but page url is still the same. How i can translate friendly url?
i have: domain/es/hello-world
but i want: domain/es/hola-mundo
Is there a simple solution to this in GatsbyJS or is it more complicated?
I have found a solution to our problem. I have created a .json file with the original path and the one I want to change. For example: /es/contact/": "/es/contacto.
I create this file manually, and I add a path for each page that I want to change the path. Then, in the gataby-node file, I create the oncreatepage api (there is documentation for this api). In this function, I take the page parameter.
if page.path == to some .json file path, change the path to that of the .json file.
Thks for help. Finally i found perfect answer for my needs. gatsby-plugin-i18n-l10n have all i need for multilingual gatsby website with url translation too. I really recommend this module and I appreciate the work of the creators.
Here is link to github where you can find that plugin:
gatsby-plugin-i18n-l10n

React Native Specify file format for addImageFromBase64 on iOS

Is it possible to save an image from a base64, with a file extension in the name?
As per
https://github.com/facebook/react-native/blob/master/Libraries/Image/RCTImageStoreManager.m#L54
it looks like the imageTag, i.e. file name, is constructed form the path and a simple incremental id. Extension is not considered.
Is there another way to append the extension, preferably with standard APIs?
Are you using RN's ImageStore? Don't know if this is the best way to do it, but the ImageStore will return the uri and you could use react-native-fs to read the base64 from that file and write it to whatever path/extension you would like it to have.
Don't forget to also removeImageForTag(uri) afterwards so you don't have both files.
react-native-fs: https://github.com/johanneslumpe/react-native-fs

Generate URL of resources that are handled by Grails AssetPipeline

I need to access a local JSON file. Since Grails 2.4 implements the AssetPipeline plugin by default, I saved my local JSON file at:
/grails-app/assets/javascript/vendor/me/json/local.json
Now what I need is to generate a URL to this JSON file, to be used as a function parameter on my JavaScript's $.getJSON() . I've tried using:
var URL.local = ""${ raw(asset.assetPath(src: "local.json")) }";
but it generates an invalid link:
console.log(URL.local);
// prints /project/assets/local.json
// instead of /project/assets/vendor/me/json/local.json
I also encountered the same scenario with images that are handled by AssetPipeline1.9.9— that are supposed to be inserted dynamically on the page. How can I generate the URL pointing this resource? I know, I can always provide a static String for the URL, but it seems there would be a more proper solution.
EDIT
I was asked if I could move the local JSON file directly under the assets/javascript root directory instead of placing it under a subdirectory to for an easier solution. I prefer not to, for organization purposes.
Have you tried asset.assetPath(src: "/me/json/local.json")
The assets plugin looks in all of the immediate children of assets/. Your local.json file would need to be placed in /project/assets/foo/ for your current code to pick it up.
Check out the relevant documentation here which contains an example.
The first level deep within the assets folder is simply used for organization purposes and can contain folders of any name you wish. File types also don't need to be in any specific folder. These folders are omitted from the URL mappings and relative path calculations.

how to load html files within the application in javafx

i am using jdk1.7.0_45 for building javafx project,loads pre created html site from my application,found passing this url file:///E:/web/index.html
but which is not my requirement,need to load from my app,so please tell me anyone,the folder name need to place in javafx app.
thanks
I'm assuming that the question is that you want to package a static HTML file with your application and display it in a WebView.
You can do it with code like this (Scala syntax but the meaning should be clear):
val url = getClass getResource "index.html"
webView.getEngine load url.toString
In this example, the index.html file (and any related content) must reside in the same package as the class of the code. E.g. if the class is mypackage.myapp.MyApp, the file must be in the mypackage.myapp package.
If your build system provides an e.g. resources folder, it would be good practice to use that for static content such as this. I.e., for this example, create a package mypackage.myapp in the resources folder and place the html file there.

How to generate 2 Resource files in a single class in Blackberry 4.5?

I am creating a resource file using
ResourceBundle _resources = ResourceBundle.getBundle(BUNDLE_ID, BUNDLE_NAME);
Now i want to create another Resource file in that same class.
Can i do it in the same way like for first Resource file ?
The interface ResourceFile.java is an auto-generated file. Then how to view it ?
You need to edit the resource file (ResourceFile.rrc) in the BlackBerry JDE directly - from there you can add new key/value pairs. I don't think there's a way to iterate through all available keys in the code.

Resources