Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
WS4D
jCoAP
Commits
722b9ff8
Commit
722b9ff8
authored
Sep 09, 2016
by
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
ws4d-jcoap/src/org/ws4d/coap/core/rest/BasicCoapResource.java
View file @
722b9ff8
...
...
@@ -50,7 +50,7 @@ public class BasicCoapResource implements CoapResource {
private
long
expires
=
-
1
;
// -1 = never expires
// permissions
private
boolean
read
able
=
true
;
private
boolean
get
able
=
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
.
read
able
;
return
this
.
isGet
able
()
;
}
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
ws4d-jcoap/src/org/ws4d/coap/core/rest/CoapResourceServer.java
View file @
722b9ff8
...
...
@@ -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
.
is
Read
able
())
{
}
else
if
(!
resource
.
is
Get
able
())
{
response
=
channel
.
createResponse
(
request
,
CoapResponseCode
.
Method_Not_Allowed_405
);
}
else
{
// Accept Formats?
...
...
ws4d-jcoap/src/org/ws4d/coap/core/rest/api/CoapResource.java
View file @
722b9ff8
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment