Can I make a change in propietary war file? - deployment

I have a proprietary application and its war file is available to us. I need to basically add a jsp page to the current application.
I was thinking i will write the independent jsp, java files build a war and add it to the proprietary war file.
Or
i will write the jsp, java files and add it to the same war.
Can i make a new war and make the proprietory to interact..
Which option is better.

I think you could unpack the war, then add your jsp. After that, re-build the war file.

Yes. Just unpack the war and add your custom content. Your libraries go in WEB-INF/lib and your classes in WEB-INF/classes. You can also add servlets, filters, and listeners to web.xml as needed.

Related

dependency web application inside another web application

I have a Spring MVC based rest api API_1. I want to create another api API_2 which will use all the same system vars of API_1. Basically I want to create a separate Spring boot rest service and add it as a dependency to API_1.
Is i possible to do this? I don't want to change packaging type from war to ear.
Only thing is I want this api separate project is because I think this feature can be used by other api's accross the project.
I was thinking if I can somehow load API_2 in API_1 after adding the dependency and some configs in web.xml or pom xml (adding some plugin)
If you don't want to create a jar out of war, you can consider maven overlays
An overlay of a WAR file, is simply a Maven project that uses another
project's WAR output as a dependency, rather than a project's JAR.
When the overlay project is built, the underlying project's WAR file
is exploded and files in the overlay project added to it. If an
overlay project has a file with the same path and name as a file in
the underlying WAR it will replace it.

JBoss jar library files

In JBoss, if you have an ear archive file, the way to tell the environment the place
of the lib folder, where it can find the library files, is the application.xml file.
Now I splitted the ear file into separate .war and .jar files. I do not have an ear folder anymore, so I deploy the war and jars directly in JBoss.
In the war archive I have the html and servlet files. In the jar archive I have the bean files. Now the library files are just needed by the java beans, not by the servlets.
So I need a folder in the .jar file to put the lib files and a way to tell the system the place of this folder.
If you want to have your jar libraries inside an ejb-jar: you can't, the standard specification doesn't allow you to have a jar inside another jar. Maybe some vendors provide specific solutions for that, but those are not standard. The standard solution would be to place all the related jars inside an ear. What you can do, and it's standard, is placing library jars inside the WEB-INF/lib directory of a war; but ejb-jar don't provide a similar structure.

Tell Glassfish to Use Existing Zip File

I am using Glassfish 3.1.2 with Dojo 1.7 and would like to shorten the build process, it's taking quite a while for maven to copy the dojo js files each build. I could use the CDN version dojo but I would like to be able to debug when offline. Is there a way to tell Glassfish to use the pre-zipped dojo source file? Just to be clear, I don't want Glassfish to zip the files for me.
Can you place the desired resources in an independent WAR file, and deploy separately? You'll have a context path to the resources (diff URL) that is dependent on the new WAR file, but you'll be able to deploy it once.
If that's not satisfactory, you could alternatively write a small servlet (packaged in your normal app) to expose resources that you locate (*.getClass().getResourceStream()) from a jar file you've placed in glassfishv3/glassfish/domains/domain1/lib. This is trivial to do via a restful-ws, also some libraries (primefaces) facilitate exposing resources.

Eclipse: Debug war in ear when the war-file only is a maven-dependency instead of an eclipse project

We have the following packaging:
something.ear (eclipse-project)
+webstuff.war (maven dependency only)
+businessstuff.ejb (eclipse-project)
Packaging works perfectly and I am able to debug all the businessstuff. But how can I make the sourcecode of webstuff.war visible in eclipse and therefore set brakepoints and debug it?
ear and war have only java class files(which is not editable) and not java source code. Better approach is to use some logging framework(i personally prefer log4j).
Every java project developed nowadays have used some logging framework, better search for them in the ear and war files.
On extracting the war file u can see some xml or .properties file which will say what loggong framework it uses.

In eclipse, is there a way to specify a location other than the WEB-INF, for web.xml

I want to place development web.xml in another folder in eclipse.
This can be done using the Deployment Assembly properties. Right click on the web project, choose Properties, and then navigate to the Deployment Assembly panel. Remove the /WebContent entry (pointing to /) and then add another entry, of type Folder. It should be rooted where you want to keep the web.xml, and mapped to /.
This technique can be extended to make Eclipse work with arbitrary build tool source layouts.
You might want to use Apache Ant
for that purpose. You may define a "conf" directory and place all you config files there, or a resource directory for the same reason.
If haven't use ant for that purpose, I strongly recommend you to do so.
Here is a sample ant build.xml for a web app Sample Build.XML
I'll use Maven myself, but since you're just beginning, Ant would be just fine.
I am using the eclipse builder and not ant.
Actually what i did was that i defined web.xml in another folder. So now I have two web.xml, one for welogic with a lot weblogic specific stuff like filters. And i have another for development which i placed in another folder, in the web project and added this folder to the deployment descriptor for tomcat in eclipse. So now when i deploy the application, the web.xml for tomcat which is in my specified folder owerwrites the web.xml present in web-INF folder(in the deployment directory).
Looks to me a nice workaround.