Jboss AS7, native APR and sendfile connectors

I tried to implement support for a function similar to mod_xsendfile on torque (www.torquebox.org). Torquebox is basically a bunch of code on top of JBoss AS 7, which makes my efforts look like sendfile on JBoss AS 7.

The main problem here is probably my confusion regarding JBoss, but having spent too much time exhausting all the resources to work on Google, I have to be sure that someone there who really knows how this thing works in AS 7.

As I understand it, sendfile is supported in JBoss using the native JBoss Web connectors (http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-10), namely the APR http connector.

After spending hours installing AS 7, which seems like a charm to others (https://community.jboss.org/message/614790), grep'ing of my local JBoss distribution tells me that these native connectors are usually connected to AS 7. In my case, the required DLL is in

% JBOSS_HOME% \ Modules \ org \ JBoss \ like \ Web \ home \ Lib \ win-win x86_64

So an epic failure, trying to establish something that already exists. Checking my standalone.xml configuration file also shows that this native connector is being used

<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host"> <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="false"> <alias name="localhost"/> <alias name="example.com"/> </virtual-server> </subsystem> 

Switching all levels of logging for debugging and checking the log shows a log message

standalone / log / server.log.2012-02-02: 324: 23: 12: 17,964 INFO [org.apache.coyote.http11.Http11AprProtocol] (MSC 1-5 service flow) Running Coyote HTTP / 1.1 on HTTP-127.0 .0.1-127.0.0.1-8080

Where Http11AprProtocol indicates that the HTTP APR connector is being used. However, many Internet posts mention that the following line should also be shown:

org.apache.catalina.core.AprLifecycleListener init INFO: APR features: IPv6 [true], sendfile [true], accept filters [false], random [true].

Regardless of the logging level, the AprLifecycleListener line is never displayed.

When I look at it, it seems that the http APR connector is now being used.

According to the docs, I can get the following servlet to work

 public class Sendfile extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(Boolean.TRUE == request.getAttribute("org.apache.tomcat.sendfile.support")){ // Send all the files!! } else{ throw new ServletException("BOOM!"); } } } 

But no. The org.apache.tomcat.sendfile.support attribute is NULL, and if I try to set the HTTP headers for sending the file (ignoring the support attribute) and set the other necessary sendfile attributes, my browser thinks that it receives the file, but the data is not transmitted. .. and the connection remains hanging.

To finish the question, it seems that the built-in APR connector is being used, sendfile should be enabled by default, but the server does not know what I'm trying to do.

How to act?

+1
source share
1 answer

I also lost hours trying to find out how it works. You did everything right. Just skipped the web system as native=true :

 <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="true"> 

Running with it:

 11:00:26,018 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: apr-1 11:00:26,039 DEBUG [org.jboss.modules] (ServerService Thread Pool -- 58) Module org.jboss.xb:main defined by local module loader @d8d9850 (roots: /home/mmagnani/Development/jboss-eap/jboss-eap-6.0/modules) 11:00:26,070 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: z 11:00:26,071 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: crypto 11:00:26,072 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: ssl 11:00:26,079 DEBUG [org.jboss.as.ejb3] (ServerService Thread Pool -- 36) Adding EJB @Asynchronous support 11:00:26,082 DEBUG [org.jboss.as.ejb3] (ServerService Thread Pool -- 36) Configuring timers 11:00:26,092 DEBUG [org.jboss.as.ejb3] (ServerService Thread Pool -- 36) Adding EJB IIOP support 11:00:26,101 FINE [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-6) Starting server HornetQServerImpl:: 11:00:26,120 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded: tcnative-1 11:00:26,141 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) Loaded Apache Tomcat Native library 1.1.23. 11:00:26,141 DEBUG [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) APR capabilities: IPv6 [true], sendfile [true], random [true]. 

Good luck :)

+8
source

All Articles