本文整理汇总了Java中javax.ws.rs.core.MediaType.TEXT_HTML属性的典型用法代码示例。如果您正苦于以下问题:Java MediaType.TEXT_HTML属性的具体用法?Java MediaType.TEXT_HTML怎么用?Java MediaType.TEXT_HTML使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.ws.rs.core.MediaType
的用法示例。
在下文中一共展示了MediaType.TEXT_HTML属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWaypointAsHtml
@GET
@Path("waypoints/{waypointId}")
@Produces({ MediaType.TEXT_HTML })
public Response getWaypointAsHtml(
@PathParam("serviceProviderId") final String serviceProviderId, @PathParam("waypointId") final String waypointId
) throws ServletException, IOException, URISyntaxException
{
// Start of user code getWaypointAsHtml_init
// End of user code
final Waypoint aWaypoint = WarehouseControllerManager.getWaypoint(httpServletRequest, serviceProviderId, waypointId);
if (aWaypoint != null) {
httpServletRequest.setAttribute("aWaypoint", aWaypoint);
// Start of user code getWaypointAsHtml_setAttributes
// End of user code
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/waypoint.jsp");
rd.forward(httpServletRequest,httpServletResponse);
}
throw new WebApplicationException(Status.NOT_FOUND);
}
示例2: getResourceShapeAsHtml
@GET
@Path("{resourceShapePath}")
@Produces({ MediaType.TEXT_HTML })
public Response getResourceShapeAsHtml(
@PathParam("resourceShapePath") final String resourceShapePath
) throws ServletException, IOException, URISyntaxException, OslcCoreApplicationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
{
final Class<?> resourceClass = Application.getResourceShapePathToResourceClassMap().get(resourceShapePath);
ResourceShape aResourceShape = null;
if (resourceClass != null)
{
aResourceShape = (ResourceShape) resourceClass.getMethod("createResourceShape").invoke(null);
httpServletRequest.setAttribute("aResourceShape", aResourceShape);
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/resourceshape.jsp");
rd.forward(httpServletRequest,httpServletResponse);
}
throw new WebApplicationException(Status.NOT_FOUND);
}
示例3: prepareData
/**
* Initialize data for next bench tests.
*
* @param blob
* the BLOB file to attach.
* @param nb
* the amount of data to persist.
* @return the the bench result. The return type is text/html for IE7 support.
*/
@POST
@Produces(MediaType.TEXT_HTML)
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED, MediaType.MULTIPART_FORM_DATA })
public String prepareData(@Multipart(value = "blob", required = false) final InputStream blob, @Multipart("nb") final int nb) throws IOException {
final long start = System.currentTimeMillis();
final byte[] lobData = blob == null ? new byte[0] : IOUtils.toByteArray(blob);
log.info("Content size :" + lobData.length);
final BenchResult result = jpaDao.initialize(nb, lobData);
result.setDuration(System.currentTimeMillis() - start);
return new org.ligoj.bootstrap.core.json.ObjectMapperTrim().writeValueAsString(result);
}
示例4: view
@GET
@Path("view")
@Produces({MediaType.TEXT_HTML})
public ItemsView view(@Context javax.ws.rs.core.UriInfo info,
@QueryParam("offset") @DefaultValue("-1") IntParam _offset, @DefaultValue("-1") @QueryParam("limit") IntParam _limit){
int offset = _offset.get();
int limit = _limit.get();
if (offset == -1 || limit == -1) {
offset = offset == -1 ? 0 : offset;
limit = limit == -1 ? 10 : limit;
throw new WebApplicationException(
Response.seeOther(info.getRequestUriBuilder().queryParam("offset", offset)
.queryParam("limit", limit).build())
.build()
);
}
ItemsRepresentation representation = new ItemsRepresentation(itemsModel, offset, limit);
// render the view
return new ItemsView(representation);
}
示例5: getPlanAsHtml
@GET
@Path("{planId}")
@Produces({ MediaType.TEXT_HTML })
public Response getPlanAsHtml(
@PathParam("serviceProviderId") final String serviceProviderId, @PathParam("planId") final String planId
) throws ServletException, IOException, URISyntaxException
{
// Start of user code getPlanAsHtml_init
// End of user code
final Plan aPlan = PlannerReasonerManager.getPlan(httpServletRequest, serviceProviderId, planId);
if (aPlan != null) {
httpServletRequest.setAttribute("aPlan", aPlan);
// Start of user code getPlanAsHtml_setAttributes
// End of user code
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/plan.jsp");
rd.forward(httpServletRequest,httpServletResponse);
}
throw new WebApplicationException(Status.NOT_FOUND);
}
示例6: getHtmlServiceProvider
/**
* HTML representation of a single OSLC Service Provider
*
* Forwards to serviceprovider_html.jsp to create the html document
*
* @param serviceProviderId
*/
@GET
@Path("{serviceProviderId}")
@Produces(MediaType.TEXT_HTML)
public void getHtmlServiceProvider(@PathParam("serviceProviderId") final String serviceProviderId)
{
ServiceProvider serviceProvider = ServiceProviderCatalogSingleton.getServiceProvider(httpServletRequest, serviceProviderId);
Service [] services = serviceProvider.getServices();
httpServletRequest.setAttribute("serviceProvider", serviceProvider);
httpServletRequest.setAttribute("services", services);
// Start of user code getHtmlServiceProvider_setAttributes
// End of user code
RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/serviceprovider.jsp");
try {
rd.forward(httpServletRequest, httpServletResponse);
} catch (Exception e) {
e.printStackTrace();
throw new WebApplicationException(e);
}
}
示例7: submitQuery
@POST
@Path("/query")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_HTML)
public Viewable submitQuery(@FormParam("query") String query, @FormParam("queryType") String queryType) throws Exception {
try {
String trimmedQueryString = CharMatcher.is(';').trimTrailingFrom(query.trim());
final QueryWrapper.QueryResult result = submitQueryJSON(new QueryWrapper(trimmedQueryString, queryType));
return new Viewable("/rest/query/result.ftl", new TabularResult(result));
} catch(Exception | Error e) {
logger.error("Query from Web UI Failed", e);
return new Viewable("/rest/query/errorMessage.ftl", e);
}
}
示例8: urlAccessed
@GET
@Produces(MediaType.TEXT_HTML)
public String urlAccessed(@Context Request req)
{
if (Capatchafy.configs.isAuthorized(req.getRemoteAddr()) || !Capatchafy.enabled)
{
return "You are already authorized.";
}
return "<head>" +
"<script src='https://www.google.com/recaptcha/api.js'></script></head>" +
"<script>function callback(){document.getElementById(\"form\").submit();}</script>"+
"<form id=\"form\"method=\"post\">" +
"<div class=\"g-recaptcha\" data-callback=\"callback\" data-sitekey=\"" + Capatchafy.configs.getCapatchaSiteKey() + "\"></div>" +
"</form>";
}
示例9: echo
@GET
@Path("/echo")
@Produces(MediaType.TEXT_HTML)
public String echo() {
return "Hello world!";
}
示例10: getStatus
@GET
@Path("/status")
@Produces(MediaType.TEXT_HTML)
public Viewable getStatus() {
String status = "Running!";
return new Viewable("/rest/status.ftl", status);
}
示例11: get
@GET
@Path("/{query}")
@Produces(MediaType.TEXT_HTML + ";charset=utf-8")
public String get(@PathParam("query") String query) {
StringBuilder response = new StringBuilder();
for (PassageDTO passageDTO : queryParserService.process(query)) {
response.append(passageDTO.toString()).append("<br/><br/>");
}
return response.toString();
}
示例12: createPromoCode
@POST
@Path("/createPromoCode")
@Produces(MediaType.TEXT_HTML)
public String createPromoCode(@FormParam("promoCodeToken") String promoCodeToken) {
if (Config.getPromoCodeToken().equals(promoCodeToken)) {
return bo.createPromoCode();
}
return "invalid promoCodeToken";
}
示例13: lettuceAsyncTest
@GET
@Path("lettuce_async_test")
@Produces(MediaType.TEXT_HTML + ";charset=utf-8")
public String lettuceAsyncTest() {
System.out.println("TEST Lettuce async ======================================================");
RedisClient client = RedisClient.create("redis://localhost:6379/0");
RedisAsyncConnection<String, String> conn = client.connectAsync();
conn.set("foo", "bar");
conn.get("foo");
conn.lpush("lll", "a");
conn.lpush("lll", "b");
conn.lpush("lll", "c");
conn.lpop("lll");
conn.lpop("lll");
conn.lpop("lll");
conn.hset("mmm", "abc", "123");
conn.hset("mmm", "def", "456");
conn.hgetall("mmm");
conn.del("foo", "lll", "mmm");
conn.close();
client.shutdown();
return "lettuce_async_test";
}
示例14: validate
@GET
@Produces(MediaType.TEXT_HTML)
public Response validate(@QueryParam("token") String token) {
if (token == null || token.isEmpty()) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
if (AuthorizationWhitelist.validate(token)) {
return Response.ok("Aanmelden succesvol").build();
} else {
return Response.ok("Fout tijdens het aanmelden").build();
}
}
示例15: login
/**
* 登录
*
* @return
*/
@SuppressWarnings("unchecked")
@POST
@Path("login")
@Produces(MediaType.TEXT_HTML + ";charset=utf-8")
public String login(String userLoginInfoJson) {
Map<String, String> input = JSONHelper.toObject(userLoginInfoJson, Map.class);
String loginId = input.get("loginId");
String loginPwd = input.get("loginPwd");
String captcha = input.get("captcha");
CaptchaTools vcTools = new CaptchaTools();
if (!vcTools.checkVCAnswer(request.getSession(), captcha)) {
logger.info(this, "uav apphub login fail. info=验证信息错误,loginId=" + loginId);
return createResponeJson(RespCode.FAIL, "验证信息错误", "");
}
else if (loginRegister(loginId, loginPwd, request)) {
monitor.increValue(METRIC_24HOURUSERLOGIN);
monitor.flushToSystemProperties();
String ip = request.getRemoteAddr();
String xip = request.getHeader("X-Forward-For");
String userip = getClientIP(ip, xip);
Map<String, String> userInfo = new HashMap<String, String>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = sdf.format(new Date());
userInfo.put("key", "ulog");
userInfo.put("time", time);
userInfo.put("uid", loginId);
userInfo.put("uip", userip);
userInfo.put("rs", "/rs/gui/login");
userInfo.put("type", "login");
userInfo.put("url", "");
userInfo.put("desc", "登录成功");
userInfo.put("uauthemails", String.valueOf(
request.getSession(false).getAttribute("apphub.gui.session.login.user.authorize.emailList")));
userInfo.put("authsystems", String.valueOf(
request.getSession(false).getAttribute("apphub.gui.session.login.user.authorize.systems")));
logger.info(this, JSONHelper.toString(userInfo));
return createResponeJson(RespCode.SUCCESS, "", "");
}
else {
logger.info(this, "uav apphub login fail. info=账号或密码错误,loginId=" + loginId);
return createResponeJson(RespCode.FAIL, "账号或密码错误", "");
}
}