Package org.apache.mina.coap.resource

Examples of org.apache.mina.coap.resource.AbstractResourceHandler


                        new CoapEncoder(), new CoapDecoder() //
                ), rq);

        client.setIoHandler(new Handler());

        reg.register(new AbstractResourceHandler() {

            @Override
            public CoapResponse handle(CoapMessage request, IoSession session) {
                if (request.getCode() == CoapCode.GET.getCode()) {
                    return new CoapResponse(CoapCode.CONTENT.getCode(), status.getBytes());
View Full Code Here


        final Map<String, IoSession> registration = new ConcurrentHashMap<>();

        // create a CoAP resource registry
        final ResourceRegistry reg = new ResourceRegistry();

        reg.register(new AbstractResourceHandler() {

            @Override
            public String getPath() {
                return "demo";
            }

            @Override
            public CoapResponse handle(CoapMessage request, IoSession session) {
                return new CoapResponse(CoapCode.CONTENT.getCode(), "niah niah niah niah niah\n niah niah niah\n"
                        .getBytes(), new CoapOption(CoapOptionType.CONTENT_FORMAT, new byte[] { 0 }));
            }

            @Override
            public String getTittle() {
                return "Some demo resource";
            }

        });

        reg.register(new AbstractResourceHandler() {

            @Override
            public CoapResponse handle(CoapMessage request, IoSession session) {
                String device = null;
                try {
View Full Code Here

                        new CoapEncoder(), new CoapDecoder() //
                ), rq);

        client.setIoHandler(new Handler());

        reg.register(new AbstractResourceHandler() {

            @Override
            public CoapResponse handle(CoapMessage request, IoSession session) {
                if (request.getCode() == CoapCode.GET.getCode()) {
                    return new CoapResponse(CoapCode.CONTENT.getCode(), status.getBytes());
View Full Code Here

        final Map<String, IoSession> registration = new ConcurrentHashMap<>();

        // create a CoAP resource registry
        final ResourceRegistry reg = new ResourceRegistry();

        reg.register(new AbstractResourceHandler() {

            @Override
            public String getPath() {
                return "demo";
            }

            @Override
            public CoapResponse handle(CoapMessage request, IoSession session) {
                return new CoapResponse(CoapCode.CONTENT.getCode(), "niah niah niah niah niah\n niah niah niah\n"
                        .getBytes(), new CoapOption(CoapOptionType.CONTENT_FORMAT, new byte[] { 0 }));
            }

            @Override
            public String getTitle() {
                return "Some demo resource";
            }

        });

        reg.register(new AbstractResourceHandler() {

            @Override
            public CoapResponse handle(CoapMessage request, IoSession session) {
                String device = null;
                try {
View Full Code Here

TOP

Related Classes of org.apache.mina.coap.resource.AbstractResourceHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.