[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] Non-standard web application deployment question
|
You can use the method WebAppContext#setExtraClasspath
/**
* @param extraClasspath Comma or semicolon separated path of
filenames or URLs
* pointing to directories or jar files. Directories should end
* with '/'.
*/
public void setExtraClasspath(String extraClasspath).
Here is how the WebAppClassLoader uses it:
/**
* @param classPath Comma or semicolon separated path of filenames or URLs
* pointing to directories or jar files. Directories should end
* with '/'.
*/
public void addClassPath(String classPath)
throws IOException
{
if (classPath == null)
return;
StringTokenizer tokenizer= new StringTokenizer(classPath, ",;");
while (tokenizer.hasMoreTokens())
{
Resource resource= _context.newResource(tokenizer.nextToken());
if (Log.isDebugEnabled())
Log.debug("Path resource=" + resource);
// Resolve file path if possible
File file= resource.getFile();
if (file != null)
{
URL url= resource.getURL();
addURL(url);
}
else
{
// Add resource or expand jar/
if (!resource.isDirectory() && file == null)
{
throw new IllegalArgumentException("!file: "+resource);
}
else
{
URL url= resource.getURL();
addURL(url);
}
}
}
}
It sounds like you will need a little bit of code to compute the list
of jars inside the lib directory and you should be set.
With this method I was able to "deploy" a java project that contains a
web-app without having to move things around until the fit a standard
WAR.
I hope this helps.
Hugues
On Thu, Jun 10, 2010 at 12:25 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
> All of the apps you deploy to Jetty eventually wind up as a Context within
> Jetty.
> Even WAR files are provided to Jetty as a WebAppContext, which handles the
> configuration, defaults, and classloaders for that specific context.
> If you want to deviate from the Servlet specs, feel free to start with the
> WebAppContext and modify it's Classloader to load the classes from wherever
> and in whatever order you want it to. The deployment of your new
> EnhancedWebAppContext can be accomplished as any other Context within Jetty.
> - Joakim
>
> On Thu, Jun 10, 2010 at 12:21 PM, Chad La Joie <lajoie@xxxxxxxxx> wrote:
>>
>> Right, that's to deploy WARs and exploded WARs. Which isn't what I'd
>> prefer. I'd like to not have to change the current installation directory.
>> I have a few tens of thousands of deployers that would not be happy with
>> that. That's why I was trying to find something that would allow me to
>> point to the component parts of the web applications.
>>
>> On 6/10/10 3:15 PM, Michael Gorovoy wrote:
>>>
>>> I'm having trouble finding the right example at the moment...
>>>
>>> Take a look at ${jetty.home}/contexts/test.xml and note properties 'war'
>>> and 'extractWAR'. The way they are set up now is to extract a war
>>> file... If extractWAR is set to true, and 'war' is pointing to a
>>> directory that contains war file structure, it will work the way you
>>> would want.
>>>
>>> -Michael
>>>
>>> Michael Gorovoy | mgorovoy@xxxxxxxxxxx <mailto:mgorovoy@xxxxxxxxxxx> |
>>> http://www.intalioworks.com |
>>>
>>>
>>> On Thu, Jun 10, 2010 at 2:58 PM, Chad La Joie <lajoie@xxxxxxxxx
>>> <mailto:lajoie@xxxxxxxxx>> wrote:
>>>
>>> Oh, sorry. v7
>>>
>>>
>>> On 6/10/10 2:56 PM, Michael Gorovoy wrote:
>>>
>>> What version of Jetty are you running?
>>>
>>> Michael Gorovoy | mgorovoy@xxxxxxxxxxx
>>> <mailto:mgorovoy@xxxxxxxxxxx> <mailto:mgorovoy@xxxxxxxxxxx
>>> <mailto:mgorovoy@xxxxxxxxxxx>> |
>>>
>>> http://www.intalioworks.com |
>>>
>>>
>>> On Thu, Jun 10, 2010 at 2:33 PM, Chad La Joie <lajoie@xxxxxxxxx
>>> <mailto:lajoie@xxxxxxxxx>
>>> <mailto:lajoie@xxxxxxxxx <mailto:lajoie@xxxxxxxxx>>> wrote:
>>>
>>> Before asking my question let me start by describing where
>>> I'm at today.
>>>
>>> I have an application whose install directory structure looks
>>> something like this:
>>>
>>> /lib
>>> /conf
>>> /bin
>>> /logs
>>> ...
>>>
>>> Contained in lib directory are all the jars that make up the
>>> web
>>> application. In the conf directory are the configuration
>>> files for
>>> the app. In bin are command line tools that also use the
>>> contents
>>> of the lib directory, one of which tests configurations.
>>>
>>> Currently, what I do is create a WAR file from everything in
>>> lib + a
>>> web.xml file. The problem I'm having is that users drop in
>>> extension jars in the /lib directory, make appropriate
>>> changes to
>>> the conf files, run the config test script and everything
>>> checks
>>> out. They then restart their web app and the new config fails
>>> (since the extension jar isn't in the WAR file). I provide
>>> a way
>>> for them to regen the WAR but a lot of people forget to do
>>> that.
>>>
>>> So, my question is, is there a particular deployer or context
>>> handler where I can specifically configure the classpath and
>>> web.xml
>>> file? That way I wouldn't need a WAR file at all and so it
>>> would
>>> never get out of synch.
>>>
>>> Thanks.
>>>
>>> --
>>> Chad La Joie
>>> http://itumi.biz
>>> trusted identities, delivered
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx <mailto:jetty-users@xxxxxxxxxxx>
>>> <mailto:jetty-users@xxxxxxxxxxx <mailto:jetty-users@xxxxxxxxxxx>>
>>>
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx <mailto:jetty-users@xxxxxxxxxxx>
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>>
>>> --
>>> Chad La Joie
>>> http://itumi.biz
>>> trusted identities, delivered
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx <mailto:jetty-users@xxxxxxxxxxx>
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>> --
>> Chad La Joie
>> http://itumi.biz
>> trusted identities, delivered
>> _______________________________________________
>> jetty-users mailing list
>> jetty-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>