Apache2-ApacheMobileFilter

 view release on metacpan or  search on metacpan

CHANGE  view on Meta::CPAN

Added Parameter CacheDirectoryStore to set the directory where the data are stored.
The Cache system use the Cache::FileBackend library, now the capabilities of device data are stored on filesystem. So if the version of WURFL or CapabilityList are not changed at startup Apache don't lost the data stored.
Fixed Bugs (thanks to Eladio)
Clear code

WURFLFilter 2.07
Clear code

WURFLFilter 2.06
Fixed Bugs for caching system thanks to nobbynobbs 
For the uknown devices now the AMF_ID return "device_not_found" value (before was null)
Manage strange headers X-Device-User-Agent for Content Transformation (read more: http://www.w3.org/TR/ct-guidelines/)

ImageRenderingFilter 2.06 
Clear the code

WURFLFilter 2.05
WURFLFIlter parameter DownloadZipFile now the Apache Mobile Filter detect automaticaly the file to download is a zip file.
Add Environment variable AMF_WURFLVER to know which version of WURFL the filter use.
Optimize the downloading phases of wurfl files.
ImageRenderFilter fixed bugs

lib/Apache2/AMF51DegreesFilter.pm  view on Meta::CPAN

	$cachedirectorystore=$ENV{CacheDirectoryStore};
	$CommonLib->printLog("CacheDirectoryStore is: $cachedirectorystore");
  } else {
	  $CommonLib->printLog("CacheDirectoryStore not exist.	Please set the variable CacheDirectoryStore into httpd.conf, (the directory must be writeable)");
	  ModPerl::Util::exit();      
  }   
  #
  # Define the cache system directory
  #
  my $cacheSystem = new Cache::FileBackend( $cachedirectorystore, 3, 000 );
  $cacheSystem->store( '51Degrees-id', 'device_not_found', "id=device_not_found&device=false&device_claims_web_support=true&is_wireless_device=false");
  if ($cacheSystem->restore('51Degrees-conf','ver')) {
  } else {
            $CommonLib->printLog('Create new wurf-con store');
      	    $cacheSystem->store('51Degrees-conf', 'ver', 'null');
	        $cacheSystem->store('51Degrees-conf', 'caplist', 'null');
	        $cacheSystem->store('51Degrees-conf', 'listall', 'null');
	        $cacheSystem->store('51Degrees-conf', 'RedirectTranscoderUrl','null');
	        $cacheSystem->store('51Degrees-conf', 'MobileVersionUrl','null');
	        $cacheSystem->store('51Degrees-conf', 'FullBrowserUrl','null');
	        $cacheSystem->store('51Degrees-conf', 'ResizeImageDirectory','null');

lib/Apache2/AMFDetectRightFilter.pm  view on Meta::CPAN

	$cachedirectorystore=$ENV{CacheDirectoryStore};
	$CommonLib->printLog("CacheDirectoryStore is: $cachedirectorystore");
  } else {
	  $CommonLib->printLog("CacheDirectoryStore not exist.	Please set the variable CacheDirectoryStore into httpd.conf, (the directory must be writeable)");
	  ModPerl::Util::exit();      
  }   
  #
  # Define the cache system directory
  #
  my $cacheSystem = new Cache::FileBackend( $cachedirectorystore, 3, 000 );
  $cacheSystem->store( 'DetectRight-id', 'device_not_found', "id=device_not_found&device=false&device_claims_web_support=true&is_wireless_device=false");
  if ($cacheSystem->restore('DetectRight-conf','ver')) {
  } else {
            $CommonLib->printLog('Create new wurf-con store');
      	    $cacheSystem->store('DetectRight-conf', 'ver', 'null');
	        $cacheSystem->store('DetectRight-conf', 'caplist', 'null');
	        $cacheSystem->store('DetectRight-conf', 'listall', 'null');
	        $cacheSystem->store('DetectRight-conf', 'RedirectTranscoderUrl','null');
	        $cacheSystem->store('DetectRight-conf', 'MobileVersionUrl','null');
	        $cacheSystem->store('DetectRight-conf', 'FullBrowserUrl','null');
	        $cacheSystem->store('DetectRight-conf', 'ResizeImageDirectory','null');

lib/Apache2/AMFDeviceMonitor.pm  view on Meta::CPAN

				$page_html=$page_html."</table>";
  	      } else {
  	      if ($ArrayQuery{form} eq "1") {
	  	      $page_html=$page_html.'<form action="" method=get>Search device id <input type="text" name="search"><input type="hidden" name="form" value="1"><input type=submit></form>';
  	      }
	      $page_html=$page_html."<table>";
	      $page_html=$page_html."<tr><td>n.</td><td>device id</td><td>User Agent</td></tr>"; 
	      foreach $ua ( sort $cacheSystem->get_keys( 'wurfl-ua' ) )
	  		{
	    			$id =$cacheSystem->restore( 'wurfl-ua', $ua );
	    			if ($ArrayQuery{form} eq "2" && $id eq 'device_not_found'){
	    			           $count++;
	    			    	  if ($count > $min - 1 && $count < $max + 1) {
	    			    	      		    		 
	    			  			$page_html=$page_html."<tr><td>$count</td><td>$id</td><td>$ua</td></tr>";
	    			    	  }

	    			}
	    			if ($ArrayQuery{form} eq "1" && $id ne 'device_not_found') {
	    			    if ($ArrayQuery{search}) {
	    			    	if ($id =~ m/$ArrayQuery{search}/i) {
	    			    	  $count++;
	    			    	  if ($count > $min && $count < $max + 1) {
			    			  		$page_html=$page_html."<tr><td>$count</td><td><a href=\"?form=3&deviceid=$id\">$id</a></td><td>$ua</td></tr>"; 
	    			    	  }
			    			  
	    			    	} 
	    			    } else {
	    			          $count++; 

lib/Apache2/AMFTrace.pm  view on Meta::CPAN

sub handler    {
    my $f = shift;              
    my $user_agent=$f->headers_in->{'User-Agent'}|| '';
    my $x_user_agent=$f->headers_in->{'X-Device-User-Agent'}|| '';
    if ($x_user_agent) {
       $f->log->warn("Warn probably transcoder: $x_user_agent");
       $user_agent=$x_user_agent;
    }
    if ($TraceDebug eq 'false') {
	if ($f->pnotes('id')) {      
	    if ($f->pnotes('id') eq 'device_not_found') {
		    $f->log->warn("AMFTrace device_not_found - User_Agent:$user_agent");
	    }
	} else { 
	    $f->log->warn("AMFTrace device_not_found - User_Agent:$user_agent");
	}
    } else {
	my $msg="";
	foreach my $key ( @TraceCapability) {
		if ($f->pnotes("$key")) {
			$msg=$msg.$key."=".$f->pnotes("$key").$TraceFS;
		} else {
		   if ($key eq 'id') {
			$msg=$msg."id=device_not_found".$TraceFS;
		   }
		}
	}
	$f->log->warn("AMFTrace - $msg User_Agent:$user_agent");
    }
    return Apache2::Const::DECLINED; 
} 

1;

lib/Apache2/AMFWURFLFilter.pm  view on Meta::CPAN

	$cachedirectorystore=$ENV{CacheDirectoryStore};
	$CommonLib->printLog("CacheDirectoryStore is: $cachedirectorystore");
  } else {
	  $CommonLib->printLog("CacheDirectoryStore not exist.	Please set the variable CacheDirectoryStore into httpd.conf, (the directory must be writeable)");
	  ModPerl::Util::exit();      
  }   
  #
  # Define the cache system directory
  #
  my $cacheSystem = new Cache::FileBackend( $cachedirectorystore, 3, 000 );
  $cacheSystem->store( 'wurfl-id', 'device_not_found', "id=device_not_found&device=false&device_claims_web_support=true&is_wireless_device=false");
  if ($cacheSystem->restore('wurfl-conf','ver')) {
  } else {
            $CommonLib->printLog('Create new wurf-con store');
      	    $cacheSystem->store('wurfl-conf', 'ver', 'null');
	        $cacheSystem->store('wurfl-conf', 'caplist', 'null');
	        $cacheSystem->store('wurfl-conf', 'listall', 'null');
	        $cacheSystem->store('wurfl-conf', 'RedirectTranscoderUrl','null');
	        $cacheSystem->store('wurfl-conf', 'MobileVersionUrl','null');
	        $cacheSystem->store('wurfl-conf', 'FullBrowserUrl','null');
	        $cacheSystem->store('wurfl-conf', 'ResizeImageDirectory','null');



( run in 2.346 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )