I need to put some property files (config file required by a library) in the starting path of the Jetty server in DevMode but could not figure out where to put them. Where should I put them?
I googled but no luck for that. Any help is appreciated.
You need to share your project set up information. Maven? Also mention whether property file is for app or jetty and what you are trying to achieve.
Also you can try putting up the properties file in web-inf/classes if it is project specific.
I am guessing you are not using any standard GWT project set up. It will be very difficult to proceed further even if you get this solved. I recommend you should go with gwt standard set up. You can reference GWT samples folder from here.
Use Hello project set up as template. If you are beginner also read up on https://developers.google.com/web-toolkit/doc/latest/RefCommandLineTools#webAppCreator.
If you use maven in your project, placing them in the src/main/resources should work.
Otherwise put it in your WEB-INF/classes
Related
Trying to create custom UI component going through ZK 6.0.1 Component Development Essentials.
Always got error in logs "http://localhost:8080/zk6/zkau/web/_zv2011051111/js/examples.com.foo.wpd : HTTP Status 404 - /js/examples.com.foo.wpd" when trying to use custom component.
Found the war file with this example in scala, it works OK. I have copied all files from it to my project, and got same error.
The project structure is according to tutorial. What might be wrong?
You have to put the web folder, which contains the js files, in the java classpath, that means it should be put under the src folder. More easy way is to use the ZK Maven Archetype to create the template for you.
At least the way IntelliJ IDEA does things (which I see your are using, as am I), simply placing the web folder under the src folder doesn't seem to automatically get it copied to the artifact (although I'm not sure why). So I tried manually putting it in the WEB-INF/classes folder, and that worked. So the correct path for your example is <project-root>/web/WEB-INF/classes/web/js/examples/com/foo/zk.wpd.
I am working on a lift project as a sub-project in a gigantic mvn project. I put the property files into:
src/main/resources/props/staging.props
src/main/resources/props/production.props
in the sub-project folder.
Then I run jetty with:
mvn jetty:run -Drun.mode=staging
I printed out the settings from net.liftweb.util.Props using:
println("file_name:" + Props.fileName)
println("mode_name:" + Props.modeName)
The output:
file_name:lift.props
mode_name:staging
The mode name is correct. However, the file name is totally wrong. net.liftweb.util.Props is still using the file name that had been hardcoded in the source. It seemed never reached my property file.
Am I missing something? Or it cannot work with jetty?
While duffymo is right and you can just use the underlying servlet facilities for getting resources, I would still use Lift's Properties abstraction. It already does the work for differentiating different run modes. It also allows you to have different properties per-user and/or per-machine, which can be useful, depending on your development team.
The default properties for a given mode should be put in /props/modeName.default.props, so your files should be renamed to:
src/main/resources/props/staging.default.props
src/main/resources/props/production.default.props
I would put the .properties file in your /WEB-INF/classes and use the servlet context's getResourceAsStream() to read it in.
i have checked similar posts and have googled but could not find an eligible answer to this. When ever i import a jsf project from some other system (where its working fine) OR delete the tomcat server in eclipse and add new server back again...there are lots of tag libs and imports that go "unresolved". Such applications are often not created by me and i dont exactly know which libraries are to be added to configure and fix project in eclipse.
I want to ask, is there any general way to find out all the required libraries for any imported jsf project and then add them.
Thanks in advance.
Download the javax.faces.jar file and drop it in project's /WEB-INF/lib folder.
That's all.
Is there a way to split up a Dynamic Web Project in Eclipse into two libraries and link them up properly?
So, I'd like to have a library project and two other applications specific web projects. Both using the library project.
I looked into the "references" option in Eclipse to link projects up but didn't work as intended. I also looked into Web Fragment feature but that didn't let me define servlets which need to be defined in the lib project as well as the servlets will be the same for both projects.
Also, is there a way to overlay content from the lib project by content defined in each project? Example:
-Lib
-WEB-INF
-img.jpg
-AppProjectA (using Lib project)
-WEB-INF
-img.jpg
I'd like to be able to use the Lib project in AppProjectA and replace the img.jpg file imported from the lib project with the one defined in AppProjectA.
I looked into Maven overlay but that's a bit too crazy for what I need to do. I also prefer Ant script over Maven. Any ideas on how to accomplish what I need to do here?
I guess with sufficiently clever Ant you probably can achieve what you want, but I don't know of anything off the shelf. However do you really need to do this? Can you get the level of reuse by just referring to resources from the other web app?
Suppose you deploy them both, each with their own context root.
A page from appA can refer to appB
/appB/imgages/img.jpg
For common code, put it in a library JAR project, packaging the JAR in the root of the EAR, or in WEB-INF/lib of each app.
With the Galileo release it is finally possible to convert a normal Java project to a dynamic web project. Unfortunately it assumes that the Web stuff is located in a folder WebContent, which is not necessarily the case for an existing project. How can I change it? In MyEclipse it is quite easy, but with a stock eclipse I don't find such an option!
I am not sure what you meant by "a stock eclipse", but Helios allows this functionality in a very straight-forward way:
Right click your dynamic web project and open "Properties".Find Deployment Assembly and you should be able to set context paths from there.
I am not sure if there is UI for this or not, but you can edit file .settings/org.eclipse.wst.common.component, and change following line:
<wb-resource deploy-path="/" source-path="/WebContent"/>
Change /WebContent to your preferred directory. I use this for a several years now and encountered no problems with it.
Go in the project properties and do like this example where I use the Maven webapp folder: