本文整理汇总了Java中com.liferay.portal.kernel.servlet.ServletResponseUtil类的典型用法代码示例。如果您正苦于以下问题:Java ServletResponseUtil类的具体用法?Java ServletResponseUtil怎么用?Java ServletResponseUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServletResponseUtil类属于com.liferay.portal.kernel.servlet包,在下文中一共展示了ServletResponseUtil类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: sendFile
import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入依赖的package包/类
/**
* Send file.
*
* @param name the name
* @param mimeType the mime type
* @param contents the contents
* @param request the request
* @param response the response
*/
protected void sendFile(final String name, final String mimeType,
final byte[] contents, final ActionRequest request,
final ActionResponse response) {
try {
if (name != null && mimeType != null && contents != null) {
final HttpServletRequest httpServletRequest = PortalUtil
.getHttpServletRequest(request);
final HttpServletResponse httpServletResponse = PortalUtil
.getHttpServletResponse(response);
httpServletResponse.setContentType(mimeType);
httpServletResponse.setHeader("Expires", "0");
httpServletResponse.setHeader("Cache-Control",
"must-revalidate, post-check=0, pre-check=0");
httpServletResponse.setHeader("Pragma", "public");
httpServletResponse.setContentLength(contents.length);
ServletResponseUtil.sendFile(httpServletRequest,
httpServletResponse, name, contents);
}
} catch (final Throwable t) {
t.printStackTrace();
}
}
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:33,代码来源:BaseController.java
示例6: 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
示例7: serveResource
import com.liferay.portal.kernel.servlet.ServletResponseUtil; //导入依赖的package包/类
public void serveResource(ResourceRequest resourceRequest,
ResourceResponse resourceResponse) throws IOException,
PortletException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest
.getAttribute(WebKeys.THEME_DISPLAY);
loadFonts();
write_IEC_Pdf(baos,themeDisplay,PortalUtil.getHttpServletRequest(resourceRequest));
ServletResponseUtil.sendFile(PortalUtil.getHttpServletRequest(resourceRequest),
PortalUtil.getHttpServletResponse(resourceResponse),
fileName,
baos.toByteArray(),
ContentTypes.APPLICATION_PDF);
} catch (Exception e) {
e.printStackTrace();
SessionErrors.add(resourceRequest, "export.pdf.userstats.error");
} finally{
baos.close();
}
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:30,代码来源:UserProgress.java
示例8: 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
示例9: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论