當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。