-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91f4a83
commit 43c3167
Showing
5 changed files
with
81 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/RootResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Sierra Wireless and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.html. | ||
* | ||
* Contributors: | ||
* Sierra Wireless - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.server.californium.impl; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.californium.core.CoapResource; | ||
import org.eclipse.californium.core.CoapServer; | ||
import org.eclipse.californium.core.coap.CoAP.ResponseCode; | ||
import org.eclipse.californium.core.network.Endpoint; | ||
import org.eclipse.californium.core.server.resources.CoapExchange; | ||
|
||
/** | ||
* A default root resource. | ||
*/ | ||
public class RootResource extends CoapResource { | ||
|
||
private CoapServer coapServer; | ||
|
||
public RootResource(CoapServer coapServer) { | ||
super(""); | ||
setVisible(false); | ||
this.coapServer = coapServer; | ||
} | ||
|
||
@Override | ||
public void handleGET(CoapExchange exchange) { | ||
exchange.respond(ResponseCode.NOT_FOUND); | ||
} | ||
|
||
@Override | ||
public List<Endpoint> getEndpoints() { | ||
return coapServer.getEndpoints(); | ||
} | ||
} |