Deploy OpenUI5 on phoenixframework - sapui5

I created my first openui5 hello world application on eclipse and want to deploy on my phoenix(elixir webserver) server.
Application structure:
And the app looks as follow:
My question is, how make the application ready to deploy?

Its all static content. Copy all files and folders inside Webcontent to your web server. You can put it to the web servers root, but you don't have to. WEB-INF and META-INF are not needed.
Then copy the openui5 framework to the Webserver to a folder of your choice. You may have to change the bootstrap element to point to your sap-ui-core.js.
That's it. Optionally You can use the grunt-openui5 plugin to build a packaged preload file of your application.

Related

Where do I place my templates for Blog-related mail notifications in Liferay 7.0?

The documentation states that I can configure the liferay server to use my own templates for the email messages. Specifically, if I add these properties to a portal-ext-env.properties in $CATALINA_BASE/conf/liferay:
blogs.email.entry.added.enabled=true
blogs.email.entry.added.subject=${resource:com/liferay/portlet/blogs/dependencies/email_entry_added_subject.tmpl}
blogs.email.entry.added.body=${resource:com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl}
Liferay will supposedly use the templates in the specified paths (com/liferay/portlet/blogs/dependencies/email_entry_added_subject.tmpl and com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl). The thing is, it's not very clear what these paths are relative to. Are these files relative to $CATALINA_BASE? For example, would the above configuration result in Liferay looking up $CATALINA_BASE/com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl for creating the body of an email message? If this is not the case, where does Liferay lookup templates for Blog-related email messages?
After some digging, I've found that you place the templates in the $CATALINA_BASE/webapps/ROOT/WEB-INF/classes folder. Paths that you reference in the properties (e.g. blogs.email.entry.added.body=${resource:com/liferay/portlet/blogs/dependencies/email_entry_added_body.tmpl}) are relative to the aforementioned classes folder.
So, if I wanted Liferay to use a template file in the ff. relative path: org/foo/my_email_entry_added_body.tmpl, I would do two things:
Place the file in $CATALINA_BASE/webapps/ROOT/WEB-INF/classes/org/foo/my_email_entry_added_body.tmpl.
Add the following line to $CATALINA_BASE/portal-ext-env.properties: blogs.email.entry.added.body=${resource:org/foo/my_email_entry_added_body.tmpl}.
I consulted my co-worker and got a better understanding of why this is. The architecture of a Liferay application is such that it comes bundled with a Tomcat server. According to the documentation, WEB-INF/classes is a directory that a web app deployed to a Tomcat server looks up for classes and resources:
A class loader is created for each web application that is deployed in a single Tomcat instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application, are made visible to this web application, but not to other ones.
Specifically, this folder is high in priorty in the web app's classpath.
When you see Liferay code similar to ${resource:path/to/foo}, it's looking up resources in its classpath. One of the paths in that classpath is WEB-INF/classes. Hence, if path/to/foo is placed in WEB-INF/classes, Liferay will find path/to/foo there.

TomEE - Netbeans - folder outside project

I'm using Netbeans 8.2. for JavaEE Webapp with a TomEE 1.7.xx Server.
I need a folder with images, that is changed by the users.
Therefore I can't have the folder within in my project, because with war deployment it would be overwritten all the time with my development files.
Does anyone know how I can handle this?
You could deploy another another empty web application next to your application.
If a user upload an image in your application you would write it into e.g.:
tomee/webapps/imagecontainer/images/
and reference it from inside your application
<img src="myDomain.com/imagecontainer/images/xyz.jpg"/>
Like this you can deploy anytime any new version of your application. Of course
you are not allowed to undeploy the imagecontainer application.

Problems with relative paths in Eclipse.

I am trying to use relative paths in a Dynamic Web Project in Eclipse. I am NOT using them in the Servlet, but in another class that is called by the Servlet. The file I am trying to access to is a property file located in
MyProject/WebContent/WEB-INF/propertyFile.properties
I have tried almost every relative path...
WebContent/WEB-INF/propertyFile.properties
/WebContent/WEB-INF/propertyFile.properties
./WebContent/WEB-INF/propertyFile.properties
MyProject/WebContent/WEB-INF/propertyFile.properties
/MyProject/WebContent/WEB-INF/propertyFile.properties
WEB-INF/propertyFile.properties
/WEB-INF/propertyFile.properties
./WEB-INF/propertyFile.properties
...and so on...what can I do?
Thanks in advance!
You nee to understand that file IO read files, from the filesystem, and relative to the directory from which the JVM (i.e. your web container) is started.
Remember that, once your app is deployed to production, there won't be any MyProject or WebContent folder. That's what exists on your development machine. The only thing that will exist in production is the war file deployed in the application server.
What you actually want is to load a resource, located in the deployed web application (i.e. which is inside your war file).
To do that, you must use ServletContext.getResourceAsStream():
InputStream in = servletContext.getResourceAsStream("/WEB-INF/propertyFile.properties");

hosting a GWT application on private machine

I have a GWT application for some highcharts visualizations, that accesses Cassandra database in the back end. Obviously, because of privacy of data in the database I can not host the application on Google App Engine.
This application being a private one which is used by very few people, I dont expect lot of traffic.So, I was thinking of hosting the application on my own machine.
Please some one tell me is it good idea?, and how to go about implementing that.
Thanks..
It is not a problem at all, just set up some application server, like Tomcat, compile your gwt project, and export the war folder to the Tomcats webapps folder. Your war contents should have following structure (or similar):
project_name.war
- css
- images
- WEB-INF
- gwt compiled_javascript folder
- index.html

How-to deploy to application server web project with non-webproject structure (within Eclipse)

Basically what I want is to deploy from Eclipse web project to application server (WebLogic). The problem is that project source files are structured differently than what application server expects (i.e. there is no WEB-INF containing deployment descriptor). As a results when I try to deploy my project to app server it is not recognized as deployable app. Is there a smart and elegant way how-to solve this problem?
OK, i will answer my question myself. Basically this situation can be solved by creating a new dynamic web project with the required structure and then using Linked folder functionality of eclipse.