Coder Social home page Coder Social logo

Comments (5)

sbernard31 avatar sbernard31 commented on June 27, 2024 1

Currently I parse UriQuery by myself using :

// TODO remove this class when https://github.com/open-coap/java-coap/issues/45 will be fixed.
public class QueryUtil {
    public static Map<String, String> parseUriQuery(String uriQuery) {
        if (uriQuery == null || uriQuery.length() == 0) {
            return Collections.emptyMap();
        }
        Map<String, String> result = new LinkedHashMap<>();
        String[] params = uriQuery.substring(uriQuery.indexOf('?') + 1).split("&");

        for (String prm : params) {
            String[] p = prm.split("=", 2);
            if (p.length == 2) {
                result.put(p[0], p[1]);
            } else if (p.length == 1) {
                result.put(p[0], null);
            } else {
                throw new IllegalArgumentException();
            }
        }
        return result;
    }
}
for (Entry<String, String> entry : QueryUtil.parseUriQuery(coapRequest.options().getUriQuery())
                    .entrySet()) {
 ... .. 
}

from java-coap.

szysas avatar szysas commented on June 27, 2024

Currently empty query value can be placed in such way: field1=value1&field2=&field3=, so equal sign is needed. Would that work with Leshan?

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

Nope that does not match the LWM2M specification 😬

See for Q option :
/rd?ep={Endpoint Client Name}&lt={Lifetime}&lwm2m={version}&b={binding}&Q&sms={MSISDN}

from java-coap.

szysas avatar szysas commented on June 27, 2024

There is release v6.12.0 that contains implementation for this ticket, can we close it?

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

Tested with v6.12.0, my integrations tests pass now without my "HACK" ✔️

Thx for adding this 🙏

from java-coap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.