Menu Home

网络

Apache Virtual Host

OS: ubuntu 12.04 Apache: 2.2.22 Configure file: /etc/apache2/sites-available/default NameVirtualHost [IP Address] <VirtualHost [IP Address]> ServerName www.asite.com ServerAdmin [email protected] DocumentRoot /var/www/asite <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/asite> #Options Indexes FollowSymLinks MultiViews Options -Indexes AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory “/usr/lib/cgi-bin”> AllowOverride All […]

Android install HTTP Cache

// > Android 4.0, 向下兼容 private void enableHttpResponseCache() { try { long cacheSize = 10 * 1024 * 1024; File cacheDir = new File(getCacheDir(), “cache”); Class.forName(“android.net.http.HttpResponseCache”) .getMethod(“install”, File.class, long.class) .invoke(null, httpCacheDir, httpCacheSize); } catch (Exception httpResponseCacheNotAvailable) { } }

部署servlet

OS : ubuntu 12.04 Tomcat : tomcat7 进入Tomcat7默认安装目录为/var/lib/tomcat7 cd /var/lib/tomcat7 进入webapps,并在该目录下新建一个自己的项目名称 cd webapps mkdir streamserver #这里自己取的项目名为streamserver 进入streamserver,新建WEB-INF目录 cd streamserver mkdir WEB-INF 在WEB-INF目录中需要建立一些固定的目录和web.xml文件 cd WEB-INF mkdir classes #所有要用到的java类都要放到这里 touch web.xml 拷贝项目的类文件到classes目录 classes中的目录结构需要跟项目的目录结构一致,这里假设类名为net.lnmcc.streamserver.StreamServer cp -av projectpath/bin/net/lnmcc/streamserver/* /var/lib/tomcat7/webapps/streamserver/WEB-INF/classes/net/lnmcc/streamserver/ 编写web.xml文件 <?xml version=”1.0″ encoding=”utf-8″?> <web-app xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” version=”3.0″ metadata-complete=”true”> <display-name>Welcome to StreamServer</display-name> <description> […]