Commit 722b9ff8 authored by Björn Butzin's avatar Björn Butzin
Browse files

Fixes #2 added setGetable() and isGetable() as replacement of setReadable() and isReadable()

setReadable() and isReadable() are marked as deprecated
parent 0a7b73d1
......@@ -50,7 +50,7 @@ public class BasicCoapResource implements CoapResource {
private long expires = -1; // -1 = never expires
// permissions
private boolean readable = true;
private boolean getable = true;
private boolean postable = true;
private boolean putable = true;
private boolean observable = true;
......@@ -197,12 +197,11 @@ public class BasicCoapResource implements CoapResource {
}
public synchronized BasicCoapResource setReadable(boolean readable) {
this.readable = readable;
return this;
return this.setGetable(readable);
}
public synchronized boolean isReadable() {
return this.readable;
return this.isGetable();
}
public synchronized BasicCoapResource setPostable(boolean postable) {
......@@ -298,4 +297,13 @@ public class BasicCoapResource implements CoapResource {
public synchronized void delete() {
// nothing has to be done to delete this resource.
}
public boolean isGetable() {
return this.getable;
}
public BasicCoapResource setGetable(boolean getable) {
this.getable = getable;
return this;
}
}
\ No newline at end of file
......@@ -189,7 +189,7 @@ public class CoapResourceServer implements ResourceServer {
} else if (eTagMatch != -1) {
response = channel.createResponse(request, CoapResponseCode.Valid_203, CoapMediaType.text_plain);
response.setETag(request.getETag().get(eTagMatch));
} else if (!resource.isReadable()) {
} else if (!resource.isGetable()) {
response = channel.createResponse(request, CoapResponseCode.Method_Not_Allowed_405);
} else {
// Accept Formats?
......
......@@ -159,16 +159,31 @@ public interface CoapResource {
public void unregisterServerListener(ResourceServer server);
/**
* @deprecated use {@link #isGetable()} instead
* @return True, if and only if the resource is readable.
*/
@Deprecated
public boolean isReadable();
/**
* @return True, if and only if the resource is readable.
*/
public boolean isGetable();
/**
* Set, if the resource accepts get messages
*
* @deprecated use {@link #setGetable(boolean)} instead
* @return the changed CoapResource
*/
@Deprecated
public CoapResource setReadable(boolean readable);
/**
* Set, if the resource accepts get messages
*
* @return the changed CoapResource
*/
public CoapResource setGetable(boolean getable);
/**
* @return True, if and only if the resource accepts post requests.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment