本文整理汇总了Java中javax.portlet.PortletResponse类的典型用法代码示例。如果您正苦于以下问题:Java PortletResponse类的具体用法?Java PortletResponse怎么用?Java PortletResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PortletResponse类属于javax.portlet包,在下文中一共展示了PortletResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerPortletApplicationScopes
import javax.portlet.PortletResponse; //导入依赖的package包/类
/**
* Register web-specific scopes ("request", "session", "globalSession")
* with the given BeanFactory, as used by the Portlet ApplicationContext.
* @param bf the BeanFactory to configure
* @param pc the PortletContext that we're running within
*/
static void registerPortletApplicationScopes(ConfigurableListableBeanFactory bf, PortletContext pc) {
bf.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope());
bf.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false));
bf.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true));
if (pc != null) {
PortletContextScope appScope = new PortletContextScope(pc);
bf.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope);
// Register as PortletContext attribute, for ContextCleanupListener to detect it.
pc.setAttribute(PortletContextScope.class.getName(), appScope);
}
bf.registerResolvableDependency(PortletRequest.class, new RequestObjectFactory());
bf.registerResolvableDependency(PortletResponse.class, new ResponseObjectFactory());
bf.registerResolvableDependency(PortletSession.class, new SessionObjectFactory());
bf.registerResolvableDependency(WebRequest.class, new WebRequestObjectFactory());
}
示例2: testNativeRequest
import javax.portlet.PortletResponse; //导入依赖的package包/类
@Test
public void testNativeRequest() {
MockRenderRequest portletRequest = new MockRenderRequest();
MockRenderResponse portletResponse = new MockRenderResponse();
PortletWebRequest request = new PortletWebRequest(portletRequest, portletResponse);
assertSame(portletRequest, request.getNativeRequest());
assertSame(portletRequest, request.getNativeRequest(PortletRequest.class));
assertSame(portletRequest, request.getNativeRequest(RenderRequest.class));
assertSame(portletRequest, request.getNativeRequest(MockRenderRequest.class));
assertNull(request.getNativeRequest(MultipartRequest.class));
assertSame(portletResponse, request.getNativeResponse());
assertSame(portletResponse, request.getNativeResponse(PortletResponse.class));
assertSame(portletResponse, request.getNativeResponse(RenderResponse.class));
assertSame(portletResponse, request.getNativeResponse(MockRenderResponse.class));
assertNull(request.getNativeResponse(MultipartRequest.class));
}
示例3: testDecoratedNativeRequest
import javax.portlet.PortletResponse; //导入依赖的package包/类
@Test
public void testDecoratedNativeRequest() {
MockRenderRequest portletRequest = new MockRenderRequest();
MockRenderResponse portletResponse = new MockRenderResponse();
PortletRequest decoratedRequest = new PortletRequestWrapper(portletRequest);
PortletResponse decoratedResponse = new PortletResponseWrapper(portletResponse);
PortletWebRequest request = new PortletWebRequest(decoratedRequest, decoratedResponse);
assertSame(decoratedRequest, request.getNativeRequest());
assertSame(decoratedRequest, request.getNativeRequest(PortletRequest.class));
assertSame(portletRequest, request.getNativeRequest(RenderRequest.class));
assertSame(portletRequest, request.getNativeRequest(MockRenderRequest.class));
assertNull(request.getNativeRequest(MultipartRequest.class));
assertSame(decoratedResponse, request.getNativeResponse());
assertSame(decoratedResponse, request.getNativeResponse(PortletResponse.class));
assertSame(portletResponse, request.getNativeResponse(RenderResponse.class));
assertSame(portletResponse, request.getNativeResponse(MockRenderResponse.class));
assertNull(request.getNativeResponse(MultipartRequest.class));
}
示例4: especificValidations
import javax.portlet.PortletResponse; //导入依赖的package包/类
public boolean especificValidations(UploadRequest uploadRequest,PortletResponse portletResponse) {
Object returnObj = null;
try {
MethodKey especificValidationsMethod = new MethodKey(clp.getClassName(), "especificValidations", UploadRequest.class, PortletResponse.class);
returnObj = clp.invoke(new MethodHandler(especificValidationsMethod, uploadRequest, portletResponse));
}
catch (Throwable t) {
t = ClpSerializer.translateThrowable(t);
if (t instanceof RuntimeException) {
throw (RuntimeException)t;
}
else {
t.printStackTrace();
throw new RuntimeException(t.getClass().getName() +
" is not a valid exception");
}
}
return ((Boolean)returnObj).booleanValue();
}
示例5: especificValidations
import javax.portlet.PortletResponse; //导入依赖的package包/类
@Override
public boolean especificValidations(UploadRequest uploadRequest,PortletResponse portletResponse){
Object returnObj = null;
try {
MethodKey especificValidationsMethod = new MethodKey(clp.getClassName(), "especificValidations", UploadRequest.class, PortletResponse.class);
returnObj = clp.invoke(new MethodHandler(especificValidationsMethod, uploadRequest, portletResponse));
}
catch (Throwable t) {
t = ClpSerializer.translateThrowable(t);
if (t instanceof RuntimeException) {
throw (RuntimeException)t;
}
else {
t.printStackTrace();
throw new RuntimeException(t.getClass().getName() +
" is not a valid exception");
}
}
return ((Boolean)returnObj).booleanValue();
}
示例6: especificValidations
import javax.portlet.PortletResponse; //导入依赖的package包/类
@Override
public boolean especificValidations(UploadRequest uploadRequest,
PortletResponse portletResponse) {
PortletRequest actionRequest = (PortletRequest)uploadRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_REQUEST);
boolean validate=true;
if((Validator.isNotNull(uploadRequest.getParameter("random")))&&
((!Validator.isNumber(uploadRequest.getParameter("random")))||
(Long.parseLong(uploadRequest.getParameter("random"))>100)||
(Long.parseLong(uploadRequest.getParameter("random"))<0)))
{
SessionErrors.add(actionRequest, "execactivity.editActivity.random.number");
validate=false;
}
if((Validator.isNotNull(uploadRequest.getParameter("questionsPerPage")))&&
((!Validator.isNumber(uploadRequest.getParameter("questionsPerPage")))||
(Long.parseLong(uploadRequest.getParameter("questionsPerPage"))>100)||
(Long.parseLong(uploadRequest.getParameter("questionsPerPage"))<0)))
{
SessionErrors.add(actionRequest, "execactivity.editActivity.questionsPerPage.number");
validate=false;
}
return validate;
}
示例7: especificValidations
import javax.portlet.PortletResponse; //导入依赖的package包/类
@Override
public boolean especificValidations(UploadRequest uploadRequest,
PortletResponse portletResponse) {
PortletRequest actionRequest = (PortletRequest)uploadRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_REQUEST);
boolean validate = true;
if((Validator.isNotNull(uploadRequest.getParameter("numValidaciones")))&&
(!Validator.isNumber(uploadRequest.getParameter("numValidaciones"))))
{
SessionErrors.add(actionRequest, "p2ptaskactivity.editActivity.numValidaciones.number");
validate=false;
}
return validate;
}
示例8: checkParameters
import javax.portlet.PortletResponse; //导入依赖的package包/类
protected TestResult checkParameters(PortletContext context,
PortletRequest request,
PortletResponse response)
throws IOException, PortletException {
// Dispatch to the companion servlet: call checkParameters().
StringBuffer buffer = new StringBuffer();
buffer.append(SERVLET_PATH).append("?")
.append(KEY_TARGET).append("=").append(TARGET_PARAMS)
.append("&").append(KEY_A).append("=").append(VALUE_A)
.append("&").append(KEY_B).append("=").append(VALUE_B);
if (LOG.isDebugEnabled()) {
LOG.debug("Dispatching to: " + buffer.toString());
}
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
示例9: checkSameNameParameter
import javax.portlet.PortletResponse; //导入依赖的package包/类
protected TestResult checkSameNameParameter(PortletContext context,
PortletRequest request,
PortletResponse response)
throws IOException, PortletException {
// Dispatch to the companion servlet: call checkSameNameParameter().
StringBuffer buffer = new StringBuffer();
buffer.append(SERVLET_PATH).append("?")
.append(KEY_TARGET).append("=").append(TARGET_SAME_NAME_PARAM)
.append("&").append(KEY_C).append("=").append(VALUE_C1)
.append("&").append(KEY_C).append("=").append(VALUE_C2)
.append("&").append(KEY_C).append("=").append(VALUE_C3);
if (LOG.isDebugEnabled()) {
LOG.debug("Dispatching to: " + buffer.toString());
}
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
示例10: checkAddedSameNameParameter
import javax.portlet.PortletResponse; //导入依赖的package包/类
protected TestResult checkAddedSameNameParameter(PortletContext context,
PortletRequest request,
PortletResponse response)
throws IOException, PortletException {
// Dispatch to the companion servlet: call checkAddedSameNameParameter().
StringBuffer buffer = new StringBuffer();
buffer.append(SERVLET_PATH).append("?")
.append(KEY_TARGET).append("=").append(TARGET_ADDED_SAME_NAME_PARAM)
.append("&").append(KEY_RENDER).append("=").append(VALUE_ADDED1)
.append("&").append(KEY_RENDER).append("=").append(VALUE_ADDED2);
if (LOG.isDebugEnabled()) {
LOG.debug("Dispatching to: " + buffer.toString());
}
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
示例11: checkInvalidParameters
import javax.portlet.PortletResponse; //导入依赖的package包/类
protected TestResult checkInvalidParameters(PortletContext context,
PortletRequest request,
PortletResponse response)
throws IOException, PortletException {
// Dispatch to the companion servlet: call checkInvalidParameters().
StringBuffer buffer = new StringBuffer();
buffer.append(SERVLET_PATH).append("?")
.append(KEY_TARGET).append("=").append(TARGET_INVALID_PARAMS)
.append("&").append(KEY_A)
.append("&").append(KEY_B).append("=").append(VALUE_B)
.append("&").append(KEY_C).append("=");
if (LOG.isDebugEnabled()) {
LOG.debug("Dispatching to: " + buffer.toString());
}
PortletRequestDispatcher dispatcher = context.getRequestDispatcher(
buffer.toString());
dispatcher.include((RenderRequest) request, (RenderResponse) response);
// Retrieve test result returned by the companion servlet.
TestResult result = (TestResult) request.getAttribute(RESULT_KEY);
request.removeAttribute(RESULT_KEY);
return result;
}
示例12: doStartTag
import javax.portlet.PortletResponse; //导入依赖的package包/类
public int doStartTag() throws JspException {
PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
.getAttribute(Constants.PORTLET_RESPONSE);
String namespace = portletResponse.getNamespace();
JspWriter writer = pageContext.getOut();
try {
writer.print(namespace);
} catch (IOException ioe) {
throw new JspException(
"Unable to write namespace", ioe
);
}
return SKIP_BODY;
}
示例13: checkEqualProperties
import javax.portlet.PortletResponse; //导入依赖的package包/类
private boolean checkEqualProperties(PortletResponse injectedPortletArtifact,
PortletResponse portletResponse) {
Collection<String> injectedProperties = injectedPortletArtifact
.getPropertyNames();
Collection<String> portletResponseProperties = portletResponse
.getPropertyNames();
Collection<String> injectedPropertyNames;
Collection<String> portletPropertyNames;
if (checkEqualCollection(injectedProperties, portletResponseProperties)) {
for (String propertyName : injectedProperties) {
injectedPropertyNames = injectedPortletArtifact
.getPropertyValues(propertyName);
portletPropertyNames = injectedPortletArtifact
.getPropertyValues(propertyName);
if (!checkEqualCollection(injectedPropertyNames,
portletPropertyNames)) {
return false;
}
}
return true;
} else {
return false;
}
}
示例14: processTCKReq
import javax.portlet.PortletResponse; //导入依赖的package包/类
protected void processTCKReq(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
PortletRequest portletReq = (PortletRequest) request.getAttribute("javax.portlet.request");
PortletResponse portletResp = (PortletResponse) request.getAttribute("javax.portlet.response");
request.getAttribute("javax.portlet.config");
Thread.currentThread().getId();
portletReq.getAttribute(THREADID_ATTR);
PrintWriter writer = ((MimeResponse) portletResp).getWriter();
// Create result objects for the tests
PortletURL purl = ((MimeResponse) portletResp).createRenderURL();
TestLink tl = new TestLink(V2DISPATCHERTESTS3S_SPEC2_19_FORWARDSERVLETRESOURCE_DISPATCH4, purl);
tl.writeTo(writer);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:19,代码来源:DispatcherTests3S_SPEC2_19_ForwardServletResource_servlet.java
示例15: setPrecursors
import javax.portlet.PortletResponse; //导入依赖的package包/类
/**
* Creates a new producer for this thread and stores it in the thread local.
* @param req The portlet request
* @param resp The portlet response
* @param config The portlet config
*/
public static void setPrecursors(PortletRequest req, PortletResponse resp, PortletConfig config) {
PortletArtifactProducer pap = getPAP();
pap.req = req;
pap.resp = resp;
pap.config = config;
if (isTrace) {
StringBuilder txt = new StringBuilder(80);
txt.append("Set precursors.");
txt.append(" ThreadId=").append(Thread.currentThread().getId());
txt.append(", Portlet name: ").append(config == null ? "null" : config.getPortletName());
LOG.trace(txt.toString());
}
}