Apache mobilefilter 4-03
-
Upload
idel-fuschini -
Category
Technology
-
view
6.945 -
download
0
description
Transcript of Apache mobilefilter 4-03
Apache Mobile Filter Suite(V4.03)
byIdel Fuschini ([email protected])09/08/2013
Apache Mobile Filter
Intro to AMF
Every year more then 300 new devices
Device Fragmentation ProblemApacheMobile Filter
Each mobile device has many capabilities
screensize ?
imagetype ?
wifi ?
xhtml ?
screen resolution ?
navigation type ?
streaming type ?video streaming type ?
ajax ?
gif animated ?j2me ?os ?
gif animated ?
ApacheMobile Filter
The Goal
• Help people to detect easily any type of device
• have one solution for any platform (Unix, linux, OS X, Windows)
• give a simple solution for any programming language (PHP, Python, JSP, Ruby, Perl etc....)
• Manage Images easily
• High performane
ApacheMobile Filter
Who is using AMF
Under test....
What is the Apache Mobile Filter Project ?
“Idel Fuschini has created Apache Mobile Filter that allows you to access WURFL from any programming language, not just Java and php that is traditionally used for dynamic mobile web sites.
The module detects the mobile device and passes the WURFL capabilities on to the other web application as environment variables. It can also be used to resize images on the fly to adapt to the screen size of the mobile device.”
from http://mobilephonedevelopment.com/archives/854
ApacheMobile Filter
Why Apache ?for more 235,000,000 reasons
*from http://news.netcraft.com
Market Share for Top Servers Across All Domains August 1995 - July 2011
ApacheMobile Filter
Some info where download the software and doc
Official Site: http://www.idelfuschini.it/apache-mobile-filter-v2x.html
Demo Site for mobile:http://www.apachemobile.org
Demo Site for PC:http://www.apachemobile.org
Support: [email protected] Mobile Filter ticket system: http://amfticket.idelfuschini.it
Download Site:
http://sourceforge.net/projects/mobilefilter/
or
http://search.cpan.org/~ifuschini/
ApacheMobile Filter
The "Apache Mobile Filter" is one of the modules of "Apache Module Registry" portal.
http://modules.apache.org/search.php?id=1787
modules.apache.org
ApacheMobile Filter
Success HistoryApacheMobile Filter
http://mobile.telecomitalia.it
Success HistoryApacheMobile Filter
http://m.enter.co
Success History
http://m.oc2ps.com
ApacheMobile Filter
Success History
http://m.eltiempo.com
ApacheMobile Filter
Success History
Repair Shop Websites: The Leader in Internet Designfor the Automotive Repair Industry
“......Knowing how many phones are available for people to search and surf the web, we wanted to find a solution that would automatically optimize our sites no matter what mobile device was being used. We found the ultimate solution in the Apache Mobile Filter. .......”
Success History
http://m.portafolio.com.co
ApacheMobile Filter
Success History
http://m.vive.in
ApacheMobile Filter
Success History
http://mobile.finanze.it
ApacheMobile Filter
People says......
Silvian Leuthold:“After many years in mobile industry I can say that AMF is simply the most straightforward approach I've seen for solving common mobile internet challenges like device recognition, media delivery and mobile web design. Thanks a lot to Idel who was always available for support and consulting when needed. Great Job!. October 21, 2011”
Scott Pakin:Given the mess the mobile Web is in, with devices ignoring handheld-targeting stylesheets, lying about their screen resolution, and otherwise impeding the development of portable Web sites, Apache Mobile Filter really helps tame the complexity of delivering content that's suitably formatted for the target device. November 02, 2011
ApacheMobile Filter
People says......
Sergio David Acosta:“Gracias a Idel y a su grandioso producto, el Apache Mobile Filter, que nos permitió desarrollar los portales móviles de Casa Editorial El Tiempo. February 15, 2010”Kumaraswamy Nandipati:“I did a lot R&D for image rendering on the fly for one of my mobile website and finally it was ended up with Apache-mobile Filter. It was nice tool and easy to adopt. I simply Love it. I appreciate idle effort for this tool. Thanks for providing such a nice tool Idle Fu. -Kumaraswamy.N Project Lead, ecomZera LLC.” January 16, 2010Massimiliano Martinelli:Very useful project, "mobilize" a portal in a very easy and fast way! The AMF provides an all-in-one suite in order to manage contents for mobiles in the best way!Project Lead, Devoteam July, 2010
ApacheMobile Filter
AMF Architecture
Apache Mobile FilterSuite
Device Repository
Apache Standard Environment Apache Mobile Environment (Device Capability)
WebApplication(php,python, ruby, jsp, perl, asp etc. etc.)
Apache Webserver
mod_perl 2.0.X
Apache Web Server (http://apache.org)mod_perl2 (http://perl.apache.org)WURFL (http://wurfl.sourceforge.net)
ApacheMobile Filter
Installation requirement
• perl v5.8.8 or more (http://www.perl.org)
• apache webserver 2.x or more (http://httpd.apache.org)
• mod_perl 2.0.4 or more (http://perl.apache.org)
• memcached 1.4.4 or more (http://memcached.org)
mkdir foocd foowget http://downloads.sourceforge.net/project/mobilefilter/ApacheMobileFilter/x.xx/Apache2-WURFLFilter-x.xx.tar.gz?use_mirror=dfntar -xzvf Apache2-WURFLFilter-x.xx.tar.gzcd Apache2-WURFLFilter-x.xx/perl Makefile.PLmake installaptitude install libapache2-mod-perl2 libgd-gd2-perl libgd-toolsa2enmod perlcpan Apache2::AMFWURFLFilter Apache2::Filter Apache2::RequestRec Apache2::RequestUtil Apache2::Connection Apache2::SubRequest Apache2::Log CGI::Cookie APR::Table CGI::Cookie LWP::Simple Image::Resize Image::Scale IO::Uncompress::Unzip Cache::FileBackend Cache::Memcached
Download Apache Mobile Filter and follow this steps:
ApacheMobile Filter
The AMF Suite
Admin Tool
Apache Mobile Filter SuiteDevice Detection
Mobile Switcher
Image Rendering Engine
Carrier Detection
Mobile Caching System
ApacheMobile Filter
Mobile Trace
WebService
AMF<DeviceRepsitory>Filter(Device Detection Module)
AMFImageRendering
Apache Web Server
AMF environment
PHPWebApp
JSPWebApp(mod_jk)
RUBY/PythonWebApp
MobileSite
Version
ClassicSite
Version
TranscoderSite
Version
Http
Red
irect
(301
)
Http
Red
irect
(301
)
Http
Red
irect
(301
)
htdocs
Mobile Web Server Architecure
AMFSwitcherAMFCarrierDetection
AMFMobileCaching
ApacheMobile Filter
AMFWebService
Third-partyapplications
Advanced Cache System
• Two architecture of caching:
• The Apache Mobile Filter when it has identified a mobile device, stores the capabilities in a persistent cache (filesystem)
• The Apache Mobile Filter when it has identified a mobile device, stores the capabilities using memcached (http://memcached.org). Ideal solutions in cluster architectures.
ApacheMobile Filter
Device Detection
ApacheMobile Filter
Device Detection overviewAMF suite from 3.40a version supports several device repositories, each Device Repository has a dedicated module
• AMFLiteDetectionFilter: is suggested to use for solution that not need exaclty the type of device, but only if the device is amobile or not. Is nor require a Device Repository
• AMF51DegreesFilter*: this module use 51Degrees (http://51degrees.mobi) as device Repository
• AMFDetectRightFilter*: this module use DetectRight (http://www.detectright.com) as device Repository
• AMFWURFLFilter*: this module use DetectRight (http://www.scentiamobile.com) as device Repository
*this module has advanced cache system on filesystem or using memcached
ApacheMobile Filter
Device Detection Manager
EnvironmentManager
LiteIdentification(memory storage)
AMF Device Detection Module
AMFDetectLiteFilter(caching filesystem based)
ApacheMobile FilterDevice Detection
On LineUpdate
ConfigurationWurflFilter
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome server_root/MobileFilter
PerlTransHandler +Apache2::AMFLiteDetectionFilter
Remember:This module is suggested to use only to use with AMFSwitch module, is not so precise how to use a Device Repository
At startuo the module verify on apachemobilefilter.org if there are new parameter to get, ig you want to disable this option you can set:
PerlSetEnv AMFDownloadParamURL on true
In production is suggested to set the AMFProductionMode on true:
PerlSetEnv AMFProductionMode on true
ApacheMobile FilterDevice Detection
Device Detection Manager
CacheManager
DeviceRepository
(memory storage)
AMF Device Detection Module
EnvironmentManager
AMF<DeviceRepository>Filter(caching filesystem based)
FileSystemCache
ApacheMobile FilterDevice Detection
ConfigurationOpen the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome server_root/MobileFilterPerlSetEnv CacheDirectoryStore /tmp
PerlSetEnv CapabilityList xhtml_table_support, is_wireless_device, etc...... #default is all
PerlTransHandler +Apache2::AMF<DeviceRepository>Filter
Remember:before you start you must have the device repository fileif you want to update the device repositoryl file each time you stop and start the Apache, you must specify with this parameter:PerlSetEnv <device repository>NetDownload truePerlSetEnv Download<device repoisory>URL http://<url>/<device repository>.zip
In production is suggested to set the AMFProductionMode on true:
PerlSetEnv AMFProductionMode on true
ApacheMobile FilterDevice Detection
ConfigurationWurflFilter
If you need to add more capabilities or useragents that are not includes into the DeviceRepository add this papameter:
PerlSetEnv PersonalWurflFileName mydevicerepository.xml
The path is the AMF_Home. An example for your device repository file:
<wurfl_patch> <devices> <device user_agent="mickey mouse" fall_back="root" id="generic"> <group id="fb"> <capability name="mynewcapability" value="false"/> </group> </device> <device id="apple_iphone_ver4_3"> <group id="fb"> <capability name="mynewcapability" value="true"/> </group> </device> </devices></wurfl_patch>
ApacheMobile FilterDevice Detection
AMF with Memcachedthe advantage to use AMFWURFLFilterMemcached
This picture and the text are from http://memcached.org and can explain the advantage of this architecture:
“memcached allows you to take memory from parts of your system where you have more than you need and make it accessible to areas where you have less than you need.
memcached also allows you to make better use of your memory. If you consider the diagram to the right, you can see two deployment scenarios:
! 1.! Each node is completely independent (top).! 2.! Each node can make use of memory from other nodes (bottom).The first scenario illustrates the classic deployment strategy, however you'll find that it's both wasteful in the sense that the total cache size is a fraction of the actual capacity of your web farm, but also in the amount of effort required to keep the cache consistent across all of those nodes.
With memcached, you can see that all of the servers are looking into the same virtual pool of memory. This means that a given item is always stored and always retrieved from the same location in your entire web cluster.
Also, as the demand for your application grows to the point where you need to have more servers, it generally also grows in terms of the data that must be regularly accessed. A deployment strategy where these two aspects of your system scale together just makes sense.
The illustration to the right only shows two web servers for simplicity, but the property remains the same as the number increases. If you had fifty web servers, you'd still have a usable cache size of 64MB in the first example, but in the second, you'd have 3.2GB of usable cache.
Of course, you aren't required to use your web server's memory for cache. Many memcached users have dedicated machines that are built to only be memcached servers.”*
*from http://memcached.org/about
ApacheMobile FilterDevice Detection
Apache WebServer
Apache Mobile FilterMemcached cluster architecture
Memcached*
*http://memcached.org/
Apache Mobile Filter
Apache WebServerApache Mobile Filter
Apache WebServerApache Mobile Filter
ApacheMobile FilterDevice Detection
AMFWURFLFilterMemcached
Device Detection Manager
AMFWURFFilterMemcahed
EnvironmentManager Memcached*Cache
Manager
Device DetectionApacheMobile Filter
DeviceRepository
(memory storage)
Configuration Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome server_root/MobileFilterPerlSetEnv ServerMemCached 10.0.0.15:11211,10.0.0.16:11211,/var/sock/memcahed
PerlSetEnv CapabilityList xhtml_table_support, is_wireless_device, etc...... #default is all
PerlTransHandler +Apache2::AMF<DeviceRepository>FilterMemcached
Remember:before you start you must have the device repository fileif you want to update the device repository file each time you stop and start the Apache, you must specify with this parameter:PerlSetEnv <device repository>NetDownload truePerlSetEnv Download<device repoisory>URL http://<url>/<device repository>.zip
If you want to detect the not mobile browser you must need to load the web_browser_patch.xml so set this parameter to true:PerlSetEnv LoadWebPatch trueIf you want to download directly from internet (it’s very slow):PerlSetEnv PatchWurflNetDownload truePerlSetEnv PatchWurflUrl http://wurfl.sourceforge.net/web_browsers_patch.xml
In production is suggested to set the AMFProductionMode on true: PerlSetEnv AMFProductionMode true
Device DetectionApacheMobile Filter
Mobile Caching System
ApacheMobile Filter
Mobile Caching System (beta version)(for cluster architecture using memcached)
AMFMobileCachingMemcached
memcachedserver
AMFMobileCachingMemcached cache the different layout, of the same URL, for each type of devices that have done the requests.The timeout caching is configurable.
Mobile Cache SystemApacheMobile Filter
Configuration Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome /server_root/MobileFilterPerlSetEnv ServerMemCached 10.0.0.15:11211,10.0.0.16:11211,/var/sock/memcahed
CapabilityList xhtml_table_support, is_wireless_device, etc...... #default is all
PerlTransHandler +Apache2::AMFWURFLFilterMemcached
<Directory /portal/*> SetHandler modperl PerlOutputFilterHandler Apache2::AMFMobileCacheMemcached Allow from all</Directory>
ApacheMobile FilterMobile Cache System
Image Rendering Engine
ApacheMobile Filter
Image Render
AMFImageRendering
Original ImagesDirectory
Cached ImagesDirectory
Image Rendering Filter
Image Rendering EngineApacheMobile Filter
ConfigurationThe AMFImageRendering is working only if is active the WURFLFilter.
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome /server_root/MobileFilter
PerlSetEnv ResizeImageDirectory /tmp/cached
PerlModule Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFWURFLFilter
<Location /mobile/*> SetHandler modperl PerlOutputFilterHandler Apache2::AMFImageRendering </Location>
This is indicate to the filter were are stored the high definition images
This indicate to the filter where put the transformated images (cache directory) this directory must be writeable
/mobile /transform(cache directory)
Browser Image Request
ImageRenderFilter Response
or AMFWURFLFilterMemcached
ApacheMobile FilterImage Render Engine
Image Render FilterHTML Syntax
<img src=”/mobile/image.png”>
<img src=”/mobile/image.png?dim=50”>
<img src=”/mobile/image.png?width=80”>The width of the image is 80px
The image is scaled to the 50% of the width mobile device
The image is scaled to the size of the mobile device
ApacheMobile FilterImage Render Engine
For change the name of parameter “width” and “dim” in httpd.conf must be setted:PerlSetEnv ImageParamWidth <new name of param>PerlSetEnv ImageParamPerc <new name of param>
By default the images that have a width less than device screen size are not resized, if you want to force it:
PerlSetEnv ResizeSmallImage true
image1 image2
image3
logo
image5image4
(max_image_width)
<img src=”/mobile/logo.png”>
<img src=”/mobile/image1.png?&dim=50”><img src=”/mobile/image2.png?&dim=50”>
<img src=”/mobile/image5.png?dim=50”>
<img src=”/mobile/image4.png?&dim=33”>
<img src=”/mobile/image3.png?&dim=33”>
Image Render FilterApacheMobile Filter
Image Render Engine
Mobile Switcher
ApacheMobile Filter
AMFSwitcher
AMFSwitcherSwitcher Manager
Mobile SwitcherApacheMobile Filter
You can use the filter to redirect to other part if it came from:
web browsermobile browsertranscoder
Open the file httpd.conf of your webserver. And configure this few parameters*:
PerlSetEnv FullBrowserUrl http://www.fullbrowsersite.com
PerlSetEnv MobileVersionUrl http://www.mobilesite.com
PerlSetEnv RedirectTranscoderUrl http://www.transcodersite.com**
PerlSetEnv AMFMobileHome server_root/MobileFilter
PerlModule Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFSwitcher
ConfigurationConfigure AMFSwitcher
1) http://m.site.com
2) http://www.site.com
3) http://www.transcoder.com
*FullBrowserUrl, MobileVersionUrl, RedirectTranscoder are optional, but minumum one of them must be set**if the parameter “RedirectTranscoder” is omitted the transcoders are considered as mobile devices.
ApacheMobile Filter Mobile Switcher
You can use the filter to redirect to other part if it came from:
web browsermobile browsertranscoder
Open the file httpd.conf of your webserver. And configure this few parameters*:
PerlSetEnv FullBrowserUrl /web_dedicated_site
PerlSetEnv MobileVersion /mobile_dedicated_site
PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site
PerlSetEnv AMFMobileHome server_root/MobileFilter
PerlTransHandler +Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFSwitcher
ConfigurationAMFSwitcher (redirect in the same site)
*FullBrowserUrl, MobileVersionUrl, RedirectTranscoder are optional, but minumum one of them must be set
If for example you change the FullBrowserUrl parameter with value “/”, you defined that FullBrowser devices can access to all site.
ApacheMobile Filter Mobile Switcher
Open the file httpd.conf of your webserver. And configure this few parameters*:
PerlSetEnv AMFMobileHome server_root/MobileFilterPerlSetEnv FullBrowserUrl /web
PerlSetEnv MobileVersion /mobilePerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site
PerlSetEnv WildCardRedirect true
PerlTransHandler +Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFSwitcher
ConfigurationAMFSwitcher (redirect in the same site)
*FullBrowserUrl, MobileVersionUrl, RedirectTranscoder are optional, but minumum one of them must be set
ApacheMobile Filter Mobile Switcher
http://www.site.org/mobile/hello.html?go=12 http://www.site.org/web/hello.html?go=12Redirect for pc browser
Redirect for mobile browser
Open the file httpd.conf of your webserver. And configure this few parameters*:
PerlSetEnv AMFMobileHome server_root/MobileFilterPerlSetEnv FullBrowserUrl /web_dedicated_site
PerlSetEnv MobileVersion /mobile_dedicated_site
PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site
PerlSetEnv WildCardRedirect true #or false
PerlSetEnv AMFSwitcherExclude /images/,php_test.php
PerlTransHandler +Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFSwitcher
ConfigurationAMFSwitcher (redirect in the same site)
*FullBrowserUrl, MobileVersionUrl, RedirectTranscoder are optional, but minumum one of them must be set
ApacheMobile Filter Mobile Switcher
Exclude the switcher from some path or file for example:
/images/ or php_test.php the images is not catched by AMFSwitcher
Open the file httpd.conf of your webserver. And configure this few parameters*:
PerlSetEnv AMFMobileHome server_root/MobileFilterPerlSetEnv FullBrowserUrl /web
PerlSetEnv MobileVersion /mobilePerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site
PerlSetEnv FullBrowserMobileAccessKey fullbrowser #the value you can change
PerlTransHandler +Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFSwitcher
ConfigurationAMFSwitcher (redirect in the same site)
*FullBrowserUrl, MobileVersionUrl, RedirectTranscoder are optional, but minumum one of them must be set
ApacheMobile Filter Mobile Switcher
This configuration permits to a mobile device to access on Desktop version of the site. For example in mobile site version you can put this link:
<a href=”/?fullbrowser”>Desktop Version</a>
Open the file httpd.conf of your webserver. And configure this few parameters*:
PerlSetEnv AMFMobileHome server_root/MobileFilterPerlSetEnv FullBrowserUrl /web
PerlSetEnv MobileVersion /mobilePerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site PerlSetEnv ForceTabletAsFullBrowser true
PerlTransHandler +Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFSwitcher
ConfigurationAMFSwitcher (redirect in the same site)
*FullBrowserUrl, MobileVersionUrl, RedirectTranscoder are optional, but minumum one of them must be set
ApacheMobile Filter Mobile Switcher
This configuration permits to a tablet device to access on Desktop version of the site.
Carrier Detection
ApacheMobile Filter
Carrier Detection
Carrier Detection Manager
Carrier IP Repository
(memory storage)
AMFCarrierDetection
EnvironmentManager
Carrier DetectionApacheMobile Filter
ConfigurationCarrier Detection
PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv CarrierNetDownload true #optional#
PerlSetEnv CarrierUrl http://www.andymoore.info/carrier-data.txtPerlTransHandler +Apache2::AMFCarrierDetection
Open the file httpd.conf of your webserver. And configure this few parameter:
The scope of this module is to identify the Carrier and its nation, and put it as environment variables called:
AMF_CARRIER_NAMEAMF_CARRIER_NATION
ApacheMobile Filter Carrier Detection
Mobile Trace
ApacheMobile Filter
The AMFTrace is working only if is active the WURFLFilter.
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome /server_root/MobileFilter
PerlSetEnv AMFTraceDebug false
PerlModule Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFWURFLFilter
PerlTransHandler +Apache2::AMFTrace
Mobile Trace
The goal of this this configuration is to trace (on error_log file) the UserAgent no detected by AMF
Mobile Trace
or AMFWURFLFilterMemcached
ApacheMobile Filter
Mobile Trace
The goal of this this configuration is to trace the wurfl capabities on error_log file, is useful for statistic scope or debug your applications.
Mobile Trace
The AMFTrace is working only if is active the WURFLFilter.
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome /server_root/MobileFilter
PerlSetEnv AMFTraceDebug truePerlSetEnv AMFTraceCapability id,brand_name
PerlModule Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFWURFLFilter
PerlTransHandler +Apache2::AMFTrace
or AMFWURFLFilterMemcached
[Mon Mar 22 10:45:42 2010] [warn] [client ::1] AMFTrace - id=mozilla_ver5|brand_name=generic web browser| User_Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; it-it) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7
Example of error_log output:
ApacheMobile Filter
Web Service
ApacheMobile Filter
WebService
The goal of this this configuration is to give another way to give capabilities as xml or json.
WebService
The AMFWebService is working only if is active the WURFLFilter.
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome /server_root/MobileFilter
PerlSetEnv RestMode true
PerlModule Apache2::AMFWURFLFilterPerlTransHandler +Apache2::AMFWURFLFilter
<Location /WS/*> SetHandler modperl PerlResponseHandler Apache2::AMFWebService Allow from all</Location>
or AMFWURFLFilterMemcached
ApacheMobile Filter
only from V3.30 before wasPerlOutputFilterHandler
WebServiceWebService
To have the wurfl capabilities as xml of some device you need to do this get:
GET http://<host>:<port>/WS/?<type=xml>&amf=<user_agent>
To have the wurfl capabilities as json of some device you need to do this get:
GET http://<host>:<port>/WS/?type=json&amf=<user_agent>
To have some capability you can add the capabilityListExample:
GET http://<host>:<port>/WS/?type=json&amf=<user_agent>&capabilityList=<capabiliy 1,capability 2, etc>
ApacheMobile Filter
If you use proxy to access to the AMFwebservice, is suggested to use AMFWSCacheControl. With this paramerer all proxy cache in middle don’t send many request to webservice. The syntax is:
PerlSetEnv AMFWSCacheControl max-age=2592000
Admin Tool
ApacheMobile Filter
Device MonitorDevices Detected
Devices not Detected
Devices Capabilities
Home Page
PerlSetEnv CacheDirectoryStore /tmp<Location /admin/*> PerlOutputFilterHandler Apache2::AMFDeviceMonitor</Location>
Configuration:
Carrier DetectionApacheMobile Filter
How can I retrieve the values of the capabilities of wurfl?
Retrieve the WURFL capabilities value is very simple all the information are setting into the Apache Environment AMF_<uppercase wurfl capabilities name> for example:
To read the WURFL capabilities max_image_height you must read the environment value AMF_MAX_IMAGE_HEIGHT.
How to read environment in PHP ?
The php code is:
$_SERVER['AMF_MAX_IMAGE_HEIGHT'];
a test page in php is downloadable:
http://mobilefilter.cvs.sourceforge.net/viewvc/mobilefilter/ApacheMobileFilter/test_page/php/php_test.php?view=markup
How to read the value in JSP (for Tomcat)?
Before in the httpd.conf file where you have configure mod_jk you muse add this:
JkEnvVar AMF_MAX_IMAGE_HEIGHT undefined
The Java code is:
request.getAttribute("AMF_MAX_IMAGE_HEIGHT")
How to read the value in PERL?
print $ENV('AMF_MAX_IMAGE_HEIGHT');
ApacheMobile Filter
AMF and mod_rewriteNow AMF is usable with mod_rewrite (http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html). The mod_rewrite can read the environment variables that AMF passes.The most important are:
AMF_DEVICE_IS_MOBILE, AMF_IS_TABLET
Here some example how to use it:
All mobile devices are redirect
In this example you can redirect only the mobile devices to the mobile site:
#Configuration AMF Filter#PerlSetEnv AMFMobileHome /usr/local/AMFPerlSetEnv AMFProductionMode truePerlSetEnv ServerMemCached localhost:11211
PerlTransHandler +Apache2::AMF<your favorite module>Filter# or PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcachedRewriteEngine onRewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^trueRewriteRule ^(.*)$ http://m.foo.org [R=301,L]
AMF<your favorite module>FilterMemcached is for AMFDetectRightFilter, AMF51DegreesFilter, AMFWURFLFilter and AMFLiteDetectionFilter
ApacheMobile Filter
AMF and mod_rewriteAll mobile devices are redirect except tablet
In this other example you permit to tablet to access the desktop version:
#Configuration AMF Filter#PerlSetEnv AMFMobileHome /usr/local/AMFPerlSetEnv AMFProductionMode truePerlSetEnv ServerMemCached localhost:11211
PerlTransHandler +Apache2::AMF<your favorite module>Filter# or PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached
RewriteEngine onRewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^trueRewriteCond %{ENV:AMF_DEVICE_IS_TABLET} !^trueRewriteRule ^(.*)$ http://m.foo.org [R=301,L]
AMF<your favorite module>FilterMemcached is for AMFDetectRightFilter, AMF51DegreesFilter, AMFWURFLFilter and AMFLiteDetectionFilter
ApacheMobile Filter
AMF and mod_rewrite Permit mobile devices to access to desktop
Sometime it’s possible to be able to mobile device to access on PC site, with AMF is simple you need to define the FullBrowserMobileAccessKey like:
PerlSetEnv FullBrowserMobileAccessKey fullbrowser #the value you can change
and in your mobile page write this link:
<a href=”/?fullbrowser=true”>Desktop Version</a>
In httpd.conf the conditions are:
#Configuration AMF Filter#PerlSetEnv AMFMobileHome /usr/local/AMFPerlSetEnv AMFProductionMode truePerlSetEnv ServerMemCached localhost:11211PerlTransHandler +Apache2::AMF<your favorite module>Filter# or PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached
RewriteEngine onRewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^trueRewriteCond %{ENV:AMF_DEVICE_IS_TABLET} !^trueRewriteCond %{ENV:AMF_FORCE_TO_DESKTOP} !^trueRewriteRule ^(.*)$ http://m.foo.org [R=301,L]
AMF<your favorite module>FilterMemcached is for AMFDetectRightFilter, AMF51DegreesFilter, AMFWURFLFilter and AMFLiteDetectionFilter
ApacheMobile Filter
Example code in PHP<?php if ($_SERVER[AMF_XHTML_SUPPORT_LEVEL] != "-1") { ?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Apache Mobile Test</title><style type="text/css">
body { background-color: #FFFFFF; font-family: arial, helvetica, sans-serif; font-size: small; font-color: #000000 }</style><meta name = "viewport" content = "width = device-width"> </head> <body>Welcome to the Apache Mobile Test Page<br/><img src="/mobile/header.png" /><br/>Device data:<br/>ID: <b><?php echo $_SERVER['AMF_ID'] ?></b><br/><?php echo $tag ?>Brand name: <b><?php echo $_SERVER['AMF_BRAND_NAME'] ?></b><br/><?php echo $tag ?>Model name: <b><?php echo $_SERVER['AMF_MODEL_NAME'] ?></b><br/><?php echo $tag ?>Max Resolution:<b><?php echo $_SERVER['AMF_RESOLUTION_WIDTH'] ?> x <?php echo $_SERVER['AMF_RESOLUTION_HEIGHT'] ?></b><br/><?php echo $tag ?>Supp. J2ME MIDP 2.0:<b><?php echo $_SERVER['AMF_J2ME_MIDP_2_0'] ?></b><br/><?php echo $tag ?></body></html><?php} else {header("Content-type: text/vnd.wap.wml");print "<?xml version=\"1.0\"?>\n"; ?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml> <card id="card1" title="Apache Mobile Test"> <p>Device data:</p><p>Brand name: <?php echo $_SERVER['AMF_BRAND_NAME'] ?></p><p>Model name: <?php echo $_SERVER['AMF_MODEL_NAME'] ?></p><p>Max Resolution Height is <?php echo $_SERVER['AMF_RESOLUTION_HEIGHT'] ?></p><p>Max Resolution Width is <?php echo $_SERVER['AMF_RESOLUTION_WIDTH'] ?></p> </card></wml><?php} ?>
XHTML Version
WML Version
check if the device supporto XHTML
image rendering
ApacheMobile Filter
AMF Test tool
Who talks about “Apache Mobile Filter”
• “Gestire i dispositivi mobili con Apache Mobile Filter” (http://www.html.it/articoli/gestire-i-dispositivi-mobili-con-apache-mobile-filter/)
• “The Case of Open Source Development, a Personal Case Study” (http://robertogaloppini.net/2009/01/20/the-case-for-open-source-development-a-personal-case-study/)
• “Apache Mobile Filter” (http://mobilephonedevelopment.com/archives/854)
• “Un progetto italiano per l’identificazione dei dispositivi mobili” (http://www.blographik.it/2009/06/24/un-progetto-italiano-per-lidentificazione-dei-dispositivi-mobili/)
• “Apache Mobile Filter” (http://www.open4dev.com/journal/2009/6/29/apache-mobile-filter.html)
ApacheMobile Filter
Who wrote about “Apache Mobile Filter”ApacheMobile Filter
References• http://wurfl.sourceforge.net
• http://perl.apache.org
• http://modules.apache.org
• http://cpan.org
• http://memcached.org
• http://www.w3.org/TR/ct-guidelines/
• http://www.andymoore.info/wap-ip-to-carrier-detection/
ApacheMobile Filter
THE ENDApache Mobile Filter