Coap URI-PATCH for openthread simulator - openthread

I´m working in a scientic work and I need to use the openthread simulator.
By the documentation (above) to set the coap resource is necessary to use the uri-path, does anyone have an examle how to do that ?
Thanks in advance
Ricardo
https://github.com/openthread/openthread/blob/master/src/cli/README_COAP.md#resource-uri-path
resource [uri-path]
Sets the URI path for the test resource.
coap resource test-resource Done > coap resource test-resource Done
Sets the URI path for the test resource.
coap resource test-resource
Done
coap resource test-resource Done

The URI-Path to the path component of the URI. If you need the CoAP server to read data from a file when responding to a CoAP Request, you will need to write the code to do so. You can reference src/cli/cli_coap.cpp for example code. In particular, you can see where the resource content is retrieved in src/cli/cli_coap.cpp#L630.

Related

What is a Resource Resolver API interface in AEM? What is it's significance

What exactly are resources and resource resolvers. Can you please elaborate the same and essential terms relating to it?
Wanted to know how resource resolver works and if possible it's usage with an example.
A high level view can be found on https://sling.apache.org/documentation/the-sling-engine/resources.html. Sling is essentially the core of AEM.
The easiest way to use a ResourceResolver in a servlet is getting it from SlingHttpServletRequest.html#getResourceResolver. The resolver needs to have the appropriate repository rights to access the resource, but every node under /content should be accessible.
You could than adapt the node to the appropriate component and get a JSON representation by Jackson mapper.

Rewriting the response header in traefik

I have a kubernetes cluster and I am using traefik ingress controller to route traffic to deployments inside the kubenetes cluster.
I am able to use ingress.kubernetes.io/rewrite-target annotation to change the incoming request path to the one expected by the backend.
For example : /star is transformed to /trek by the rewrite target annotation and the request gets routed to /trek and backend processing is successful.
What I want to know is if there is a way to change response header so that /trek gets changed back to /star?
Did you get an answer to this? It looks like similar functionality is available in Apache Traffic Server: https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/header_rewrite.en.html, but would be good to have it in traefik
The functionality that does this is modifiers and specifically ReplacePath. Here is a similar answer with some examples.

Standard header for public address with an API Gateway

Let's say you are using an API gateway like Apigee or Amazon API Gateway and your public address for your API is http://my.public.dns.com/path/v1/articles. This gets routed through your gateway to an internal host http://some.internal.host.com/v1/articles. Now if your internal API returns relative links to itself then when they get served to the client they will be incorrect as they are based on its path not the actual public path. I know I can resolve this by transforming the response using the tools available in the respective gateway.
The question I have is; is there a standard way for a gateway to communicate the public path to the downstream component? I was thinking there might be a similar HTTP header to X-Forwarded-For.
There is no standard similar header.
Note that I think you mean if the back-end returns absolute links. If the links were relative, they'd already be correct. Relative links use no leading / thus are "relative" to the current directory -- whatever it may be - and so any external prefix is retained by the browser and the links transparently remain valid. Relative links can also backtrack a directory level with a ../ path prefix for each level.
Note also that API Gateway doesn't require any path prefix if you're using a custom domain name for your API This necessarily limits you to deploying a single "stage," but that's a reasonable tradeoff for a more flexible path... so the easiest solution might be to use a path in your API matching those internal paths.

HTTP-like treatment for custom URI scheme, possible?

I defined a new URI scheme on my Windows system (following this thread: how do I create my own URL protocol? (e.g. so://...))
I want the custom URI protocol to act like HTTP within Chrome/Firefox...
That is, I want: myprotocol://localhost/test.html
to act exactly like:
http://localhost/test.html
Is it possible, or does the browser insist on valid URI schemes, even if they are fully defined in the registry?
(This pertains to a local server and is required for personal application testing; I realise custom URI's are a bad standard and should not be used in production)
It is certainly possible to link a custom scheme to the browser of your choice. The challenge is to get the browser to treat your scheme exactly like http:// as it cannot possibly know it has to speak HTTP to the target resource. However, this answer suggests using an <iframe/> is a viable workaround.

Browser perform a request insted of show data uri

My Apache registered a data URI in access log.
/data:image/png%3bbase64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAMAAACeL25MAAAABlBMVEUzlME6qNuT3ZmEAAAAE0lEQVQI12NgZGRkYABiMAQzGQEAjAANk73rMwAAAABJRU5ErkJggg==
Apparently some browser did not understand the data URI and performed a request.
How to solve it?
Use some feature detector on client side (for example, Modernizr). And then check whether this feature is supported on document load. If it is not - replace all such urls with, for example, a path to a blank image.
In addition you could just block data uris in you firewall or on your front-end server.