                     @_onPost req, res, appId
                 when "DELETE"
                     @_onDelete req, res, appId
+                when "OPTIONS"
+                    @_onOptions req, res, appId
                 else
                     Log.e "Unsupport http method: #{method}"
                     @_onResponse req, res, 400, null, null

            "Content-Type": "application/xml"
            "Connection": "keep-alive"
            "Access-Control-Allow-Method": "GET, POST, DELETE, OPTIONS"
            "Cache-Control": "no-cache, must-revalidate, no-store"
            "Content-Length": bodyContent.length
        @_onResponse req, res, 200, headers, bodyContent

            SessionManager.getInstance().sessionDisconnectedByToken token
            @_onResponse req, res, 200, null, null

    _onOptions: (req, res, appId) ->
        headers =
            "Connection": "keep-alive"
            "Access-Control-Allow-Method": "GET, POST, DELETE, OPTIONS"
            "Access-Control-Allow-Headers": "Content-Type, Authorization, Accept,X-Requested-With"
            "Cache-Control": "no-cache, must-revalidate, no-store"
            "Access-Control-Allow-Origin": "*"
            "Content-Length": "0"
        @_onResponse req, res, 200, headers, null


    _onResponse: (req, res, statusCode, headers, body) ->
        if headers
            res.writeHead statusCode, headers
