• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Viewable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.jersey.api.view.Viewable的典型用法代码示例。如果您正苦于以下问题:Java Viewable类的具体用法?Java Viewable怎么用?Java Viewable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Viewable类属于com.sun.jersey.api.view包,在下文中一共展示了Viewable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkStatus

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
/**
 * Checks the given plan's execution status.
 * 
 * @param planId
 *            plan id
 * @return 200 OK forwarding the request to jsp, or 404 NOT FOUND if the matching plan could not be found
 */
@GET
@Path("request/{planId}")
public Response checkStatus(@PathParam("planId") String planId) {

    DeliveryPlan plan = deliveryPlanManager.getDeliveryPlan(planId);

    if (plan == null) {
        return Response.status(Status.NOT_FOUND).build();
    }

    if (plan.getStatus() == DeliveryPlanStatus.COMPLETED) {
        return Response.seeOther(URI.create(plan.getDelivery().getClientLocation())).build();
    }

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("status", plan.getStatus());
    params.put("url", uriInfo.getAbsolutePath());
    return Response.ok(new Viewable(STATUS_PATH, params)).build();
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:27,代码来源:DeliveryService.java


示例2: sign

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@POST
@Path("/sign")
@Produces(MediaType.TEXT_HTML)
public Response sign(
		@Context HttpServletRequest request,
		@FormParam("guestbookName") @DefaultValue("default") String guestbookName,
		@FormParam("content") String content) {
	UserService userService = UserServiceFactory.getUserService();
	User user = userService.getCurrentUser();

	Key guestbookKey = KeyFactory.createKey("Guestbook", guestbookName);
	Entity greeting = new Entity("Greeting", guestbookKey);
	greeting.setProperty("user", user);
	greeting.setProperty("date", new Date());
	greeting.setProperty("content", content);

	DatastoreService datastore = DatastoreServiceFactory
			.getDatastoreService();
	datastore.put(greeting);

	Map<String, Object> model = buildModel(request, guestbookName);
	return Response.ok(new Viewable("/guestbook", model)).build();
}
 
开发者ID:gconcon,项目名称:appengine-guestbookwithguice-java,代码行数:24,代码来源:GuestbookResource.java


示例3: statusDetail

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
@Path("{crawler}/status")
public Viewable statusDetail(@PathParam("crawler") String crawlerName, @Context HttpServletRequest request,
		@Context HttpServletResponse response, @QueryParam("mode") String mode, @QueryParam("status") String status) throws Exception {
	ProcessorController processorController = factory.getCrawler(crawlerName);
	if (CrosslinksServletFilter.isAdministrator(request)) {
		if ("PAUSED".equalsIgnoreCase(status)) {
			processorController.pause();
		}
		if (mode != null) {
			processorController.setMode(mode);
		}
	}
	request.setAttribute("crawler", processorController);
	if (processorController.getIterable() instanceof Affiliated) {
		request.setAttribute("affiliation", ((Affiliated)processorController.getIterable()).getAffiliation());			
	}
	return new Viewable("/jsps/statusDetail.jsp", null);
}
 
开发者ID:CTSIatUCSF,项目名称:Crosslinks,代码行数:20,代码来源:FusekiRestMethods.java


示例4: getResearchers

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
  @Path("{affiliation}/researchers")
  public Viewable getResearchers(@PathParam("affiliation") String affiliationStr, @Context HttpServletRequest request,
	@Context HttpServletResponse response, @QueryParam("clearCache") String clearCache) throws Exception {
  	Affiliation affiliation = getAffiliation(affiliationStr);
request.setAttribute("affiliation", affiliation);
if ("true".equalsIgnoreCase(clearCache)) {
	request.getSession().removeAttribute(affiliation.getName() + "reseachers");
}
@SuppressWarnings("unchecked")
List<Researcher> researchers = (List<Researcher>)request.getSession().getAttribute(affiliation.getName() + "reseachers");
if (researchers == null) {
	researchers = getResearchers(affiliation);
	request.getSession().setAttribute(affiliation.getName() + "reseachers", researchers);
}

request.setAttribute("researchers", researchers);
return new Viewable("/jsps/researchers.jsp", null);
  }
 
开发者ID:CTSIatUCSF,项目名称:Crosslinks,代码行数:20,代码来源:FusekiRestMethods.java


示例5: getMappingsHtml

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
@Produces(MediaType.TEXT_HTML)
public Viewable getMappingsHtml(@Context ServletContext context) {
	Config config = null;
	try {
		// Load config.xml from WEB-INF
		config = JAXB.unmarshal(
				context.getResourceAsStream("/WEB-INF/config.xml"),
				Config.class);
	} catch (Exception e) {
		throw new WebApplicationException(Response.serverError()
				.entity("Error reading configuration file").build());
	}

	return new Viewable("/mappings", config);
}
 
开发者ID:GeoViQua,项目名称:wms-q-facade,代码行数:17,代码来源:ConfigResource.java


示例6: putUser

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@PUT
@Path(SLASH_USERNAME)
public Viewable putUser(@PathParam(USERNAME) String username, @FormParam(REALNAME) String realname, @FormParam(EMAIL) String emailAddress, @FormParam(ENABLED) String enabled,
		@FormParam(EXTERNAL_REF_ID) String externalRefId, @FormParam(MAX_INSTANCES) String maxInstancesStr, @FormParam(MAX_CORES) String maxCoresStr) {
	LOG.info(String.format("Updating a new user: username %s, real name %s, email %s, enabled %s, external ref id %s, maxInstances %s, maxCores %s", username, realname, emailAddress, enabled,
			externalRefId, maxInstancesStr, maxCoresStr));
	Boolean isEnabled = null;

	if (!StringUtils.isEmpty(enabled))
		isEnabled = validateAndGetEnabledBoolean(enabled);

	Integer maxInstances = validateAndGetMaxInstances(maxInstancesStr);
	Integer maxCores = validateAndGetMaxCores(maxCoresStr);
	try {
		userManagementService.updateUser(username, realname, emailAddress, isEnabled, externalRefId, maxInstances, maxCores);
	} catch (UserNotFoundException ex) {
		throw new NotFoundException("");
	}

	return getViewable(getUser(username));
}
 
开发者ID:barnyard,项目名称:pi,代码行数:22,代码来源:UsersController.java


示例7: postUserShouldCreateAUser

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void postUserShouldCreateAUser() {
	// act
	Viewable viewable = (Viewable) usersController.postUser(USERNAME, REALNAME, EMAIL, TRUE, EXTERNAL_REF, Integer.toString(MAX_INSTANCES), Integer.toString(MAX_CORES)).getEntity();

	// assert
	assertNotNull(viewable);
	assertNotNull(viewable.getModel());
	Map model = (Map<String, Object>) viewable.getModel();
	assertEquals(readOnlyUser, model.get("user"));
	assertEquals(INSTANCE_ID, ((Set<String>) model.get("instanceIds")).iterator().next());
	assertEquals(setOfStrings, model.get("imageIds"));
	assertEquals(setOfStrings, model.get("securityGroupIds"));
	assertEquals(setOfStrings, model.get("volumeIds"));
	assertEquals(MAX_INSTANCES, model.get("maxInstances"));
	assertEquals(MAX_CORES, model.get("maxCores"));
	assertEquals("single_user", viewable.getTemplateName());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:19,代码来源:UsersControllerTest.java


示例8: postUserShouldCreateADisabledUser

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void postUserShouldCreateADisabledUser() {
	// act
	Viewable viewable = (Viewable) usersController.postUser(USERNAME, REALNAME, EMAIL, "", EXTERNAL_REF, Integer.toString(MAX_INSTANCES), Integer.toString(MAX_CORES)).getEntity();

	// assert
	assertNotNull(viewable);
	assertNotNull(viewable.getModel());
	Map model = (Map<String, Object>) viewable.getModel();
	assertEquals(readOnlyUser, model.get("user"));
	assertEquals(INSTANCE_ID, ((Set<String>) model.get("instanceIds")).iterator().next());
	assertEquals(setOfStrings, model.get("imageIds"));
	assertEquals(setOfStrings, model.get("securityGroupIds"));
	assertEquals(setOfStrings, model.get("volumeIds"));
	assertEquals(MAX_INSTANCES, model.get("maxInstances"));
	assertEquals("single_user", viewable.getTemplateName());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:18,代码来源:UsersControllerTest.java


示例9: postUserShouldDefaultUserDisablesWhenNoEnabledFlagSet

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void postUserShouldDefaultUserDisablesWhenNoEnabledFlagSet() {
	// act
	Viewable viewable = (Viewable) usersController.postUser(USERNAME, REALNAME, EMAIL, null, EXTERNAL_REF, Integer.toString(MAX_INSTANCES), Integer.toString(MAX_CORES)).getEntity();

	// assert
	assertNotNull(viewable);
	assertNotNull(viewable.getModel());
	Map model = (Map<String, Object>) viewable.getModel();
	assertEquals(readOnlyUser, model.get("user"));
	assertEquals(INSTANCE_ID, ((Set<String>) model.get("instanceIds")).iterator().next());
	assertEquals(setOfStrings, model.get("imageIds"));
	assertEquals(setOfStrings, model.get("securityGroupIds"));
	assertEquals(setOfStrings, model.get("volumeIds"));
	assertEquals(MAX_INSTANCES, model.get("maxInstances"));
	assertEquals("single_user", viewable.getTemplateName());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:18,代码来源:UsersControllerTest.java


示例10: postUserShouldStillWorkWhenNoExternalRefProvided

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void postUserShouldStillWorkWhenNoExternalRefProvided() {
	// act
	Viewable viewable = (Viewable) usersController.postUser(USERNAME, REALNAME, EMAIL, TRUE, null, Integer.toString(MAX_INSTANCES), Integer.toString(MAX_CORES)).getEntity();

	// assert
	assertNotNull(viewable);
	assertNotNull(viewable.getModel());
	Map model = (Map<String, Object>) viewable.getModel();
	assertEquals(readOnlyUser, model.get("user"));
	assertEquals(INSTANCE_ID, ((Set<String>) model.get("instanceIds")).iterator().next());
	assertEquals(setOfStrings, model.get("imageIds"));
	assertEquals(setOfStrings, model.get("securityGroupIds"));
	assertEquals(setOfStrings, model.get("volumeIds"));
	assertEquals(MAX_INSTANCES, model.get("maxInstances"));
	assertEquals("single_user", viewable.getTemplateName());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:18,代码来源:UsersControllerTest.java


示例11: gettingUserAsHtmlShouldReturnAViewableWithTheRightTemplateAndModelPopulated

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void gettingUserAsHtmlShouldReturnAViewableWithTheRightTemplateAndModelPopulated() {
	// act
	Viewable viewable = usersController.getUserHtml(USERNAME);

	// assert
	assertNotNull(viewable);
	assertNotNull(viewable.getModel());
	Map model = (Map<String, Object>) viewable.getModel();
	assertEquals(readOnlyUser, model.get("user"));
	assertEquals(INSTANCE_ID, ((Set<String>) model.get("instanceIds")).iterator().next());
	assertEquals(setOfStrings, model.get("imageIds"));
	assertEquals(setOfStrings, model.get("securityGroupIds"));
	assertEquals(setOfStrings, model.get("volumeIds"));
	assertEquals(MAX_INSTANCES, model.get("maxInstances"));
	assertEquals("single_user", viewable.getTemplateName());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:18,代码来源:UsersControllerTest.java


示例12: puttingAUserShouldAlterTheUser

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void puttingAUserShouldAlterTheUser() {
	// act
	Viewable viewable = usersController.putUser(USERNAME, REALNAME, EMAIL, TRUE, EXTERNAL_REF, Integer.toString(MAX_INSTANCES), Integer.toString(MAX_CORES));

	// assert
	verify(userManagementService).updateUser(USERNAME, REALNAME, EMAIL, true, EXTERNAL_REF, MAX_INSTANCES, MAX_CORES);
	assertNotNull(viewable);
	assertNotNull(viewable.getModel());
	Map model = (Map<String, Object>) viewable.getModel();
	assertEquals(readOnlyUser, model.get("user"));
	assertEquals(INSTANCE_ID, ((Set<String>) model.get("instanceIds")).iterator().next());
	assertEquals(setOfStrings, model.get("imageIds"));
	assertEquals(setOfStrings, model.get("securityGroupIds"));
	assertEquals(setOfStrings, model.get("volumeIds"));
	assertEquals(MAX_INSTANCES, model.get("maxInstances"));
	assertEquals("single_user", viewable.getTemplateName());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:19,代码来源:UsersControllerTest.java


示例13: gettingUserByAccessKeyAsHtmlShouldReturnAViewableWithTheRightTemplateAndModelPopulated

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void gettingUserByAccessKeyAsHtmlShouldReturnAViewableWithTheRightTemplateAndModelPopulated() {
	// act
	Viewable viewable = usersController.getUserByApiAccessKeyHtml(ACCESS_KEY);

	// assert
	assertNotNull(viewable);
	assertNotNull(viewable.getModel());
	Map model = (Map<String, Object>) viewable.getModel();
	assertEquals(readOnlyUser, model.get("user"));
	assertEquals(INSTANCE_ID, ((Set<String>) model.get("instanceIds")).iterator().next());
	assertEquals(setOfStrings, model.get("imageIds"));
	assertEquals(setOfStrings, model.get("securityGroupIds"));
	assertEquals(setOfStrings, model.get("volumeIds"));
	assertEquals(MAX_INSTANCES, model.get("maxInstances"));
	assertEquals("single_user", viewable.getTemplateName());
}
 
开发者ID:barnyard,项目名称:pi,代码行数:18,代码来源:UsersControllerTest.java


示例14: shouldReturnInstanceValidationAddresss

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@Test
public void shouldReturnInstanceValidationAddresss() {
	// setup
	PId pid = mock(PId.class);
	when(piIdBuilder.getPId("user:" + USERNAME)).thenReturn(pid);
	String pidString = "123456";
	when(pid.toStringFull()).thenReturn(pidString);
	String dnsName = "ops.com";
	usersController.setOpsWebsiteDnsName(dnsName);

	// act
	Viewable result = usersController.getInstanceValidationAddress(USERNAME);

	// assert
	assertNotNull(result);
	assertNotNull(result.getModel());
	Map model = (Map<String, Object>) result.getModel();
	assertEquals(USERNAME, model.get("username"));
	assertEquals(pidString, model.get("pid"));
	assertEquals(dnsName, model.get("ops_website_dns_name"));
}
 
开发者ID:barnyard,项目名称:pi,代码行数:22,代码来源:UsersControllerTest.java


示例15: showIndex

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET()
public Viewable showIndex() {
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("ajax_base", adminContainerConfig.ajaxDataResourceContext());
    model.put("template_base", adminContainerConfig.templateResourceContext());

    if (adminPageRegistry != null) {
        final Collection<AdminPageInfo> adminPages = adminPageRegistry.getAllPages();
        model.put("adminPages", adminPages);
    }
    if (adminContainerConfig != null) {
        model.put("homeScriptResources", adminContainerConfig.homeScriptResources());
    }

    return new Viewable("/webadmin/home.ftl", model, adminContainerConfig.getClass());
}
 
开发者ID:Netflix,项目名称:karyon,代码行数:17,代码来源:AdminPageResource.java


示例16: showViewIndex

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
  @Path("/{view}")
  public Viewable showViewIndex(
          @PathParam("view") String view,
          @QueryParam("id") @DefaultValue("") String id
  ) {
      LOG.info(view);
      Map<String, Object> model = new HashMap<String, Object>();
      model.put("id", id);
      model.put("ajax_base", adminContainerConfig.ajaxDataResourceContext());
      model.put("template_base", adminContainerConfig.templateResourceContext());

if (adminPageRegistry != null && adminPageRegistry.getPageInfo(view) != null) {
       AdminPageInfo pageInfo = adminPageRegistry.getPageInfo(view);
          final Map<String, Object> pageDataModel = pageInfo.getDataModel();
          if (pageDataModel != null) {
              model.putAll(pageDataModel);
          }
          return new Viewable(pageInfo.getPageTemplate(), model, pageInfo.getClass());
      }
      throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
 
开发者ID:Netflix,项目名称:karyon,代码行数:23,代码来源:AdminPageResource.java


示例17: view

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
@Produces("application/javascript")
public Viewable view(@QueryParam("excludeCountries") String excludeCountries, @Context HttpServletRequest req) {
    Map<String, Object> it = Maps.newHashMap();
    String[] excludeCountriesArray = new String[0];
    if (excludeCountries != null) {
        excludeCountriesArray = excludeCountries.split(",");
    }
    String country = getCountryCode(req);
    it.put("country", country);
    it.put("isEu", isEU(req));
    it.put("showBanner", isEU(req) && !ArrayUtils.contains(excludeCountriesArray, country));
    return new Viewable("/banner", it);
}
 
开发者ID:mattburns,项目名称:EuVatBanner,代码行数:15,代码来源:Banner.java


示例18: view

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
@Produces("application/javascript")
public Viewable view(@QueryParam("excludeCountries") String excludeCountries, @Context HttpServletRequest req) {
    Map<String, Object> it = Maps.newHashMap();
    it.put("excludeCountries", excludeCountries);
    return new Viewable("/test", it);
}
 
开发者ID:mattburns,项目名称:EuVatBanner,代码行数:8,代码来源:Test.java


示例19: sayHello

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
@Produces(MediaType.TEXT_HTML)
public Response sayHello(
		@Context HttpServletRequest request,
		@QueryParam("guestbookName") @DefaultValue("default") String guestbookName) {
	Map<String, Object> model = buildModel(request, guestbookName);
	return Response.ok(new Viewable("/guestbook", model)).build();
}
 
开发者ID:gconcon,项目名称:appengine-guestbookwithguice-java,代码行数:9,代码来源:GuestbookResource.java


示例20: index

import com.sun.jersey.api.view.Viewable; //导入依赖的package包/类
@GET
@Path("/index")
public Viewable index(@Context HttpServletRequest request,
		@Context HttpServletResponse response) throws Exception {
	request.setAttribute("affiliations", getAffiliations());
	return new Viewable("/jsps/index.jsp", null);
}
 
开发者ID:CTSIatUCSF,项目名称:Crosslinks,代码行数:8,代码来源:FusekiRestMethods.java



注:本文中的com.sun.jersey.api.view.Viewable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CountingQuietWriter类代码示例发布时间:2022-05-22
下一篇:
Java IOIO类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap