本文整理匯總了Java中javax.ws.rs.core.MediaType.TEXT_PLAIN屬性的典型用法代碼示例。如果您正苦於以下問題:Java MediaType.TEXT_PLAIN屬性的具體用法?Java MediaType.TEXT_PLAIN怎麽用?Java MediaType.TEXT_PLAIN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.ws.rs.core.MediaType
的用法示例。
在下文中一共展示了MediaType.TEXT_PLAIN屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: r3
@RolesAllowed("R3")
@GET
@Path("r3")
@Produces(MediaType.TEXT_PLAIN)
public String r3() {
return "r3";
}
示例2: removefromcart
@GET
@Path("/removefromcart/{itemtype}/{itemmake}/{itemmodel}/{userid}")
@Produces(MediaType.TEXT_XML)
@Consumes(MediaType.TEXT_PLAIN)
public String removefromcart(@PathParam("itemtype") String itemType, @PathParam("itemmake") String itemMake,
@PathParam("itemmodel") String itemModel, @PathParam("userid") String userID) {
int itemafter=0;
String messageToUser="Item removed from cart";
String userResponse="<?xml version='1.0' encoding='UTF-8'?>"+"<result>"+"<messagetouser>";
customerHandle=Singleton.getCustomerhandle(userID); //get customer handle
itemafter=customerHandle.removeItemFromMyCart(itemType,itemMake,itemModel); //remove item customer cart
return userResponse+messageToUser+"</messagetouser><totalitem>"+String.valueOf(itemafter)+"</totalitem></result>";
}
示例3: createSeeder
/**
* Requests a seeder for the designated file
* @return seeder info
**/
@GET
@Path("createseeder/{filename}")
@Produces(MediaType.TEXT_PLAIN)
public String createSeeder(@PathParam("filename") String filename) {
boolean creationSuccess = false;
// Retry policy for RPC communications
int retries = 0;
while (true) {
try (com.zeroc.Ice.Communicator communicator = com.zeroc.Ice.Util.initialize()) {
String iceHost = "SeederRequest:default -h " + host;
RequestableIPrx create = RequestableIPrx.checkedCast(communicator.stringToProxy(iceHost));
creationSuccess = create.requestSeeder(filename);
break;
} catch (Exception e) {
if (++retries == MAX_RETRIES) { return "Error: Try again later"; }
}
retries++;
}
// TODO: Deregister video on failure, means there's no server nor peer sources
return (creationSuccess) ? "Creation success."
: null;
}
示例4: nobody
@GET
@Path("/nobody")
@Produces(MediaType.TEXT_PLAIN)
@DenyAll()
public String nobody() {
return "nobody";
}
示例5: post
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON})
public List<String> post(@Context HttpServletRequest request)
throws IOException, OryxServingException {
List<String> result = new ArrayList<>();
for (Part item : parseMultipart(request)) {
try (BufferedReader reader = maybeBuffer(maybeDecompress(item))) {
result.addAll(doPost(reader));
}
}
return result;
}
示例6: regenerateToken
@Path("/regeneratetoken")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
public String regenerateToken(String JSONRequest, @Context ServletContext context) {
JSONObject json = new JSONObject(JSONRequest);
DatabaseOperations databaseOps = (DatabaseOperations) context.getAttribute("databaseOps");
String out = databaseOps.resetToken(json.getString("github_id"));
return out;
}
示例7: hasPendingChanges
@POST
@Path("{serviceName}/hasOfflinePendingChanges")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.TEXT_PLAIN})
public Response hasPendingChanges(
@PathParam("serviceName") String serviceName) {
return Response.ok(offlineModeService.hasOfflinePendingChanges(serviceName)).build();
}
示例8: updateResourceTemplate
@PUT
@Path("/{jvmName}/resources/template/{resourceTemplateName}")
@Consumes(MediaType.TEXT_PLAIN)
// TODO: Pass authenticated user.
Response updateResourceTemplate(@PathParam("jvmName") final String jvmName,
@PathParam("resourceTemplateName") final String resourceTemplateName,
final String content);
示例9: admin
@GET
@Path("/admin")
@Produces(MediaType.TEXT_PLAIN)
@RolesAllowed("admin")
public String admin() {
return "admin";
}
示例10: get
@GET
@Path("/{verseId}")
@Produces(MediaType.TEXT_PLAIN + ";charset=utf-8")
public String get(@PathParam("bibleId") String bibleId, @PathParam("bookId") String bookId, @PathParam("chapterId") String chapterId, @PathParam("chapterId") String verseId) {
StringBuilder response = new StringBuilder();
BibleDTO bibleDTO = bibleCsvRepository.findBible(bibleId);
BookDTO bookDTO = bibleCsvRepository.findBook(bibleDTO, bookId);
ChapterDTO chapterDTO = bookDTO.getChapter(Integer.parseInt(chapterId));
VerseDTO verseDTO = chapterDTO.getVerse(Integer.parseInt(chapterId));
response.append(verseDTO.toString());
return response.toString();
}
示例11: validModelExists
@GET
@Path(VALID_MODEL_EXISTS + "/{appName}")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
public Response validModelExists(@PathParam("appName") final String appName) {
Boolean returnValue = modelInitializerService.isValidModelForAppExists(appName);
return Response.ok(returnValue).build();
}
示例12: promoteUser
@PUT
@Path("/user/promote")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_PLAIN)
public Response promoteUser(String username) {
AdminDaoImpl ad = new AdminDaoImpl();
if(ad.promoteUserToWriter(username)) {
return Response.status(200).build();
}
return Response.status(200).build();
}
示例13: operationName
/**
* Traced with an explicit operation name.
* @return OK response
*/
@Traced(operationName = REST_OPERATION_NAME)
@GET
@Path(REST_OPERATION_NAME)
@Produces(MediaType.TEXT_PLAIN)
public Response operationName() {
return Response.ok().build();
}
示例14: nested
/**
* Web service call that calls itself {@code nestDepth} - 1 times.
*
* A nesting depth of zero (0) causes an immediate return.
*
* A nesting depth greater than zero causes a call to the nesting service
* with the depth reduced by one (1).
*
* The {@code nestBreadth} controls how many concurrent, nested calls are
* made on the first level of nesting.
*
* @param nestDepth The depth of nesting to use when implementing the request.
* @param nestBreadth The breadth of nested calls.
* @param uniqueID Unique ID propagated down nested calls.
* @param failNest True if nested response should be an error
* @param async Whether the nested request is executed asynchronously.
* @return OK response
* @throws ExecutionException Error executing nested web service.
* @throws InterruptedException Error executing nested web service.
*/
@GET
@Path(REST_NESTED)
@Produces(MediaType.TEXT_PLAIN)
public Response nested(@QueryParam(PARAM_NEST_DEPTH) int nestDepth,
@QueryParam(PARAM_NEST_BREADTH) int nestBreadth,
@QueryParam(PARAM_UNIQUE_ID) String uniqueID,
@QueryParam(PARAM_FAIL_NEST) boolean failNest,
@QueryParam(PARAM_ASYNC) boolean async)
throws InterruptedException, ExecutionException {
if (nestDepth > 0) {
Map<String, Object> nestParameters = new HashMap<String, Object>();
String target;
if (failNest) {
target = REST_ERROR;
}
else {
target = REST_NESTED;
nestParameters.put(PARAM_NEST_DEPTH, nestDepth - 1);
nestParameters.put(PARAM_NEST_BREADTH, 1);
nestParameters.put(PARAM_UNIQUE_ID, uniqueID);
nestParameters.put(PARAM_FAIL_NEST, false);
nestParameters.put(PARAM_ASYNC, false);
}
String requestUrl = getRequestPath(
REST_TEST_SERVICE_PATH, target, nestParameters);
List<Future<Response>> futures = new ArrayList<>();
for (int i = 0; i < nestBreadth; i++) {
if (async) {
futures.add(executeNestedAsync(requestUrl));
}
else {
executeNested(requestUrl);
}
}
for (Future<Response> future : futures) {
future.get().close();
}
}
return Response.ok().build();
}
示例15: remove
@DELETE
@Path("/{id}")
@Produces(MediaType.TEXT_PLAIN)
public String remove(@FormParam("id") int id) {
return "remove id:" + id;
}