public OdlOnem2mCoapRequestPrimitiveBuilder setOperationUpdate() { onem2mRequest.coapRequest = Request.newPut(); return this; } public OdlOnem2mCoapRequestPrimitiveBuilder setOperationDelete() {
public CC03(String serverURI) { super(CC03.class.getSimpleName()); // create the request Request request = Request.newPut(); // add payload request.setPayload("TD_COAP_CORE_03"); request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN); // set the parameters and execute the request executeRequest(request, serverURI, RESOURCE_URI); }
public CB03(String serverURI) { super(CB03.class.getSimpleName()); Request request = Request.newPut(); request.setPayload(data); request.getOptions().setContentFormat(MediaTypeRegistry.TEXT_PLAIN); // set the parameters and execute the request executeRequest(request, serverURI, "/large-update"); }
/** * Sends a PUT request with payload and required Content-Format and blocks * until the response is available. * * @param payload the payload * @param format the Content-Format * @return the CoAP response */ public CoapResponse put(String payload, int format) { return synchronous(format(Request.newPut().setURI(uri).setPayload(payload), format)); }
/** * Sends a PUT request with payload and required Content-Format and blocks * until the response is available. * * @param payload the payload * @param format the Content-Format * @return the CoAP response */ public CoapResponse put(byte[] payload, int format) { return synchronous(format(Request.newPut().setURI(uri).setPayload(payload), format)); }
/** * Sends a PUT request with the specified payload and the specified content * format and invokes the specified handler when a response arrives. * * @param handler the Response handler * @param payload the payload * @param format the Content-Format */ public void put(CoapHandler handler, String payload, int format) { asynchronous(format(Request.newPut().setURI(uri).setPayload(payload), format), handler); }
/** * Sends a PUT request with the specified payload and the specified content * format and invokes the specified handler when a response arrives. * * @param handler the Response handler * @param payload the payload * @param format the Content-Format */ public void put(CoapHandler handler, byte[] payload, int format) { asynchronous(format(Request.newPut().setURI(uri).setPayload(payload), format), handler); }
/** * Sends a PUT request with the If-None-Match option set and blocks until * the response is available. * * @param payload the payload string * @param format the Content-Format * @return the CoAP response */ public CoapResponse putIfNoneMatch(String payload, int format) { return synchronous(ifNoneMatch(format(Request.newPut().setURI(uri).setPayload(payload), format))); }
/** * * @param handler the Response handler * @param payload the payload * @param format the Content-Format * @param etags the ETags for the If-Match option */ public void putIfMatch(CoapHandler handler, String payload, int format, byte[] ... etags) { asynchronous(ifMatch(format(Request.newPut().setURI(uri).setPayload(payload), format), etags), handler); }
/** * Sends a PUT request with with the specified ETags in the If-Match option * and blocks until the response is available. * * @param payload the payload * @param format the Content-Format * @param etags the ETags for the If-Match option * @return the CoAP response */ public CoapResponse putIfMatch(byte[] payload, int format, byte[] ... etags) { return synchronous(ifMatch(format(Request.newPut().setURI(uri).setPayload(payload), format), etags)); }
/** * Sends a PUT request with the If-None-Match option set and blocks until * the response is available. * * @param payload the payload * @param format the Content-Format * @return the CoAP response */ public CoapResponse putIfNoneMatch(byte[] payload, int format) { return synchronous(ifNoneMatch(format(Request.newPut().setURI(uri).setPayload(payload), format))); }
@Override public void visit(final UpdateRequest request) { if (!areParametersValid(request.getClientParameters())) { return; } coapRequest = Request.newPut(); buildRequestSettings(request); buildLocationPath(request); buildRequestContent(request); parametersValid = true; }
/** * * @param handler the Response handler * @param payload the payload * @param format the Content-Format * @param etags the ETags for the If-Match option */ public void putIfMatch(CoapHandler handler, byte[] payload, int format, byte[] ... etags) { asynchronous(ifMatch(format(Request.newPut().setURI(uri).setPayload(payload), format), etags), handler); }
@Override public void visit(final UpdateRequest request) { if (!areParametersValid(request.getClientParameters())) { return; } coapRequest = Request.newPut(); buildRequestSettings(request); buildLocationPath(request); buildRequestContent(request); parametersValid = true; }
@Override public void visit(WriteAttributesRequest request) { coapRequest = Request.newPut(); setTarget(coapRequest, request.getPath()); for (String query : request.getAttributes().toQueryParams()) { coapRequest.getOptions().addUriQuery(query); } }
@Override public void visit(WriteAttributesRequest request) { coapRequest = Request.newPut(); setTarget(coapRequest, destination, request.getPath()); for (String query : request.getObserveSpec().toQueryParams()) { coapRequest.getOptions().addUriQuery(query); } }
@Override public void visit(BootstrapWriteRequest request) { coapRequest = Request.newPut(); coapRequest.setConfirmable(true); ContentFormat format = request.getContentFormat(); coapRequest.getOptions().setContentFormat(format.getCode()); coapRequest.setPayload(encoder.encode(request.getNode(), format, request.getPath(), model)); setTarget(coapRequest, request.getPath()); }
@Override public void visit(WriteRequest request) { coapRequest = request.isReplaceRequest() ? Request.newPut() : Request.newPost(); ContentFormat format = request.getContentFormat(); coapRequest.getOptions().setContentFormat(format.getCode()); coapRequest.setPayload(encoder.encode(request.getNode(), format, request.getPath(), model)); setTarget(coapRequest, request.getPath()); }
private static Request newBlockwiseRequest(final int bodySize, final int blockSize) { Request request = Request.newPut(); request.getOptions().setBlock1(BlockOption.size2Szx(blockSize), true, 0).setSize1(bodySize); request.setPayload(generateRandomPayload(blockSize)); return request; } }
@Override public void visit(WriteRequest request) { coapRequest = request.isReplaceRequest() ? Request.newPut() : Request.newPost(); coapRequest.getOptions().setContentFormat(request.getContentFormat().getCode()); coapRequest .setPayload(LwM2mNodeEncoder.encode(request.getNode(), request.getContentFormat(), request.getPath())); setTarget(coapRequest, destination, request.getPath()); }