SlideShare a Scribd company logo
1 of 74
Download to read offline
Apache Mobile Filter Suite
(V4.03)
by
Idel Fuschini (idel.fuschini@gmail.com)
09/08/2013
Apache Mobile Filter
Intro to AMF
Every year more then 300 new devices
Device Fragmentation Problem
ApacheMobile 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: support@idelfuschini.it
Apache 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 History
ApacheMobile Filter
http://mobile.telecomitalia.it
Success History
ApacheMobile 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 Design
for 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, 2010
Massimiliano 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 Filter
Suite
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 foo
cd foo
wget http://downloads.sourceforge.net/project/mobilefilter/ApacheMobileFilter/x.xx/Apache2-WURFLFilter-x.xx.tar.gz?use_mirror=dfn
tar -xzvf Apache2-WURFLFilter-x.xx.tar.gz
cd Apache2-WURFLFilter-x.xx/
perl Makefile.PL
make install
aptitude install libapache2-mod-perl2 libgd-gd2-perl libgd-tools
a2enmod perl
cpan 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 Suite
Device Detection
Mobile Switcher
Image Rendering Engine
Carrier Detection
Mobile Caching System
ApacheMobile Filter
Mobile Trace
WebService
AMF<DeviceRepsitory>Filter
(Device Detection Module)
AMFImage
Rendering
Apache Web Server
AMF environment
PHP
WebApp
JSP
WebApp
(mod_jk)
RUBY/Python
WebApp
Mobile
Site
Version
Classic
Site
Version
Transcoder
Site
Version
HttpRedirect(301)
HttpRedirect(301)
HttpRedirect(301)
htdocs
Mobile Web Server Architecure
AMFSwitcher
AMFCarrierDetection
AMFMobileCaching
ApacheMobile Filter
AMFWebService
Third-party
applications
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 overview
AMF 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
Environment
Manager
LiteIdentification
(memory storage)
AMF Device Detection Module
AMFDetectLiteFilter
(caching filesystem based)
ApacheMobile Filter
Device Detection
On Line
Update
Configuration
WurflFilter
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 Filter
Device Detection
Device Detection Manager
Cache
Manager
Device
Repository
(memory storage)
AMF Device Detection Module
Environment
Manager
AMF<DeviceRepository>Filter
(caching filesystem based)
FileSystem
Cache
ApacheMobile Filter
Device Detection
Configuration
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome server_root/MobileFilter
PerlSetEnv 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 file
if 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 true
PerlSetEnv Download<device repoisory>URL http://<url>/<device repository>.zip
In production is suggested to set the AMFProductionMode on true:
PerlSetEnv AMFProductionMode on true
ApacheMobile Filter
Device Detection
Configuration
WurflFilter
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 Filter
Device Detection
AMF with Memcached
the 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 Filter
Device Detection
Apache WebServer
Apache Mobile Filter
Memcached cluster architecture
Memcached*
*http://memcached.org/
Apache Mobile Filter
Apache WebServer
Apache Mobile Filter
Apache WebServer
Apache Mobile Filter
ApacheMobile Filter
Device Detection
AMFWURFLFilterMemcached
Device Detection Manager
AMFWURFFilterMemcahed
Environment
Manager
Memcached*
Cache
Manager
Device DetectionApacheMobile Filter
Device
Repository
(memory storage)
Configuration
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome server_root/MobileFilter
PerlSetEnv 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 file
if 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 true
PerlSetEnv 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 true
If you want to download directly from internet (it’s very slow):
PerlSetEnv PatchWurflNetDownload true
PerlSetEnv 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
memcached
server
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 System
ApacheMobile Filter
Configuration
Open the file httpd.conf of your webserver. And configure this few parameter:
PerlSetEnv AMFMobileHome /server_root/MobileFilter
PerlSetEnv 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 Filter
Mobile Cache System
Image Rendering Engine
ApacheMobile Filter
Image Render
AMFImageRendering
Original Images
Directory
Cached Images
Directory
Image Rendering Filter
Image Rendering EngineApacheMobile Filter
Configuration
The 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::AMFWURFLFilter
PerlTransHandler +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 Filter
Image Render Engine
Image Render Filter
HTML 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 Filter
Image 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 Filter
ApacheMobile Filter
Image Render Engine
Mobile Switcher
ApacheMobile Filter
AMFSwitcher
AMFSwitcher
Switcher Manager
Mobile SwitcherApacheMobile Filter
You can use the filter to redirect to other part if it came from:
web browser
mobile browser
transcoder
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::AMFWURFLFilter
PerlTransHandler +Apache2::AMFWURFLFilter
PerlTransHandler +Apache2::AMFSwitcher
Configuration
Configure 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 browser
mobile browser
transcoder
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::AMFWURFLFilter
PerlTransHandler +Apache2::AMFSwitcher
Configuration
AMFSwitcher (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/MobileFilter
PerlSetEnv FullBrowserUrl /web
PerlSetEnv MobileVersion /mobile
PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site
PerlSetEnv WildCardRedirect true
PerlTransHandler +Apache2::AMFWURFLFilter
PerlTransHandler +Apache2::AMFSwitcher
Configuration
AMFSwitcher (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=12
Redirect for pc browser
Redirect for mobile browser
Open the file httpd.conf of your webserver. And configure this few parameters*:
PerlSetEnv AMFMobileHome server_root/MobileFilter
PerlSetEnv 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::AMFWURFLFilter
PerlTransHandler +Apache2::AMFSwitcher
Configuration
AMFSwitcher (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/MobileFilter
PerlSetEnv FullBrowserUrl /web
PerlSetEnv MobileVersion /mobile
PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site
PerlSetEnv FullBrowserMobileAccessKey fullbrowser #the value you can change
PerlTransHandler +Apache2::AMFWURFLFilter
PerlTransHandler +Apache2::AMFSwitcher
Configuration
AMFSwitcher (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/MobileFilter
PerlSetEnv FullBrowserUrl /web
PerlSetEnv MobileVersion /mobile
PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site
PerlSetEnv ForceTabletAsFullBrowser true
PerlTransHandler +Apache2::AMFWURFLFilter
PerlTransHandler +Apache2::AMFSwitcher
Configuration
AMFSwitcher (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
Environment
Manager
Carrier DetectionApacheMobile Filter
Configuration
Carrier Detection
PerlSetEnv AMFMobileHome server_root/MobileFilter
PerlSetEnv CarrierNetDownload true #optional#
PerlSetEnv CarrierUrl http://www.andymoore.info/carrier-data.txt
PerlTransHandler +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_NAME
AMF_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::AMFWURFLFilter
PerlTransHandler +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 true
PerlSetEnv AMFTraceCapability id,brand_name
PerlModule Apache2::AMFWURFLFilter
PerlTransHandler +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::AMFWURFLFilter
PerlTransHandler +Apache2::AMFWURFLFilter
<Location /WS/*>
SetHandler modperl
PerlResponseHandler Apache2::AMFWebService
Allow from all
</Location>
or AMFWURFLFilterMemcached
ApacheMobile Filter
only from V3.30 before was
PerlOutputFilterHandler
WebService
WebService
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 Monitor
Devices 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_rewrite
Now 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/AMF
PerlSetEnv AMFProductionMode true
PerlSetEnv ServerMemCached localhost:11211
PerlTransHandler +Apache2::AMF<your favorite module>Filter
# or
PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached
RewriteEngine on
RewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^true
RewriteRule ^(.*)$ 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
All 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/AMF
PerlSetEnv AMFProductionMode true
PerlSetEnv ServerMemCached localhost:11211
PerlTransHandler +Apache2::AMF<your favorite module>Filter
# or
PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached
RewriteEngine on
RewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^true
RewriteCond %{ENV:AMF_DEVICE_IS_TABLET} !^true
RewriteRule ^(.*)$ 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/AMF
PerlSetEnv AMFProductionMode true
PerlSetEnv ServerMemCached localhost:11211
PerlTransHandler +Apache2::AMF<your favorite module>Filter
# or
PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached
RewriteEngine on
RewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^true
RewriteCond %{ENV:AMF_DEVICE_IS_TABLET} !^true
RewriteCond %{ENV:AMF_FORCE_TO_DESKTOP} !^true
RewriteRule ^(.*)$ 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 END
Apache Mobile Filter

More Related Content

What's hot

MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)Loiane Groner
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programmingKuntal Bhowmick
 
Titanium - Making the most of your single thread
Titanium - Making the most of your single threadTitanium - Making the most of your single thread
Titanium - Making the most of your single threadRonald Treur
 
Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Alessio Ricco
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentEngin Hatay
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBrian Sam-Bodden
 
Java applet - java
Java applet - javaJava applet - java
Java applet - javaRubaya Mim
 
Chrome Devtools Protocol via Selenium/Appium (English)
Chrome Devtools Protocol via Selenium/Appium (English)Chrome Devtools Protocol via Selenium/Appium (English)
Chrome Devtools Protocol via Selenium/Appium (English)Kazuaki Matsuo
 

What's hot (9)

MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)MobileConf 2015: Desmistificando o Phonegap (Cordova)
MobileConf 2015: Desmistificando o Phonegap (Cordova)
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
Titanium - Making the most of your single thread
Titanium - Making the most of your single threadTitanium - Making the most of your single thread
Titanium - Making the most of your single thread
 
Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator Best Practices in apps development with Titanium Appcelerator
Best Practices in apps development with Titanium Appcelerator
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
Baruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion WorkshopBaruco 2014 - Rubymotion Workshop
Baruco 2014 - Rubymotion Workshop
 
Applet
AppletApplet
Applet
 
Java applet - java
Java applet - javaJava applet - java
Java applet - java
 
Chrome Devtools Protocol via Selenium/Appium (English)
Chrome Devtools Protocol via Selenium/Appium (English)Chrome Devtools Protocol via Selenium/Appium (English)
Chrome Devtools Protocol via Selenium/Appium (English)
 

Similar to Apache Mobile Filter Suite Streamlines Mobile Device Detection

Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaChristian Heilmann
 
PHP in a mobile ecosystem
PHP in a mobile ecosystem PHP in a mobile ecosystem
PHP in a mobile ecosystem Ivo Jansch
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefoxNAVER D2
 
Multi Site Manager (25 Jan).pptx
Multi Site Manager (25 Jan).pptxMulti Site Manager (25 Jan).pptx
Multi Site Manager (25 Jan).pptxshivani garg
 
20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache MavenArnaud Héritier
 
Make the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open SourceMake the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open SourcePerfecto by Perforce
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS StudioCreate Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS StudioGuilhem Ensuque
 
Modular Architectures using Micro Services
Modular Architectures using Micro ServicesModular Architectures using Micro Services
Modular Architectures using Micro ServicesMarcel Offermans
 
What's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkWhat's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkSam Basu
 
Legacy Lowdown - Options When Migrating Solaris Applications
Legacy Lowdown - Options When Migrating Solaris ApplicationsLegacy Lowdown - Options When Migrating Solaris Applications
Legacy Lowdown - Options When Migrating Solaris ApplicationsAppZero
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment pptsagaroceanic11
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment pptsagaroceanic11
 
The Nightmare Fuzzing Suite and Blind Code Coverage Fuzzer
The Nightmare Fuzzing Suite and Blind Code Coverage FuzzerThe Nightmare Fuzzing Suite and Blind Code Coverage Fuzzer
The Nightmare Fuzzing Suite and Blind Code Coverage FuzzerJoxean Koret
 
100 Security Operation Center Tools.pdf
100 Security Operation Center Tools.pdf100 Security Operation Center Tools.pdf
100 Security Operation Center Tools.pdfMAHESHUMANATHGOPALAK
 

Similar to Apache Mobile Filter Suite Streamlines Mobile Device Detection (20)

Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
PHP in a mobile ecosystem
PHP in a mobile ecosystem PHP in a mobile ecosystem
PHP in a mobile ecosystem
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
 
Appium solution
Appium solutionAppium solution
Appium solution
 
Multi Site Manager (25 Jan).pptx
Multi Site Manager (25 Jan).pptxMulti Site Manager (25 Jan).pptx
Multi Site Manager (25 Jan).pptx
 
DDive- Giuseppe Grasso - mobile su Lotus
DDive- Giuseppe Grasso - mobile su LotusDDive- Giuseppe Grasso - mobile su Lotus
DDive- Giuseppe Grasso - mobile su Lotus
 
20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven
 
Make the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open SourceMake the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open Source
 
Lamp Zend Security
Lamp Zend SecurityLamp Zend Security
Lamp Zend Security
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS StudioCreate Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
 
Modular Architectures using Micro Services
Modular Architectures using Micro ServicesModular Architectures using Micro Services
Modular Architectures using Micro Services
 
Mobile testing
Mobile testingMobile testing
Mobile testing
 
What's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkWhat's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon Talk
 
Legacy Lowdown - Options When Migrating Solaris Applications
Legacy Lowdown - Options When Migrating Solaris ApplicationsLegacy Lowdown - Options When Migrating Solaris Applications
Legacy Lowdown - Options When Migrating Solaris Applications
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
 
The Nightmare Fuzzing Suite and Blind Code Coverage Fuzzer
The Nightmare Fuzzing Suite and Blind Code Coverage FuzzerThe Nightmare Fuzzing Suite and Blind Code Coverage Fuzzer
The Nightmare Fuzzing Suite and Blind Code Coverage Fuzzer
 
100 Security Operation Center Tools.pdf
100 Security Operation Center Tools.pdf100 Security Operation Center Tools.pdf
100 Security Operation Center Tools.pdf
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Apache Mobile Filter Suite Streamlines Mobile Device Detection

  • 1. Apache Mobile Filter Suite (V4.03) by Idel Fuschini (idel.fuschini@gmail.com) 09/08/2013 Apache Mobile Filter
  • 3. Every year more then 300 new devices Device Fragmentation Problem ApacheMobile Filter
  • 4. 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
  • 5. 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
  • 6. Who is using AMF Under test....
  • 7. 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
  • 8. 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
  • 9. 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: support@idelfuschini.it Apache Mobile Filter ticket system: http://amfticket.idelfuschini.it Download Site: http://sourceforge.net/projects/mobilefilter/ or http://search.cpan.org/~ifuschini/ ApacheMobile Filter
  • 10. 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
  • 15. Success History Repair Shop Websites: The Leader in Internet Design for 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. .......”
  • 19. 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
  • 20. 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, 2010 Massimiliano 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
  • 21. AMF Architecture Apache Mobile Filter Suite 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
  • 22. 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 foo cd foo wget http://downloads.sourceforge.net/project/mobilefilter/ApacheMobileFilter/x.xx/Apache2-WURFLFilter-x.xx.tar.gz?use_mirror=dfn tar -xzvf Apache2-WURFLFilter-x.xx.tar.gz cd Apache2-WURFLFilter-x.xx/ perl Makefile.PL make install aptitude install libapache2-mod-perl2 libgd-gd2-perl libgd-tools a2enmod perl cpan 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
  • 24. Admin Tool Apache Mobile Filter Suite Device Detection Mobile Switcher Image Rendering Engine Carrier Detection Mobile Caching System ApacheMobile Filter Mobile Trace WebService
  • 25. AMF<DeviceRepsitory>Filter (Device Detection Module) AMFImage Rendering Apache Web Server AMF environment PHP WebApp JSP WebApp (mod_jk) RUBY/Python WebApp Mobile Site Version Classic Site Version Transcoder Site Version HttpRedirect(301) HttpRedirect(301) HttpRedirect(301) htdocs Mobile Web Server Architecure AMFSwitcher AMFCarrierDetection AMFMobileCaching ApacheMobile Filter AMFWebService Third-party applications
  • 26. 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
  • 28. Device Detection overview AMF 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
  • 29. Device Detection Manager Environment Manager LiteIdentification (memory storage) AMF Device Detection Module AMFDetectLiteFilter (caching filesystem based) ApacheMobile Filter Device Detection On Line Update
  • 30. Configuration WurflFilter 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 Filter Device Detection
  • 31. Device Detection Manager Cache Manager Device Repository (memory storage) AMF Device Detection Module Environment Manager AMF<DeviceRepository>Filter (caching filesystem based) FileSystem Cache ApacheMobile Filter Device Detection
  • 32. Configuration Open the file httpd.conf of your webserver. And configure this few parameter: PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv 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 file if 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 true PerlSetEnv Download<device repoisory>URL http://<url>/<device repository>.zip In production is suggested to set the AMFProductionMode on true: PerlSetEnv AMFProductionMode on true ApacheMobile Filter Device Detection
  • 33. Configuration WurflFilter 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 Filter Device Detection
  • 34. AMF with Memcached the 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 Filter Device Detection
  • 35. Apache WebServer Apache Mobile Filter Memcached cluster architecture Memcached* *http://memcached.org/ Apache Mobile Filter Apache WebServer Apache Mobile Filter Apache WebServer Apache Mobile Filter ApacheMobile Filter Device Detection
  • 37. Configuration Open the file httpd.conf of your webserver. And configure this few parameter: PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv 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 file if 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 true PerlSetEnv 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 true If you want to download directly from internet (it’s very slow): PerlSetEnv PatchWurflNetDownload true PerlSetEnv 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
  • 39. Mobile Caching System (beta version) (for cluster architecture using memcached) AMFMobileCachingMemcached memcached server 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 System ApacheMobile Filter
  • 40. Configuration Open the file httpd.conf of your webserver. And configure this few parameter: PerlSetEnv AMFMobileHome /server_root/MobileFilter PerlSetEnv 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 Filter Mobile Cache System
  • 42. Image Render AMFImageRendering Original Images Directory Cached Images Directory Image Rendering Filter Image Rendering EngineApacheMobile Filter
  • 43. Configuration The 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::AMFWURFLFilter PerlTransHandler +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 Filter Image Render Engine
  • 44. Image Render Filter HTML 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 Filter Image 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
  • 45. 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 Filter ApacheMobile Filter Image Render Engine
  • 48. You can use the filter to redirect to other part if it came from: web browser mobile browser transcoder 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::AMFWURFLFilter PerlTransHandler +Apache2::AMFWURFLFilter PerlTransHandler +Apache2::AMFSwitcher Configuration Configure 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
  • 49. You can use the filter to redirect to other part if it came from: web browser mobile browser transcoder 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::AMFWURFLFilter PerlTransHandler +Apache2::AMFSwitcher Configuration AMFSwitcher (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
  • 50. Open the file httpd.conf of your webserver. And configure this few parameters*: PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv FullBrowserUrl /web PerlSetEnv MobileVersion /mobile PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site PerlSetEnv WildCardRedirect true PerlTransHandler +Apache2::AMFWURFLFilter PerlTransHandler +Apache2::AMFSwitcher Configuration AMFSwitcher (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=12 Redirect for pc browser Redirect for mobile browser
  • 51. Open the file httpd.conf of your webserver. And configure this few parameters*: PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv 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::AMFWURFLFilter PerlTransHandler +Apache2::AMFSwitcher Configuration AMFSwitcher (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
  • 52. Open the file httpd.conf of your webserver. And configure this few parameters*: PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv FullBrowserUrl /web PerlSetEnv MobileVersion /mobile PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site PerlSetEnv FullBrowserMobileAccessKey fullbrowser #the value you can change PerlTransHandler +Apache2::AMFWURFLFilter PerlTransHandler +Apache2::AMFSwitcher Configuration AMFSwitcher (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>
  • 53. Open the file httpd.conf of your webserver. And configure this few parameters*: PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv FullBrowserUrl /web PerlSetEnv MobileVersion /mobile PerlSetEnv RedirectTranscoderUrl /transcoder_dedicates_site PerlSetEnv ForceTabletAsFullBrowser true PerlTransHandler +Apache2::AMFWURFLFilter PerlTransHandler +Apache2::AMFSwitcher Configuration AMFSwitcher (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.
  • 55. Carrier Detection Carrier Detection Manager Carrier IP Repository (memory storage) AMFCarrierDetection Environment Manager Carrier DetectionApacheMobile Filter
  • 56. Configuration Carrier Detection PerlSetEnv AMFMobileHome server_root/MobileFilter PerlSetEnv CarrierNetDownload true #optional# PerlSetEnv CarrierUrl http://www.andymoore.info/carrier-data.txt PerlTransHandler +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_NAME AMF_CARRIER_NATION ApacheMobile Filter Carrier Detection
  • 58. 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::AMFWURFLFilter PerlTransHandler +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
  • 59. 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 true PerlSetEnv AMFTraceCapability id,brand_name PerlModule Apache2::AMFWURFLFilter PerlTransHandler +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
  • 61. 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::AMFWURFLFilter PerlTransHandler +Apache2::AMFWURFLFilter <Location /WS/*> SetHandler modperl PerlResponseHandler Apache2::AMFWebService Allow from all </Location> or AMFWURFLFilterMemcached ApacheMobile Filter only from V3.30 before was PerlOutputFilterHandler
  • 62. WebService WebService 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
  • 64. Device Monitor Devices Detected Devices not Detected Devices Capabilities Home Page PerlSetEnv CacheDirectoryStore /tmp <Location /admin/*> PerlOutputFilterHandler Apache2::AMFDeviceMonitor </Location> Configuration: Carrier DetectionApacheMobile Filter
  • 65. 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
  • 66. AMF and mod_rewrite Now 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/AMF PerlSetEnv AMFProductionMode true PerlSetEnv ServerMemCached localhost:11211 PerlTransHandler +Apache2::AMF<your favorite module>Filter # or PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached RewriteEngine on RewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^true RewriteRule ^(.*)$ http://m.foo.org [R=301,L] AMF<your favorite module>FilterMemcached is for AMFDetectRightFilter, AMF51DegreesFilter, AMFWURFLFilter and AMFLiteDetectionFilter ApacheMobile Filter
  • 67. AMF and mod_rewrite All 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/AMF PerlSetEnv AMFProductionMode true PerlSetEnv ServerMemCached localhost:11211 PerlTransHandler +Apache2::AMF<your favorite module>Filter # or PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached RewriteEngine on RewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^true RewriteCond %{ENV:AMF_DEVICE_IS_TABLET} !^true RewriteRule ^(.*)$ http://m.foo.org [R=301,L] AMF<your favorite module>FilterMemcached is for AMFDetectRightFilter, AMF51DegreesFilter, AMFWURFLFilter and AMFLiteDetectionFilter ApacheMobile Filter
  • 68. 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/AMF PerlSetEnv AMFProductionMode true PerlSetEnv ServerMemCached localhost:11211 PerlTransHandler +Apache2::AMF<your favorite module>Filter # or PerlTransHandler +Apache2::AMF<your favorite module>FilterMemcached RewriteEngine on RewriteCond %{ENV:AMF_DEVICE_IS_MOBILE} ^true RewriteCond %{ENV:AMF_DEVICE_IS_TABLET} !^true RewriteCond %{ENV:AMF_FORCE_TO_DESKTOP} !^true RewriteRule ^(.*)$ http://m.foo.org [R=301,L] AMF<your favorite module>FilterMemcached is for AMFDetectRightFilter, AMF51DegreesFilter, AMFWURFLFilter and AMFLiteDetectionFilter ApacheMobile Filter
  • 69. 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
  • 71. 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
  • 72. Who wrote about “Apache Mobile Filter” ApacheMobile Filter
  • 73. 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