Coder Social home page Coder Social logo

jastow's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jastow's Issues

Sample wih custom tag integration

Hi,

I played with the API to write a unit test that starts undertow and configures my custom tag to parse a JSP which uses those custom tags, but without any success.

Can you complete README.md instructions and/or unit tests of the project with a sample including custom tags?

Thanks!

Update README.md

When landing in this repo, README.md doesn't share a lot of info. For example:

  • The main goal is not explained
  • The issue tracker is not shared
  • There aren’t instructions on how to build the code base

It would be very helpful if the above information could be shared with the the community

How to fix JSTL error in Jastow?

2015-09-30-11:05:06:548 - ERROR - LoggingExceptionHandler - UT005023: Exception handling request to /jee7eg/index.jsp org.apache.jasper.JasperException: JBWEB004113: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:57) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:278) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:75) at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:218) at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:124) ...

Cannot be used in spring boot

Cannot be used normally in sping boot?

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Aug 03 18:10:55 CST 2017
There was an unexpected error (type=Not Found, status=404).
Not Found

Map<String, TagLibraryInfo> tags = new HashMap<>(); Does NOT works.

Such code added to support JSTL

public static Map<String, TagLibraryInfo> toJSTL() {
        Map<String, TagLibraryInfo> tags = new HashMap<>();

        String[][] jstlInfos = {
            {"http://java.sun.com/jstl/core_rt", "c-1_0-rt.tld", "1.0", "1.0"},
            {"http://java.sun.com/jstl/core", "c.tld", "1.0", "1.1"},
            {"http://java.sun.com/jsp/jstl/functions", "fn.tld", "1.0", "1.1"},
            {"http://java.sun.com/jstl/fmt_rt", "fmt-1_0-rt.tld", "1.0", "1.0"},
            {"http://java.sun.com/jstl/fmt", "fmt.tld", "1.0", "1.1"},            
            {"http://java.sun.com/jsp/jstl/sql", "sql.tld", "1.0", "1.1"},
            {"http://java.sun.com/jstl/sql_rt", "sql-1_0-rt.tld", "1.0", "1.1"},            
            {"http://java.sun.com/jsp/jstl/xml", "x.tld", "1.0", "1.1"},
            {"http://java.sun.com/jstl/xml_rt", "x-1_0-rt.tld", "1.0", "1.1"}
        };

        for (String[] jstlinfo : jstlInfos) {
            TagLibraryInfo info = new TagLibraryInfo();
            info.setUri(jstlinfo[0]);
            // ### OR this ("/"+jstlinfo[1]); ERROR STILL EXIST.
            info.setPath("/META-INF/"+jstlinfo[1]);
            info.setVersion(jstlinfo[2]);
            info.setTlibversion(jstlinfo[3]);
            // ### OR this ("/META-INF/"+jstlinfo[1]);  ERROR STILL EXIST.
            tags.put("/"+jstlinfo[1], info);
        }

        return tags;
    }

Full Sample here.
https://github.com/gencube/JstlJastow

It does not seems to work.

First Good Issue

If the issue tracker of this project is UNDERTOW, then the “first-good-issue” label should be advertised in the CONTRIBUTING.md file (I raised a PR for adding this file)

Update Jastow to the latest Apache Jasper

Seems the Jasper version used by jastow is older and requires much configuration to work with jstl tag libraries and custom tags. The latest jasper version supports searching through jars and finding TLDS, parses them and creates the tag definitions which is convenient for the developer.

Calling the JspServlet by a background thread

I also posted this on StackOverflow: http://stackoverflow.com/questions/33878758/jastow-jsp-integration

The README, says that the integration requires a "periodic call to the PeriodicEvent interface on the JasperServlet instance". I assume that this is for compiling new JSPs and unloading non-existent JSPs. This would be required only if JSPs are being modified or added/removed while the server is running, right? However, I noticed that when using Jastow with Undertow, the JSPs are being recompiled every time they are changed. This is happening without my server application calling the PeriodicEvent interface. Is the call by the background thread to the JspServlet still necessary? If so, for what?

the test case running error

SimpleJspTestCase class running error.the console print as follows:

