@Path(value="/stockquote") public class StockQuoteService extends Object implements org.wso2.msf4j.Microservice
| Constructor and Description |
|---|
StockQuoteService()
Add initial stocks IBM, GOOG, AMZN.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(org.osgi.framework.BundleContext bundleContext) |
void |
addStock(Stock stock)
Add a new stock.
|
protected void |
deactivate(org.osgi.framework.BundleContext bundleContext) |
Stocks |
getAllStocks(org.wso2.msf4j.Request request)
Retrieve all stocks.
|
javax.ws.rs.core.Response |
getQuote(String symbol)
Retrieve a stock for a given symbol.
|
String |
toString() |
protected void activate(org.osgi.framework.BundleContext bundleContext)
protected void deactivate(org.osgi.framework.BundleContext bundleContext)
@GET
@Path(value="/{symbol}")
@Produces(value={"application/json","text/xml"})
public javax.ws.rs.core.Response getQuote(@PathParam(value="symbol")
String symbol)
throws SymbolNotFoundException
symbol - Stock symbol will be taken from the path parameter.SymbolNotFoundException@POST @Consumes(value="application/json") public void addStock(Stock stock) throws DuplicateSymbolException
stock - Stock object will be created from the request Json body.DuplicateSymbolException@GET
@Path(value="/all")
@Produces(value={"application/json","text/xml"})
public Stocks getAllStocks(@Context
org.wso2.msf4j.Request request)
Copyright © 2019 WSO2. All rights reserved.