How to deploy gwt static pages in jboss - gwt

I have some static files ( html, javascript, css - compiled gwt client code). I need to deploy that files in jboss.
That is I need to access like http://localhost:8080/Client/homepage.html .
Where do I need to put the files in jboss.
I tried putting it in
D:\Program Files\jboss-4.2.3.GA\server\default\deploy\Client\homepage.html
restarted the server and tried to access
http://localhost:8080/Client/homepage.html.
But it shows 404 error.
How should I fix this?

If you rename Client folder to Client.war, the example will work.
You don´t need to do anything special to deploy static files, just place them in a valid war and that´s it. By valid war I mean having a WEB-INF folder with your web descriptor inside (web.xml), lib and classes folder, etc..
It is shown here:
http://docs.oracle.com/javaee/5/tutorial/doc/bnadx.html

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.

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");

The generated war after the deploy, does not see the servlets

I generated two war files, one using export-> war file in Eclips second using maven-war-plugin. When I deploy this war in localhost tomcat7 or on an external server, the Tomcat application can not find the servlet. Links that point to servlets returns a 404 error
War is correctly deployowany because the home page is displayed correctly.
Eclipse does not show any errors in servlets so I say that's not the problem.
Deploy war directory structure looks like this:
css, fonts, img, js, loess, META-INF, pages, WEB-INF (with epmpty controller folder and the folder lib with my jar eg. Mysql_connector). But nowhere I can not see the folders with my model
Does anyone have any idea why this is happening?

GWT Deployment Confusion, Please give some guidelines

I wanted to know one thing. When deploying a GWT application on
the server, lets say an application in which there are client files
Greeting.java(entrypoint), service.java,serviceAsync.java and server
file serviceImpl.java(), only the client files will converted to
javascript. After compilation, I take the war file and place it on the
server, but where to place the server file that is serviceImpl.java???
The war file will also contain a /WEB-INF folder with the web.xml your libs and the other java classes needed for the server side.
So you only need to copy your war file in the proper webapps folder from your server.

hosting GWT project

What do i need to upload from my gwt project to web hosting?
its just html or all project files?
Any modern Java IDE gives you an option to export a web project as a war module. If your are not using an IDE, it depends:
If you just write your code under client folder, no need to upload any .class files to the server. You don't need any Java Application server as well, and a normal HTTP server (such as Apache) would suffice. An example of such a GWT application is GWT showcase which is included in GWT download package.
If you have any server-side code under server package, then you should upload .class files (under WEB-INF/classes folder in your web modile) as well as the rest of .js, .css, .jpg/gif, .html files. In this case you need a servlet container such as Tomcat to serve your server-side code.
You'll only need to upload the html files, the css files, and your java file. Also, any other file linked to within your html files need to go in the same directory.