Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Using jetty-quickstart when Jetty is embedded

Matthew,

I guess we need to improve the doco judging by your questions. I've opened an issue for that: https://github.com/eclipse/jetty.project/issues/896

All you need to do in your jetty startup code is to replace your WebAppContext with a QuickStartWebapp, and set "autoPreconfigure=true" as per the example in the doc:
<Configure class="org.eclipse.jetty.quickstart.QuickStartWebApp">
  <Set name="war"><Property name="jetty.webapps" default="."/>/benchmark.war</Set>
  <Set name="contextPath">/benchmark</Set>
  <Set name="autoPreconfigure">true</Set>
</Configure>
The "autoPreconfigure"=true will first generate the quickstart-web.xml if it's not there before running the code. If it is there, it will use it. So you can either pre-generate it in the build step of your war file (you could use the jetty maven plugin for that: http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#_jetty_effective_web_xml), or just let it be generated at runtime as necessary.

cheers
Jan

On 2 September 2016 at 09:57, Matthew Sheppard <msheppard@xxxxxxxxxxxxxx> wrote:
Thanks Jan,

Hope you're looking at more recent documentation that that link :)  The
current doco is here: http://www.eclipse.org/jetty/documentation/current/

Somehow Google always seems to have trouble getting me to the ‘right’ jetty doc :)
Thanks for the pointer though. I included the link only to ensure what I meant by ‘embedded’ was clear, which it sounds like it is either way.
 
You might try looking at this class for some hints:
https://github.com/eclipse/jetty.project/blob/jetty-9.3.x/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureQuickStartWar.java

Yeah, I found that one, and was able to run it with a simple groovy script…

```
@Grapes(
    @Grab(group='org.eclipse.jetty', module='jetty-quickstart', version='9.3.11.v20160721')
)

import org.eclipse.jetty.quickstart.PreconfigureQuickStartWar;

PreconfigureQuickStartWar.main(“webapp.war”, “/tmp/processed");
 ```

Which does indeed unpack the war and produce the WEB-INF/quickstart-web.xml file alongside the normal web.xml.

However, I’m a bit unclear on where to go from there - Does Jetty pick that file up by default, or do I need to tell it to do so somehow? If it does pick it up by default, come to think of it, could I generate that quickstart-web.xml into my .war at build time and then do nothing to the actual running jetty side?

Best,
Matt

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD


Back to the top