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


Java ResourceResponse类代码示例

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


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

示例1: doServeResource

import javax.portlet.ResourceResponse; //导入依赖的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 javax.portlet.ResourceResponse; //导入依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws Exception {
    
    String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);

    PortletRequestDispatcher portletRequestDispatcher = null;

    if (cmd.equals(Constants.IMPORT)) {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
    } else {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                "/import/new_import/import_task_records_resources.jsp");
    }

    portletRequestDispatcher.include(resourceRequest, resourceResponse);
}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:18,代码来源:ImportTaskRecordsMVCResourceCommand.java

示例3: doServeResource

import javax.portlet.ResourceResponse; //导入依赖的package包/类
@Override
protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws Exception {
    
    String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);

    PortletRequestDispatcher portletRequestDispatcher = null;

    if (cmd.equals(Constants.IMPORT)) {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
    } else {
        portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                "/import/new_import/import_contacts_resources.jsp");
    }

    portletRequestDispatcher.include(resourceRequest, resourceResponse);
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:18,代码来源:ImportContactsMVCResourceCommand.java

示例4: doServeResource

import javax.portlet.ResourceResponse; //导入依赖的package包/类
@Override
protected void doServeResource(
	ResourceRequest resourceRequest, ResourceResponse resourceResponse)
	throws Exception {

	if (_log.isDebugEnabled()) {
		_log.debug("GetHelpTextMVCResourceCommand.doServeResource()");
	}

	JSONObject helpObject = JSONFactoryUtil.createJSONObject();

	helpObject.put(GSearchWebKeys.HELP_TEXT, getHelpText(resourceRequest));

	JSONPortletResponseUtil.writeJSON(
		resourceRequest, resourceResponse, helpObject);
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:17,代码来源:GetHelpTextMVCResourceCommand.java

示例5: doServeResource

import javax.portlet.ResourceResponse; //导入依赖的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

示例6: createReturnJson

import javax.portlet.ResourceResponse; //导入依赖的package包/类
/**
 * Create Return json value 
 * 
 * @param resourceRequest
 * @param resourceResponse
 * @param urls URL string list
 * @return json URL strings
 */
protected String createReturnJson(ResourceRequest resourceRequest, ResourceResponse resourceResponse, List<String> urls) {

	JSONObject rootJSONObject = JSONFactoryUtil.createJSONObject();
	
	//Add plain text with line breaks for textarea
	rootJSONObject.put("urlstr", String.join(LDFPortletKeys.EOL, urls));
	
	JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

	for ( String url : urls) {
		JSONObject curUserJSONObject = JSONFactoryUtil.createJSONObject();

		curUserJSONObject.put("url", url);
		jsonArray.put(curUserJSONObject);
	}
	rootJSONObject.put("urllist", jsonArray);

	return rootJSONObject.toJSONString();
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:28,代码来源:ImageLinksMVCResourceCommand.java

示例7: doServeResource

import javax.portlet.ResourceResponse; //导入依赖的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

示例8: doServeResource

import javax.portlet.ResourceResponse; //导入依赖的package包/类
@Override
    protected void doServeResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
            throws Exception {
        
//        _log.info("doServeResource()");

        String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);

//        _log.info("cmd = " + cmd);

        PortletRequestDispatcher portletRequestDispatcher = null;

        if (cmd.equals(Constants.IMPORT)) {
            portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest, "/import/processes_list/view.jsp");
        } else {
            portletRequestDispatcher = getPortletRequestDispatcher(resourceRequest,
                    "/import/new_import/import_measurements_resources.jsp");
        }

        portletRequestDispatcher.include(resourceRequest, resourceResponse);
    }
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:22,代码来源:ImportMeasurementsMVCResourceCommand.java

示例9: determineDefaultPhase

