3
我正在構建一個具有AWS和Google Cloud相同功能的應用程序。例如創建實例,從機器ID啓動實例,創建快照,引用所有實例等。我使用REST調用進行呼叫。 例如:使用相同REST調用的不同動作
<form method="post" action="rest/create/new" class="form-inline">
<label for="user">User Name</label> <input type="text" id="user"
name="user" class="form-control" size="50"
placeholder="Enter Username">
<button type="submit" class="btn btn-info">Start New Machine</button>
</form>
<form method="post" action="rest/launch/start" class="form-inline">
<label for="AMId">Launch Existing Machine</label><br> <input
type="text" id="AMId" name="AMId" class="form-control" size="50"
placeholder="Enter Instance ID">
<button type="submit" class="btn btn-info">Launch</button>
<br>
</form>
<br> <br>
<form method="get" action="rest/create/listAll" class="form-inline">
<label>Show All EC2 Instances</label><br>
<button type="submit" class="btn btn-info btn-lg">Show All</button>
</form>
<br> <br>
<form method="post" **action="rest/create/listRunning"**>
<label>Show All Running EC2 Instances</label><br>
<button type="submit" class="btn btn-info">Show All Running</button>
</form>
<br> <br>
<form method="post" action="rest/create/terminate" class="form-inline">
<label for="terminateID">Enter Instance ID</label><br> <input
type="text" id="terminateID" name="terminateID" class="form-control"
size="50" placeholder="Enter Machine ID">
<button type="submit" class="btn btn-info">Terminate</button>
</form>
<br> <br>
而且我趕上在課堂上這些REST調用。 例如,
@GET
@Path("/listAll")
public Response getAllAvailableImages(@Context ServletContext context)
現在我想的是我怎麼能同時使用AWS和谷歌的雲功能,使用這些相同的呼叫或其他方法,根據要求或選擇?
我們怎麼辦稱他們爲(括號{}),你能給我一個鏈接,可以詳細解釋它? –
我已經解釋了佔位符並添加了一個Spring MVC示例。 – morsor
它解釋了很多。但是,你能告訴我,如果兩者都是POST類型(即getImages和createNewImage)會怎樣? –