user663724
user663724

Reputation:

Jetty : Path of Extracted war

I have deployed a .war file inside Jetty Server.

The server has been started, but please tell me where could I see the contents of that war file??

I have read that:

If the extract parameter is true, any packed war or zip files will first be extracted to a temporary directory before being deployed.

Please tell me where can I set the extract parameter is true and what will be the temporary folder path??

This is my jetty-webapps.xml file

<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Ref id="DeploymentManager">
          <Call id="webappprovider" name="addAppProvider">
            <Arg>
              <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
                <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                <Set name="scanInterval">1</Set>
                <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
        <Set name="extractWars">true</Set>
              </New>
            </Arg>
          </Call>
    </Ref>
</Configure>

Upvotes: 6

Views: 19287

Answers (3)

YourAboutMeIsBlank
YourAboutMeIsBlank

Reputation: 1907

According to this Link:

You have few choices.

1) Specify your own java.io.tmpdir java system property location for jetty to use.

$ java -Djava.io.tmpdir=/path/to/my/new/temp/ -jar start.jar

2) Create a "work" directory under the ${jetty.home} path (whereever that is). That will cause Jetty to use that work directory instead of whatever the java.io.tmpdir property is set to.

3) Specify the tempDir attribute on the WebAppProvider deployments.

Only valid for war file deployment scenarios, NOT valid for context based deployment.

If you have etc/jetty-webapps.xml in your start.ini you have war file deployments enabled.

Edit the ${jetty.home}/etc/jetty-webapps.xml file and add 1 more attribute on the WebAppProvider. <Set name="tempDir">/path/to/my/preferred/temp/dir/for/all/webapps</Set>

4) Set the tempDirectory attribute on the WebAppContext with context based deployments. NOT valid for war file deployment scenarios.

If you have etc/jetty-context.xml in your start.ini you have context based deployments enabled.

Edit the ${jetty.home}/contexts/myapp.xml and add the tempDirectory attribute on the WebAppContext. <Set name="tempDirectory">/path/to/my/preferred/temp/dir/for/this/context</Set>

Upvotes: 0

Rajesh Pantula
Rajesh Pantula

Reputation: 10241

All the war files which you deploy are extracted in Jetty_Home/work for deployment. But if you want that war files should be extracted in temp folder before deployed to work folder, then you can set the extractWars parameter as true in jetty-webapps.xml file. The jetty-webapps.xml file is located in Jetty_HOME/etc/ folder.

<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Ref id="DeploymentManager">
          <Call id="webappprovider" name="addAppProvider">
            <Arg>
              <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
                <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                <Set name="scanInterval">1</Set>
                <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
        <Set name="extractWars">true</Set>
              </New>
            </Arg>
          </Call>
    </Ref>
</Configure>

Upvotes: 3

Yuta
Yuta

Reputation: 531

Check the log file. It should have a like like this

2012-11-06 17:41:54.334:INFO:oejw.WebInfConfiguration:Extract jar:file:/usr/oc/jcast8083/webapps/spdy.war!/ to /tmp/jetty-0.0.0.0-8083-spdy.war-_spdy-any-/webapp

In this case, the content of the war file is in

/tmp/jetty-0.0.0.0-8083-spdy.war-_spdy-any-/webapp

Upvotes: 7

Related Questions