io.undertow.servlet.api.LoggingExceptionHandler handleThrowable
ERROR: UT005023: Exception handling request to /servletContext/200.jsp
javax.servlet.ServletException: UT010013: Could not instantiate Default Jsp Servlet
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:227)
at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:169)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:274)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:253)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.InstantiationException
at io.undertow.servlet.util.ConstructorInstanceFactory.createInstance(ConstructorInstanceFactory.java:49)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:225)
... 23 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at io.undertow.servlet.util.ConstructorInstanceFactory.createInstance(ConstructorInstanceFactory.java:42)
... 24 more
Caused by: java.lang.ExceptionInInitializerError
at org.apache.jasper.servlet.JspServlet.(JspServlet.java:72)
... 29 more
Caused by: java.lang.IllegalArgumentException: Invalid logger interface org.apache.jasper.JasperLogger (implementation not found in sun.misc.Launcher$AppClassLoader@b412c18)
at org.jboss.logging.Logger$1.run(Logger.java:2556)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2529)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2516)
at org.apache.jasper.JasperLogger.(JasperLogger.java:45)
... 30 more

io.undertow.servlet.api.LoggingExceptionHandler handleThrowable
ERROR: UT005023: Exception handling request to /servletContext/jspFile
javax.servlet.ServletException: UT010013: Could not instantiate jsp-file
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:227)
at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:169)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.jsp.JspFileHandler.handleRequest(JspFileHandler.java:32)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:274)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:253)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.InstantiationException
at io.undertow.servlet.util.ConstructorInstanceFactory.createInstance(ConstructorInstanceFactory.java:49)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:225)
... 24 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at io.undertow.servlet.util.ConstructorInstanceFactory.createInstance(ConstructorInstanceFactory.java:42)
... 25 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jasper.JasperLogger
at org.apache.jasper.servlet.JspServlet.(JspServlet.java:72)
... 30 more

io.undertow.servlet.api.LoggingExceptionHandler handleThrowable
ERROR: UT005023: Exception handling request to /servletContext/a.jsp
javax.servlet.ServletException: UT010013: Could not instantiate Default Jsp Servlet
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:227)
at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:169)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:274)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:253)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.InstantiationException
at io.undertow.servlet.util.ConstructorInstanceFactory.createInstance(ConstructorInstanceFactory.java:49)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:225)
... 23 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at io.undertow.servlet.util.ConstructorInstanceFactory.createInstance(ConstructorInstanceFactory.java:42)
... 24 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.jasper.JasperLogger
at org.apache.jasper.servlet.JspServlet.(JspServlet.java:72)
... 29 more

Bugs Could Occur When Importing Jar undertow-servlet-1.4.20.Final.jar in This Project

Hi Developer, I found that your project uses a vulnerable jar which is undertow-servlet-1.4.20.Final.jar and calls the vulnerable function handleRequest in file ServletInitialHandler.java (See details in Repository undertow-io/undertow, commitid: d2715e3afa13f50deaa19643676816ce391551e9)
The CVE number of this vulnerability is CVE-2019-10184
If this project is still in use, please check it and fix this bug as soon as possible. You can update the imported jar undertow-servlet-1.4.20.Final.jar to version over 2.0.23.Final to avoid this bug, thx.

Cannot support Spring view JSP.

I have got the JSTL working in a simple JSP page.
However, now it seems to be NOT able to support:
/WEB-INF/views/login.jsp

Servlet Path:
/WEB-INF/views/login.jsp

Path Info:
null

Query String:
null

Stack Trace
org.apache.jasper.JasperException: JBWEB004001: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:667)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:402)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:346)
javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:81)
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:265)
io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:200)
io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:193)
io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:927)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)

Malformed URL for tag dependant

The dependants added in TagFileLoaderVisitor.visit() are invalid URLs, causing new URL(key) in Compiler.isOutDated() to fail with MalformedURLException, falling back to assuming that they are outdated.

Example path generated: "jar:/WEB-INF/lib/library.jar!/META-INF/sample.tld"
Causing the following exception:

DEBUG [org.apache.jasper.compiler] (default task-7) Problem accessing resource. Treat as outdated.: java.net.MalformedURLException: invalid url: /WEB-INF/lib/library.jar!/META-INF/sample.tld (java.net.MalformedURLException: no protocol: /WEB-INF/lib/library.jar)
    at java.net.URL.<init>(URL.java:620)
    at java.net.URL.<init>(URL.java:483)
    at java.net.URL.<init>(URL.java:432)
    at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:491)
    at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:406)
    (...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.