Skip to main content

Build Wine rpm with 32 bit application support

Wine is a software to allow running Windows applications in Linux, MAC etc. platforms. It is available for installation from package managers like yum (RHEL, CentOS) and apt (Ubuntu). You can find more details on how it works in Wine wiki . But the default Wine package available from package manager does not have support for 32 bit Windows applications. This was the case for me. In Redhat Enterprise Linux 7.3, the wine package did not contain support for 32 bit windows applications. So the only option was to build a separate rpm of wine which will include this support. All the steps are executed on a RHEL 7.3 VM (x86_64). Step 1 Download and run shell script which will make wine 64 and 32 support for RHEL: https://github.com/zma/usefulscripts/blob/master/script/install-wine-i686-centos7.sh It accepts a version no. as CLI parameter e.g. 2.0.3 The script installs wine in /usr/local/ directory by default. We can verify the files that are being copied for wine using "

How to add new nonCacheable resource by inheriting Tomcat's DefaultServlet

Do you have a web resource in your application which is dynamically generated/modified? And do you use JavaScript/Ajax (i.e. you do not have the resource mapped to a servlet in your application web.xml) to read that resource? If both answers are yes, then you may have seen that the request for the resource does not return the updated file always. The reason is DefaultServlet class of Tomcat which implements a caching technique for resources. If there is a HTTP request to access the resource before 5 sec of the last modification time, DefaultServlet will send the file from its cache (older content).


DefaultServlet is a servet provided by Tomcat distribution (and JBoss too). As the name suggests, it is the default choice. If your web application does not map a web resource to some servlet, DefaultServlet serves that resource. Only exception is JSP pages. Check out DefaultServlet Javadoc and source code. The servlet mapping is defined in Tomcat web.xml which is normally present at $CATALINA_HOME/conf/web.xml. In JBoss 5.1.0 GA, we find this at $JBoss_HOME/server/default/deployers/jbossweb.deployer/web.xml. I have shown the part of web.xml below-
The solution is simple. You need to extend the DefaultServlet and ProxyDirContext class of Tomcat and override the nonCacheable array. Below is the example code.


Override the ProxyDirContext class.


Now my web application structure looks like this-


Notice the xml directory which contains app.xml (assume this as dynamic resource). My JSP will load the app.xml using JavaScript (add the function as onload item). As the /xml/ URL pattern is added as nonCacheable, Tomcat will read the resource from file system (not from cache). So, we will always get the updated file content. Here is the script code -




Finally the web.xml for this app -






This approach suffers a performance hit. Do not use this technique for static files.

Comments