本文整理汇总了Java中org.springframework.web.bind.annotation.CrossOrigin类的典型用法代码示例。如果您正苦于以下问题:Java CrossOrigin类的具体用法?Java CrossOrigin怎么用?Java CrossOrigin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CrossOrigin类属于org.springframework.web.bind.annotation包,在下文中一共展示了CrossOrigin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detectMeaningLanguageSpecific
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@CrossOrigin
@RequestMapping(value = "/detectMeaningLanguageSpecific", method = RequestMethod.GET)
HttpEntity<Object> detectMeaningLanguageSpecific(@RequestParam("inputAsJson") String inputAsJson) {
try {
Logger.getAnonymousLogger().log(Level.INFO, "Invoke: detectMeaningLanguageSpecific: " + inputAsJson);
Gson gson = new Gson();
InputParameterdetectMeaningLanguageSpecific inputParameterdetectMeaningLanguageSpecific = gson
.fromJson(inputAsJson, InputParameterdetectMeaningLanguageSpecific.class);
List<Entity> concepts = sparqlDerivation.detectPossibleConceptsLanguageSpecific(
inputParameterdetectMeaningLanguageSpecific.getKeyword(),
inputParameterdetectMeaningLanguageSpecific.getLanguage());
MeaningResult meaningResult = new MeaningResult();
meaningResult.setConceptOverview(concepts);
meaningResult.setSearchTyp("ExplorativeSearch");
Gson output = new Gson();
String result = "";
result = output.toJson(meaningResult);
return new ResponseEntity<Object>(result, HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<Object>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
示例2: exception
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@CrossOrigin
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NotFoundException.class)
public MessageDTO exception(NotFoundException e) {
return new MessageDTO(e.getMessage());
}
示例3: invokeMethod
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@CrossOrigin
@RequestMapping(value = "/invokechaincode", method = RequestMethod.POST)
@ResponseBody
public String invokeMethod(@RequestBody String[] chaincodeParameters)
throws CryptoException, InvalidArgumentException, TransactionException, IOException,
InterruptedException, ExecutionException, TimeoutException, ProposalException, IllegalAccessException,
InstantiationException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException
{
String ops = "transfer";
String org = "druginc";
String channelName = "drugchan";
String chainCode = "bbb";
//String[] params = new String[] { "Bob", "Alice", "20" };
String[] params = chaincodeParameters;
String peerName = "peer0.druginc.drug.com";
User user = new UserFileSystem("Admin", "druginc.drug.com");
TransactionEvent event = new InvokeChaincode().invoke(ops, params, org, peerName, channelName,
chainCode, user);
if (event != null) {
// event.getTransactionID().
}
return "Success!";
}
示例4: changeDetails
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
/**
* ChangeDetails post method. Receives the new information of the user,
* checks it and updates it on the heroku server.
*
* @param name
* @param phone
* @param newCar
* @param email
* @param type
* @param oldCar
* @return A JSONized string of the success/error value.
*/
@CrossOrigin(origins = "*")
@RequestMapping(value = "/User/ChangeDetails", method = RequestMethod.POST, produces = "application/json")
@ResponseBody
public String changeDetails(@RequestParam("name") String name, @RequestParam("phone") String phone,
@RequestParam("newCar") String newCar, @RequestParam("email") String email,
@RequestParam("type") String type, @RequestParam("oldCar") String oldCar) {
boolean retVal = false;
// LoginManager login = new LoginManager();
try {
retVal = login.userUpdate(oldCar, name, phone, email, newCar, SCStringToSC(type));
System.out.println("in UC.changeDetails.POST retVal=" + retVal);
if (!retVal)
System.out.println("in UC.changeDetails.POST changeDetails failed!");
else {
setUserData(name, newCar, email, phone, SCStringToSC(type));
System.out.println("in UC.changeDetails.POST changeDetails success!");
}
} catch (LoginException e) {
System.out.println("in UC.changeDetails.POST Exception thrown: " + e);
e.printStackTrace();
}
detailsChanged = true;
return JSONize("val", retVal ? "true" : "false");
}
示例5: queryExecutions
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiResponses({
@ApiResponse(code = 200, response = String.class, message = "success"),
@ApiResponse(code = 400, response = String.class, message = "illegal request content"),
})
@CrossOrigin
@RequestMapping(value = "requests", method = GET)
public ResponseEntity<SagaExecutionQueryResult> queryExecutions(
@RequestParam(name = "pageIndex") String pageIndex,
@RequestParam(name = "pageSize") String pageSize,
@RequestParam(name = "startTime") String startTime,
@RequestParam(name = "endTime") String endTime) {
if (isRequestParamValid(pageIndex, pageSize, startTime, endTime)) {
try {
return ResponseEntity.ok(queryService.querySagaExecution(pageIndex, pageSize, startTime, endTime));
} catch (ParseException ignored) {
throw new InvocationException(BAD_REQUEST, "illegal request content");
}
} else {
throw new InvocationException(BAD_REQUEST, "illegal request content");
}
}
示例6: loginDemo
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
/**
* New Login get method
* @return the user object
*/
@CrossOrigin(origins = "*")
@RequestMapping(value = "/User/LoginDemo/{key}", produces = "application/json")
@ResponseBody
public ServerUser loginDemo(@PathVariable String key) {
if (users.get(key) != null) {
final ParseQuery<ParseObject> query = ParseQuery.getQuery("PMUser");
try {
ParseObject o = query.get(users.get(key).getUserId());
return (o == null) ? new ServerUser() : new ServerUser(new User(o));
} catch (final Exception e) {
return null;
}
}
return new ServerUser();
}
示例7: usersGet
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "Get users", notes = "", response = User.class, responseContainer = "List", authorizations = {
@Authorization(value = "Bearer")
}, tags={ "admin", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Get User list ok", response = User.class),
@ApiResponse(code = 500, message = "An unexpected error occured.", response = User.class) })
@RequestMapping(value = "/users",
produces = { "application/json" },
method = RequestMethod.GET)
@CrossOrigin
ResponseEntity<Object> usersGet(
@ApiParam(value = "Request pagination page") @RequestParam(value = "page", required = false) String page,
@ApiParam(value = "Request pagination size / num of users") @RequestParam(value = "size", required = false) String size,
@ApiParam(value = "Request orderBy filter") @RequestParam(value = "orderBy", required = false) String orderBy,
@ApiParam(value = "Request orderBy filter") @RequestParam(value = "orderDirection", required = false) String orderDirection,
@ApiParam(value = "Request search term") @RequestParam(value = "lastName", required = false) String lastName) throws ApiException, Exception;
示例8: usersIdApprovePut
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "", notes = "Change approve status of user", response = Void.class, authorizations = {
@Authorization(value = "Bearer")
}, tags={ "admin", })
@ApiResponses(value = {
@ApiResponse(code = 204, message = "no content", response = Void.class),
@ApiResponse(code = 400, message = "Bad request", response = Void.class),
@ApiResponse(code = 404, message = "not found", response = Void.class),
@ApiResponse(code = 409, message = "Non-final orders found", response = Void.class),
@ApiResponse(code = 500, message = "An unexpected error occured.", response = Void.class) })
@RequestMapping(value = "/users/{id}/approve",
produces = { "application/json" },
method = RequestMethod.PUT)
@CrossOrigin
ResponseEntity<Object> usersIdApprovePut(@ApiParam(value = "",required=true ) @PathVariable("id") Long id,
@NotNull @ApiParam(value = "Approve or disapprove", required = true) @RequestParam(value = "approve", required = true) Boolean approve,
@ApiParam(value = "Force disapprove user") @RequestParam(value = "force", required = false) Boolean force) throws ApiException, Exception;
示例9: usersIdDelete
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "Deletes an existing user", notes = " ", response = Void.class, authorizations = {
@Authorization(value = "Bearer")
}, tags={ "admin", })
@ApiResponses(value = {
@ApiResponse(code = 204, message = "User successfully deleted", response = Void.class),
@ApiResponse(code = 400, message = "User couldn't be deleted", response = Void.class),
@ApiResponse(code = 402, message = "Mix final orders", response = Void.class),
@ApiResponse(code = 404, message = "User not found", response = Void.class),
@ApiResponse(code = 409, message = "Only not final orders", response = Void.class),
@ApiResponse(code = 412, message = "Only final orders", response = Void.class) })
@RequestMapping(value = "/users/{id}",
produces = { "application/json" },
method = RequestMethod.DELETE)
@CrossOrigin
ResponseEntity<Object> usersIdDelete(@ApiParam(value = "",required=true ) @PathVariable("id") Long id,
@ApiParam(value = "") @RequestParam(value = "force", required = false) Boolean force) throws ApiException, Exception;
示例10: foodsFoodIdPut
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "Updates an existing food", notes = "Chef can update food name, type, description or price", response = Message.class, authorizations = {
@Authorization(value = "Bearer")
}, tags={ "chef", })
@ApiResponses(value = {
@ApiResponse(code = 204, message = "A custom message.", response = Message.class),
@ApiResponse(code = 400, message = "An unexpected error occured.", response = Message.class),
@ApiResponse(code = 404, message = "Food not found", response = Message.class),
@ApiResponse(code = 409, message = "Concurrent modification error", response = Message.class),
@ApiResponse(code = 412, message = "Food name already exists", response = Message.class),
@ApiResponse(code = 500, message = "An unexpected error occured.", response = Message.class) })
@RequestMapping(value = "/foods/{foodId}",
produces = { "application/json" },
method = RequestMethod.PUT)
@CrossOrigin
ResponseEntity<Message> foodsFoodIdPut(@ApiParam(value = "",required=true ) @PathVariable("foodId") Long foodId,
@ApiParam(value = "The food to be updated" ,required=true ) @Valid @RequestBody EditedFood food,
@ApiParam(value = "") @RequestParam(value = "clone", required = false) Boolean clone)throws ApiException, Exception;
示例11: foodsGet
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "Gets all foods, optionally return stats per food", notes = "Return a list of all foods", response = FoodWithStats.class, responseContainer = "List", authorizations = {
@Authorization(value = "Bearer")
}, tags={ "chef", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "A list of foods", response = FoodWithStats.class),
@ApiResponse(code = 500, message = "An unexpected error occured.", response = FoodWithStats.class) })
@RequestMapping(value = "/foods",
produces = { "application/json" },
method = RequestMethod.GET)
@CrossOrigin
ResponseEntity<FoodsPage> foodsGet( @ApiParam(value = "") @RequestParam(value = "stats", required = false) Boolean stats,
@ApiParam(value = "Request pagination page") @RequestParam(value = "page", required = false) String page,
@ApiParam(value = "Request pagination size / num of foods") @RequestParam(value = "size", required = false) String size,
@ApiParam(value = "Request foodType filter") @RequestParam(value = "foodType", required = false) String foodType,
@ApiParam(value = "Request archived filter") @RequestParam(value = "archived", required = false) String archived,
@ApiParam(value = "Request orderBy filter") @RequestParam(value = "orderBy", required = false) String orderBy,
@ApiParam(value = "Request foods version") @RequestParam(value = "foods_version", required = false) @Valid @Digits( integer=9, fraction=0 )Integer foods_version,
@ApiParam(value = "Request orderBy filter") @RequestParam(value = "orderDirection", required = false) String orderDirection) throws ApiException, Exception;
示例12: login
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
/**
* Login post method. logs the user into the heroku server.
*
* @param name
* : the unique user id.
* @param pass
* : the user password.
*/
@CrossOrigin(origins = "*")
@RequestMapping(value = "/User/Login", method = RequestMethod.POST, produces = "application/json")
@ResponseBody
public void login(@RequestParam("name") String name, @RequestParam("pass") String pass) {
System.out.println("Login.POST: name:" + name + "pass:" + pass);
if (name != null)
if (!"".equals(name)) {
if (login.userLogin(name, pass))
setUserData(login.getUserName(), login.getCarNumber(), login.getEmail(), login.getPhoneNumber(),
login.getSticker());
} else {
System.out.println("Logging out");
setUserData("", "", "", "", StickersColor.WHITE);
lastRegVal = "";
detailsChanged = false;
}
}
示例13: dailyMenusIdPut
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "Put Food/Foods in a dailyMenu", notes = "", response = LastEdit.class, authorizations = {
@Authorization(value = "Bearer")
}, tags={ "chef", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "daily menu updated ok", response = LastEdit.class),
@ApiResponse(code = 204, message = "daily Menu deleted", response = LastEdit.class),
@ApiResponse(code = 400, message = "Bad Request for daily menu", response = LastEdit.class),
@ApiResponse(code = 404, message = "daily menu not found", response = LastEdit.class),
@ApiResponse(code = 409, message = "Concurrent modification error", response = LastEdit.class),
@ApiResponse(code = 412, message = "can't modify menus older than yesterday", response = LastEdit.class),
@ApiResponse(code = 417, message = "The request is failed because there are orders on the food", response = LastEdit.class),
@ApiResponse(code = 500, message = "An unexpected error occured.", response = LastEdit.class) })
@RequestMapping(value = "/dailyMenus/{id}",
produces = { "application/json" },
method = RequestMethod.PUT)
@CrossOrigin
ResponseEntity<Object> dailyMenusIdPut(@ApiParam(value = "",required=true ) @PathVariable("id") String id,
@ApiParam(value = "The daily menu to be updated" ,required=true ) @RequestBody DailyMenuEdit dailyMenu) throws ApiException;
示例14: ordersIdGet
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "Modifies order for the specified day", notes = "Modify the order", response = DailyOrder.class, authorizations = {
@Authorization(value = "Bearer")
}, tags={ "hungry", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Order succesfully retrieved", response = DailyOrder.class),
@ApiResponse(code = 404, message = "Order not found", response = DailyOrder.class),
@ApiResponse(code = 410, message = "Concurrent Order Deletion", response = DailyOrder.class),
@ApiResponse(code = 500, message = "An unexpected error occured.", response = DailyOrder.class) })
@RequestMapping(value = "/orders/{id}",
produces = { "application/json" },
method = RequestMethod.GET)
@CrossOrigin
ResponseEntity<DailyOrder> ordersIdGet(@ApiParam(value = "",required=true ) @PathVariable("id") Long id,
@NotNull @ApiParam(value = "", required = true) @RequestParam(value = "dailyMenuId", required = true) Long dailyMenuId,
@NotNull @ApiParam(value = "", required = true) @RequestParam(value = "dailyMenuVersion", required = true) int dailyMenuVersion,
@NotNull @ApiParam(value = "", required = true) @RequestParam(value = "dailyMenuDate", required = true) LocalDate dailyMenuDate,@ApiParam(value = "") @RequestParam(value = "userid", required = false) Long userid) throws ApiException;
示例15: found
import org.springframework.web.bind.annotation.CrossOrigin; //导入依赖的package包/类
@ApiOperation(value = "Modifies order for the specified day", notes = "Modify the order", response = OrderUpdate.class, authorizations = {
@Authorization(value = "Bearer")
}, tags={ "hungry", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Order succesfully modified", response = OrderUpdate.class),
@ApiResponse(code = 304, message = "Unmodified data", response = Void.class),
@ApiResponse(code = 400, message = "Order couldn't be modified.", response = Void.class),
@ApiResponse(code = 402, message = "Not enough balance.", response = Void.class),
@ApiResponse(code = 404, message = "Order not found (id)", response = Void.class),
@ApiResponse(code = 409, message = "Concurrent modification error", response = DailyOrder.class),
@ApiResponse(code = 410, message = "Concurrent Order Deletion", response = ConcurrentOrderDeletion.class),
@ApiResponse(code = 412, message = "Deadline for orders passed", response = Void.class),
@ApiResponse(code = 500, message = "An unexpected error occured.", response = Error.class) })
@RequestMapping(value = "/orders/{id}",
produces = { "application/json" },
method = RequestMethod.PUT)
@CrossOrigin
ResponseEntity<Object> ordersIdPut(@ApiParam(value = "",required=true ) @PathVariable("id") Long id,@ApiParam(value = "") @RequestParam(value = "userid", required = false) Long userid,
@ApiParam(value = "The order items to modify" ) @RequestBody UpdateOrderItems updateOrderItems, Errors errors) throws ApiException;