Search code examples
iosputstripesmdm

Stripes ActionBean get client PUT data


I'm trying to implement a iOS MDM server in Java with stripes.

I want the iDevice to checkin to a ActionBean, but how do I get the data from the iDevice's PUT request?

The data that the iDevice will send is the one below.

PUT: /checkin
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>MessageType</key>
    <string>Authenticate</string>
    <key>Topic</key>
    <string>com.example.mdm.pushcert</string>
    <key>UDID</key>
    <string> [ redacted ] </string>
</dict>
</plist>

Solution

  • I solved this by creating a Servlet (extends HttpServlet) and overriding the doPut() method.

    The servlet needs to be mapped in the web.xml file. (Running via jetty).

    <servlet>
        <servlet-name>MDM</servlet-name>
        <servlet-class>com.mycompany.web.MDMServlet</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>MDM</servlet-name>
        <url-pattern>/mdm-servlet/*</url-pattern>
    </servlet-mapping>