当前位置: 首页>>代码示例>>Java>>正文


Java MediaType.TEXT_HTML属性代码示例

本文整理汇总了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);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:23,代码来源:ServiceProviderService1.java

示例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);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:20,代码来源:ResourceShapeService.java

示例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);
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:20,代码来源:JpaBenchResource.java

示例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);
}
 
开发者ID:aruld,项目名称:dropwizard-pagination,代码行数:25,代码来源:ItemsResource.java

示例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);
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:23,代码来源:ServiceProviderService1.java

示例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);
    }
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:28,代码来源:ServiceProviderService.java

示例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);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:QueryResources.java

示例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>";
}
 
开发者ID:Hockeyfan360,项目名称:Capatchafy,代码行数:15,代码来源:CapatchaPage.java

示例9: echo

@GET
@Path("/echo")
@Produces(MediaType.TEXT_HTML)
public String echo() {

	return "Hello world!";
}
 
开发者ID:zandero,项目名称:rest.vertx,代码行数:7,代码来源:TestRest.java

示例10: getStatus

@GET
@Path("/status")
@Produces(MediaType.TEXT_HTML)
public Viewable getStatus() {
  String status = "Running!";
  return new Viewable("/rest/status.ftl", status);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:StatusResources.java

示例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();
}
 
开发者ID:sscholl,项目名称:biblebot,代码行数:10,代码来源:SearchEndpoint.java

示例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";
}
 
开发者ID:SoapboxRaceWorld,项目名称:soapbox-race-core,代码行数:9,代码来源:PromoCode.java

示例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";
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:29,代码来源:RedisService.java

示例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();
    }

}
 
开发者ID:CROW-NDOV,项目名称:displaydirect,代码行数:13,代码来源:AuthorizationResource.java

示例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, "账号或密码错误", "");
    }
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:51,代码来源:GUIService.java


注:本文中的javax.ws.rs.core.MediaType.TEXT_HTML属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。