The order of that Configuration list is very important.

It would be better to utilize the Server level component and just add the
missing pieces you need.

See:

   -
   
https://github.com/eclipse/jetty.project/blob/jetty-9.4.38.v20210224/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java#L168-L177
   -
   
https://github.com/jetty-project/embedded-jetty-jsp/blob/4918be37b938fff9fada5910ca04c59d8969cc90/src/main/java/org/eclipse/jetty/demo/Main.java#L131-L136


        // === setup jetty plus ==
        Configuration.ClassList classlist =
Configuration.ClassList.setServerDefault(server);

        // Add JNDI support
        classlist.addAfter(
            "org.eclipse.jetty.webapp.FragmentConfiguration",
            "org.eclipse.jetty.plus.webapp.EnvConfiguration",
            "org.eclipse.jetty.plus.webapp.PlusConfiguration");

        // Add Annotation Scanning Support

classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
            "org.eclipse.jetty.annotations.AnnotationConfiguration");

Leave the existing Configurations in place, don't overwrite/replace the
entire list like you are doing.
There is no need to configure the WebAppContext directly.

Joakim Erdfelt / joa...@webtide.com


On Fri, Mar 26, 2021 at 4:42 PM Som Lima <somplastic...@gmail.com> wrote:

> Hi,
>
> There appears to be a number of ways to configure annotations, jsp support
> programmatically in the jetty embedded. i.e. Configuration.ClassList.
>
> I have gone for this implementation.
> Is there a one liner  new class I can insert in this code  to add for JSP
> functionality followed by corresponding libraries in the pom.xml ?
>
> context.setConfigurations(new Configuration[]
>         {
>             new AnnotationConfiguration(),
>             new WebInfConfiguration(),
>             new WebXmlConfiguration(),
>             new MetaInfConfiguration(),
>             new FragmentConfiguration(),
>             new EnvConfiguration(),
>             new PlusConfiguration(),
>             new JettyWebXmlConfiguration()
>         });
> <http://www.backbutton.co.uk/>
> Regards
>
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to