Closed liyiorg closed 7 years ago
@liyiorg have you tried adding
<async-supported>true</async-supported>
to the definition of the JettyJspServlet inside etc/webdefault.xml? Don't forget if you edit that file that you need to apply it to your context. In xml that would be:
<Set name="defaultsDescriptor">/path/to/your/special/webdefault.xml</Set>
or in code:
webAppContext.setDefaultsDescriptor("/path/to/your/special/webdefault.xml");
I tested the above, and checked the value of request.isAsyncSupported()
inside a jsp, and it was true.
Let me know if this works for you.
@janbartel Thanks! definition JettyJspServlet to web.xml,It's works OK!
<servlet id="jsp">
<servlet-name>jsp</servlet-name>
<servlet-class>org.eclipse.jetty.jsp.JettyJspServlet</servlet-class>
<async-supported>true</async-supported>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>DEBUG</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.7</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.7</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<url-pattern>*.jspx</url-pattern>
<url-pattern>*.xsp</url-pattern>
<url-pattern>*.JSP</url-pattern>
<url-pattern>*.JSPF</url-pattern>
<url-pattern>*.JSPX</url-pattern>
<url-pattern>*.XSP</url-pattern>
</servlet-mapping>
Cool.
Assigning to Chris for some documentation: we might make mention of how to configure the jsp servlet in order to support async operations in jsps/taglibs.
@janbartel should we not change our webdefault.xml
to default to async-supported=true
? Nowadays it's perhaps a better default than few years ago.
@sbordet I guess we could. I am hesitating because normally one would expect async-supported=true to apply to the servlet it is declared on: however in this case, it is really applying to the servlets that are generated by the JspServlet, not the JspServlet itself. Which seems a bit weird.
@janbartel your call then to whether change th default or improve documentation.
@liyiorg note that you could also have just put the following lines into your web.xml, instead of changing webdefault.xml:
<servlet id="jsp">
<servlet-name>jsp</servlet-name>
<async-supported>true</async-supported>
</servlet>
I think we'll just document this for now.
@janbartel Thank you very much! It also applies to Tomcat. I'm writing a JSP big page project. https://github.com/liyiorg/viewblock
Is there any good advice for me,Dear experts!
Hi, I want use async request in JSP tag. Jetty version:9.2.19.v20160908
Example
How config output 'true' in Jetty?