I want to get iPhone UDID through Mobile Safari. I use .mobileconifg as
<plist version="1.0"> <dict> <key>PayloadContent</key> <dict> <key>URL</key> <string>http://192.168.12.45:8080/enroll/retrieve</string> <key>DeviceAttributes</key> <array> <string>UDID</string> <string>SERIAL</string> <string>CHALLENGE</string> <string>IMEI</string> <string>ICCID</string> <string>VERSION</string> <string>PRODUCT</string> <string>DEVICE_NAME</string> <string>MAC_ADDRESS_EN0</string> </array> </dict> <key>PayloadOrganization</key> <string>Org</string> <key>PayloadDisplayName</key> <string>Profile Service</string> <key>PayloadVersion</key> <integer>1</integer> <key>PayloadUUID</key> <string>D6F1B2A3-0039-48B5-915B-8E2B35663816</string> <key>PayloadIdentifier</key> <string>Identifer</string> <key>PayloadDescription</key> <string>This temporary profile will be used to find and display your current device UDID.</string> <key>PayloadType</key> <string>Profile Service</string> </dict> </plist>
retrieve.php
<?php $data = file_get_contents('php://input'); header('Location: http://192.168.12.45/enroll/info?'.$data, true, 301); ?>
info is a directory, not a page, I created index.php in this directory. I get data in $ _GET.
But I can get from php.
But I want to use the Java servlet, I changed the url in the mobileconfig file to the servlet url, but I cannot get any values ββin java.
get java code
Enumeration headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String paramName = (String) headerNames.nextElement(); String paramValue = request.getHeader(paramName); System.out.println("paramValue :" + paramValue); }
Output:
paramValue :192.168.12.45:8080 paramValue :keep-alive paramValue :gzip, deflate paramValue :Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D201 Safari/9537.53 paramValue :en-us paramValue :text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
it shows an error like this

But I want a Java servlet to get IMEI. I want to change the above PHP code to a Java servlet. How to solve this problem and set a profile to get UDID and IMEI
source share