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


Java ServletResponseUtil.write方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.servlet.ServletResponseUtil.write方法的典型用法代码示例。如果您正苦于以下问题:Java ServletResponseUtil.write方法的具体用法?Java ServletResponseUtil.write怎么用?Java ServletResponseUtil.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.servlet.ServletResponseUtil的用法示例。


在下文中一共展示了ServletResponseUtil.write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doServeResource

import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入方法依赖的package包/类
@Override
protected void doServeResource(ResourceRequest request, ResourceResponse response)
		throws Exception {
	String cmd = ParamUtil.getString(request, Constants.CMD);
	String serializedJson = "";
	
	if(cmd.equals(CMD_PAGELIST)) {
		serializedJson = getPageLists(request,response );
	} else {
		_log.error("Unknown command is passed <" + cmd + ">");
	}
	
	HttpServletResponse servletResponse = _portal.getHttpServletResponse(
			response);

	servletResponse.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(servletResponse, serializedJson);		
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:20,代码来源:PageMVCResourceCommand.java

示例2: doServeResource

import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入方法依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
	String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);
	String serializedJson = "";

	if (cmd.equals(CMD_ROLELIST)) {
		serializedJson = getRoleLists(resourceRequest, resourceResponse);
	} else {
		_log.error("Unknown command is passed <" + cmd + ">");
	}

	HttpServletResponse response = _portal.getHttpServletResponse(resourceResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(response, serializedJson);
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:18,代码来源:RoleMVCResourceCommand.java

示例3: doServeResource

import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入方法依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
		throws Exception {
	String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);
	String serializedJson = "";
	
	if(cmd.equals(CMD_THREAD_LIST)) {
		serializedJson = getThreadList(resourceRequest,resourceResponse );
		
	} else if (cmd.equals(CMD_CATEGORY_LIST)) {
		serializedJson = getCategoryList(resourceRequest,resourceResponse );
		
	} else {
		_log.error("Unknown command is passed <" + cmd + ">");
	}
	
	HttpServletResponse response = _portal.getHttpServletResponse(
			resourceResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(response, serializedJson);		
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:24,代码来源:MBMVCResourceCommand.java

示例4: _writeSampleHTML

import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入方法依赖的package包/类
/**
 * Write sample HTML
 *
 * @param resp
 */
private void _writeSampleHTML(HttpServletResponse resp) {
	resp.setCharacterEncoding(StringPool.UTF8);
	resp.setContentType(ContentTypes.TEXT_HTML_UTF8);
	resp.setStatus(HttpServletResponse.SC_OK);

	try {
		ServletResponseUtil.write(resp, _generateSampleHTML());
	}
	catch (Exception e) {
		if (_log.isWarnEnabled()) {
			_log.warn(e, e);
		}

		resp.setStatus(HttpServletResponse.SC_PRECONDITION_FAILED);
	}
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:22,代码来源:BladeServlet.java

示例5: doServeResource

import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入方法依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
		throws Exception {
	int numberOfCrawlers = ParamUtil.getInteger(resourceRequest, "numberOfCrawlers", -1);
	int maxDepthOfCrawling = ParamUtil.getInteger(resourceRequest, "maxDepthOfCrawling", -1);
	int maxPagesToFetch = ParamUtil.getInteger(resourceRequest, "maxPagesToFetch", -1);
	String tmpUrls = ParamUtil.getString(resourceRequest, "urls", "https://www.shutterstock.com/photos");
	String[] strArray = tmpUrls.split(",");
	List<String> urls = new ArrayList<>(Arrays.asList(strArray));
	List<String> result = Lists.newArrayList();
	
	if(_log.isDebugEnabled()) {
		_log.debug("numberOfCrawlers : " + String.valueOf(numberOfCrawlers));
		_log.debug("maxDepthOfCrawling : " + String.valueOf(maxDepthOfCrawling));
		_log.debug("maxPagesToFetch : " + String.valueOf(maxPagesToFetch));
	}

	if( numberOfCrawlers >= 0 && 
		maxDepthOfCrawling >= 0 && 
		maxPagesToFetch >= 0 ) {
		
		// Run image links crawler
		result = run(numberOfCrawlers, maxDepthOfCrawling, maxPagesToFetch, urls);
	}

	HttpServletResponse response = _portal.getHttpServletResponse(resourceResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	String serializedJson = createReturnJson(resourceRequest, resourceResponse, result);
	
	ServletResponseUtil.write(response, serializedJson);		
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:34,代码来源:ImageLinksMVCResourceCommand.java

示例6: writeJSON

import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入方法依赖的package包/类
protected void writeJSON(
	PortletRequest portletRequest, ActionResponse actionResponse,
	Object json)
	throws IOException {

	HttpServletResponse response =
		PortalUtil.getHttpServletResponse(actionResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(response, json.toString());

	response.flushBuffer();

	setForward(portletRequest, COMMON_NULL);
}
 
开发者ID:baxtheman,项目名称:inline-edit-journal-hook,代码行数:17,代码来源:EditArticle.java

示例7: doServeResource

import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入方法依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
		throws Exception {
	String serializedJson = "";

	serializedJson = getCategoryList(resourceRequest, resourceResponse);

	HttpServletResponse response = _portal.getHttpServletResponse(resourceResponse);

	response.setContentType(ContentTypes.APPLICATION_JSON);

	ServletResponseUtil.write(response, serializedJson);
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:14,代码来源:CategoryMVCResourceCommand.java


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