[jboss-as7-dev] dmr.js

Darran Lofthouse darran.lofthouse at redhat.com
Tue Apr 9 08:23:44 EDT 2013


On 09/04/13 13:19, Heiko Braun wrote:
> But speaking to Darran I can say that this is planned and I hope that we can positively influence the discussion to make these use cases work.

+1 Although we have always had a pending task to add true support for 
cross origin requests we never actually had justification that they 
would be used or were actually needed.

These changes in distribution and the dmr.js now provide that justification.

>
> Regards, Heiko
>
> [1] http://www.w3.org/TR/cors/
>
>
>
>
> On Apr 9, 2013, at 1:01 PM, Max Rydahl Andersen <manderse at redhat.com> wrote:
>
>> This is cool - how does the authentication work/not work ?
>>
>> Found this on github:
>> "It requires a patched AS7 instance if not running on the same host.
>> Some browsers require extra steps to get the authentication working, but Firefox should work out of the box."
>>
>> http://haraldpehl.blogspot.de/2013/03/independent-jboss-admin-console.html explains it a bit but
>> what is the patch needed for AS7 and with all these quirks do you think we can make it portable/usable for writing a webapp that connects remotely ?
>>
>> /max
>>
>> On Tue, Apr 09, 2013 at 08:11:59AM +0200, Heiko Braun wrote:
>>> Here's a code sample:
>>>
>>>
>>> <script>
>>> // access EC2 demo instance
>>> http = new XMLHttpRequest();
>>> http.withCredentials = true;
>>> http.open("POST", "http://as7-preview.dyndns.org:9990/management", true);
>>>
>>> // async response handler
>>> http.onreadystatechange =function()
>>> {
>>>    if (http.readyState==4 && http.status==200)
>>>    {
>>>        // decode response
>>>        response = dmr.ModelNode.fromBase64(http.responseText);
>>>        alert(response.get("result").asString());
>>>    }
>>> }
>>>
>>> // content type headers for DMR API
>>> http.setRequestHeader("Content-type","application/dmr-encoded");
>>> http.setRequestHeader("Accept","application/dmr-encoded");
>>>
>>> // create an operation
>>> op = new dmr.ModelNode();
>>> op.get("operation").set("read-attribute");
>>> op.get("address").setEmptyList();
>>> op.get("name").set("release-version");
>>>
>>> // send as base64 encoded
>>> http.send(op.toBase64String());
>>>
>>> </script>
>>>
>>>
>>> On Apr 8, 2013, at 1:20 PM, Heiko Braun <hbraun at redhat.com> wrote:
>>>
>>>>
>>>>
>>>> If you want to use the DMR API form plain JS and need all the typing build in, the dmr.js might be your friend:
>>>>
>>>> https://github.com/hal/dmr.js
>>>>
>>>>
>>>> Regards, Heiko
>>>> _______________________________________________
>>>> jboss-as7-dev mailing list
>>>> jboss-as7-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>
>>
>>> _______________________________________________
>>> jboss-as7-dev mailing list
>>> jboss-as7-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>

-- 
Darran Lofthouse - Principal Software Engineer

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Mark Hegarty (Ireland), Matt Parson
(USA), Charlie Peters (USA)


More information about the jboss-as7-dev mailing list