import javax.portlet.ResourceResponse; //导入依赖的package包/类
private String determineDefaultPhase(Method handlerMethod) {
	if (void.class != handlerMethod.getReturnType()) {
		return PortletRequest.RENDER_PHASE;
	}
	for (Class<?> argType : handlerMethod.getParameterTypes()) {
		if (ActionRequest.class.isAssignableFrom(argType) || ActionResponse.class.isAssignableFrom(argType) ||
				InputStream.class.isAssignableFrom(argType) || Reader.class.isAssignableFrom(argType)) {
			return PortletRequest.ACTION_PHASE;
		}
		else if (RenderRequest.class.isAssignableFrom(argType) || RenderResponse.class.isAssignableFrom(argType) ||
				OutputStream.class.isAssignableFrom(argType) || Writer.class.isAssignableFrom(argType)) {
			return PortletRequest.RENDER_PHASE;
		}
		else if (ResourceRequest.class.isAssignableFrom(argType) || ResourceResponse.class.isAssignableFrom(argType)) {
			return PortletRequest.RESOURCE_PHASE;
		}
		else if (EventRequest.class.isAssignableFrom(argType) || EventResponse.class.isAssignableFrom(argType)) {
			return PortletRequest.EVENT_PHASE;
		}
	}
	return "";
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:AnnotationMethodHandlerAdapter.java

示例10: processHandlerException

import javax.portlet.ResourceResponse; //导入依赖的package包/类
/**
 * Determine an error ModelAndView via the registered HandlerExceptionResolvers.
 * @param request current portlet request
 * @param response current portlet response
 * @param handler the executed handler, or null if none chosen at the time of
 * the exception (for example, if multipart resolution failed)
 * @param ex the exception that got thrown during handler execution
 * @return a corresponding ModelAndView to forward to
 * @throws Exception if no error ModelAndView found
 */
protected ModelAndView processHandlerException(
		ResourceRequest request, ResourceResponse response, Object handler, Exception ex)
		throws Exception {

	ModelAndView exMv = null;
	for (Iterator<HandlerExceptionResolver> it = this.handlerExceptionResolvers.iterator(); exMv == null && it.hasNext();) {
		HandlerExceptionResolver resolver = it.next();
		exMv = resolver.resolveException(request, response, handler, ex);
	}
	if (exMv != null) {
		if (logger.isDebugEnabled()) {
			logger.debug("HandlerExceptionResolver returned ModelAndView [" + exMv + "] for exception");
		}
		logger.warn("Handler execution resulted in exception - forwarding to resolved error view", ex);
		return exMv;
	}
	else {
		throw ex;
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:31,代码来源:DispatcherPortlet.java

示例11: triggerAfterResourceCompletion

import javax.portlet.ResourceResponse; //导入依赖的package包/类
/**
 * Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
 * Will just invoke afterCompletion for all interceptors whose preHandle
 * invocation has successfully completed and returned true.
 * @param mappedHandler the mapped HandlerExecutionChain
 * @param interceptorIndex index of last interceptor that successfully completed
 * @param ex Exception thrown on handler execution, or null if none
 * @see HandlerInterceptor#afterRenderCompletion
 */
private void triggerAfterResourceCompletion(HandlerExecutionChain mappedHandler, int interceptorIndex,
		ResourceRequest request, ResourceResponse response, Exception ex)
		throws Exception {

	// Apply afterCompletion methods of registered interceptors.
	if (mappedHandler != null) {
		HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
		if (interceptors != null) {
			for (int i = interceptorIndex; i >= 0; i--) {
				HandlerInterceptor interceptor = interceptors[i];
				try {
					interceptor.afterResourceCompletion(request, response, mappedHandler.getHandler(), ex);
				}
				catch (Throwable ex2) {
					logger.error("HandlerInterceptor.afterCompletion threw exception", ex2);
				}
			}
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:DispatcherPortlet.java

示例12: serveResource

import javax.portlet.ResourceResponse; //导入依赖的package包/类
/**
 * Serve the resource as specified in the given request to the given response,
 * using the PortletContext's request dispatcher.
 * <p>This is roughly equivalent to Portlet 2.0 GenericPortlet.
 * @param request the current resource request
 * @param response the current resource response
 * @param context the current Portlet's PortletContext
 * @throws PortletException propagated from Portlet API's forward method
 * @throws IOException propagated from Portlet API's forward method
 */
public static void serveResource(ResourceRequest request, ResourceResponse response, PortletContext context)
		throws PortletException, IOException {

	String id = request.getResourceID();
	if (id != null) {
		if (!PortletUtils.isProtectedResource(id)) {
			PortletRequestDispatcher rd = context.getRequestDispatcher(id);
			if (rd != null) {
				rd.forward(request, response);
				return;
			}
		}
		response.setProperty(ResourceResponse.HTTP_STATUS_CODE, "404");
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:26,代码来源:PortletUtils.java

示例13: serveResource

import javax.portlet.ResourceResponse; //导入依赖的package包/类
@Override
public boolean serveResource(
		ResourceRequest resourceRequest, ResourceResponse resourceResponse)
	throws PortletException {

	final String cmd = ParamUtil.getString(resourceRequest, Constants.CMD);

	if (cmd.equals("BOOKMARK_ORDERABLE")) {
		serveOlderUserBookmarks(resourceRequest, resourceResponse);
	}
	else {
		_editFolderMVCResourceCommand.serveResource(
			resourceRequest, resourceResponse);
	}

	return true;
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:18,代码来源:CustomMVCResourceCommand.java

示例14: serveResource

import javax.portlet.ResourceResponse; //导入依赖的package包/类
@Override
public boolean serveResource(
		ResourceRequest resourceRequest, ResourceResponse resourceResponse)
	throws PortletException {

	if (_log.isInfoEnabled()) {
		_log.info("get captcha resource ");
	}

	try {
		CaptchaUtil.serveImage(resourceRequest, resourceResponse);

		return false;
	}
	catch (Exception e) {
		_log.error(e, e);

		return true;
	}
}
 
开发者ID:liferay,项目名称:liferay-blade-samples,代码行数:21,代码来源:CaptchaMVCResourceCommand.java

示例15: serveResource

import javax.portlet.ResourceResponse; //导入依赖的package包/类
@Override
public void serveResource(ResourceRequest resourceRequest,
        ResourceResponse resourceResponse) throws IOException,
        PortletException {
    System.out.println("#############AJAX CALL####################");
    String diagram = ParamUtil.getString(resourceRequest, "diagram");
    
    JSONObject diagramJSON = new JSONObject(diagram);
    //System.out.println(diagram);
    System.out.println(diagramJSON.get("nodes"));
    JSONArray arrDiagram = diagramJSON.getJSONArray("nodes");
    for (int i = 0; i < arrDiagram.length(); i++) {
    	
    }
    resourceResponse.setContentType("text/html");
    PrintWriter writer = resourceResponse.getWriter();
    writer.print(diagram);
    writer.write("Hello");
    writer.flush();
    writer.close();
    super.serveResource(resourceRequest, resourceResponse);
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:23,代码来源:ProcessDesignerPortlet.java


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