Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jsp configuration class

I was just trying to identify the issues so I can report it for you to have a look at. 
I was switching only for that purpose.

On Sat, 3 Apr 2021, 08:13 Greg Wilkins, <gregw@xxxxxxxxxxx> wrote:
Som,

in 11 there is indeed no ClassList, so that part is "broken".  Just delete those lines... and tell us what your code was doing with classlist.

Note switching back and forth from 9 to 11 is difficult. 



On Sat, 3 Apr 2021 at 17:59, Som Lima <somplasticllc@xxxxxxxxx> wrote:
Then there is an issue with 
       Configuration.ClassList classlist = Configuration.ClassList
            .setServerDefault(server);

I kept changing jetty version in pom.xml from 11 to 9. 
That is the only change I made.
I did it a number of times to satisfy myself.
When 9 no issue but when 11 then an error reported by eclipse IDE.


On Sat, 3 Apr 2021, 06:51 Greg Wilkins, <gregw@xxxxxxxxxxx> wrote:
Som,

Neither WebAppContext nor ServletHandlerContext are obsolete.

However, you only need to call setConfigurations in exceptional circumstances as typically it is sufficient just to put a jar on the class path for any Configuration instance that it contains to be discovered and added to your WebAppContext automatically.


On Sat, 3 Apr 2021 at 14:59, Som Lima <somplasticllc@xxxxxxxxx> wrote:

The use of both the WebAppContext class  and  ServletHandlerContext class  have become obsolete in jetty 11 so the recommendation  to use classlist  instead of  WebAppContext.setConfigurations wasn't relevant.



On Fri, 26 Mar 2021, 23:40 Joakim Erdfelt, <joakim@xxxxxxxxxxx> wrote:
What version of Jetty are you using?

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Fri, Mar 26, 2021 at 6:34 PM Som Lima <somplasticllc@xxxxxxxxx> wrote:
Hi Thanks,

I did try this Configuration.ClassList approach earlier  but I was getting an error "
Multiple markers at this line
- ClassList cannot be resolved or is not a field
- Configuration.ClassList cannot be resolved to a
type

I think was due to  an incompatible server object.

I am working in another project now
this time I inserted the code ,  no eclipse IDE errors reported I guess the server object is compatible.
My code looks like this but still I am missing JSP feature. Not sure the syntax for that.
console error message"  No JSP support.  Check that JSP jars are in lib/jsp and that the JSP option has been specified to start."

I have these two dependencies in pom.xml

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>

This is what my code looks like but I don't think I have the jsp configuration in either  variations

       context.setBaseResource(Resource.newResource(webResourceBase));
        context.setConfigurations(new Configuration[]
        {
            new AnnotationConfiguration(),
            new WebInfConfiguration(),
            new WebXmlConfiguration(),
            new MetaInfConfiguration(),
            new FragmentConfiguration(),
            new EnvConfiguration(),
            new PlusConfiguration(),
            new JettyWebXmlConfiguration()
        });

        // === setup jetty plus ==
        Configuration.ClassList classlist = Configuration.ClassList
            .setServerDefault(server);
        classlist.addAfter(
            "org.eclipse.jetty.webapp.FragmentConfiguration",
            "org.eclipse.jetty.plus.webapp.EnvConfiguration",
            "org.eclipse.jetty.plus.webapp.PlusConfiguration");
        classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
            "org.eclipse.jetty.annotations.AnnotationConfiguration");

        context.setContextPath("/");

On Fri, 26 Mar 2021, 22:19 Joakim Erdfelt, <joakim@xxxxxxxxxxx> wrote:
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: 

        // === 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 / joakim@xxxxxxxxxxx


On Fri, Mar 26, 2021 at 4:42 PM Som Lima <somplasticllc@xxxxxxxxx> 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()
        });
Regards


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


--
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


--
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top