javax.portlet.PortletAsyncEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of portlet-api Show documentation
Show all versions of portlet-api Show documentation
The Java Portlet API version 3.0 developed by the Java Community Process JSR-362 Expert Group.
/* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package javax.portlet;
/**
*
* Event that gets fired when the asynchronous operation initiated on a
* ResourceRequest
(via a call to ResourceRequest#startAsync
or
* ResourceRequest#startAsync(ResourceRequest, ResouceResponse))
has completed, timed
* out, or produced an error.
*
*
* @see PortletAsyncContext
* @see PortletAsyncEvent
* @see ResourceRequest
* @since 3.0
*/
public class PortletAsyncEvent {
PortletAsyncContext context;
ResourceRequest request;
ResourceResponse response;
Throwable throwable;
/**
*
* Constructs a PortletAsyncEvent
from the given
* PortletAsyncContext
, ResourceRequest
, ResourceResponse
,
* and Throwable
.
*
*
* @since 3.0
*
* @param context
* @param request
* @param response
* @param throwable
*/
public PortletAsyncEvent(PortletAsyncContext context, ResourceRequest request, ResourceResponse response, Throwable throwable) {
this.context = context;
this.request = request;
this.response = response;
this.throwable = throwable;
}
/**
*
* Constructs a PortletAsyncEvent
from the given
* PortletAsyncContext
, ResourceRequest
, and ResourceResponse
.
*
*
* @since 3.0
* @param context
* @param request
* @param response
*/
public PortletAsyncEvent(PortletAsyncContext context, ResourceRequest request, ResourceResponse response) {
this.context = context;
this.request = request;
this.response = response;
this.throwable = null;
}
/**
*
* Constructs a PortletAsyncEvent
from the given
* PortletAsyncContext
and Throwable
.
*
*
* @since 3.0
*
* @param context
* @param throwable
*/
public PortletAsyncEvent(PortletAsyncContext context, Throwable throwable) {
this.context = context;
this.request = null;
this.response = null;
this.throwable = throwable;
}
/**
*
* Constructs a PortletAsyncEvent
from the given
* PortletAsyncContext
.
*
*
* @since 3.0
*
* @param context
*/
public PortletAsyncEvent(PortletAsyncContext context) {
this.context = context;
this.request = null;
this.response = null;
this.throwable = null;
}
/**
*
* Gets the portlet asynchronous context object associated with the event.
*
*
* @since 3.0
*
* @return the portlet asynchronous context
*/
public PortletAsyncContext getPortletAsyncContext() {
return context;
}
/**
*
* Gets the resource request associated with the listener when it was added through the
* PortletAsyncContext#addListener(PortletAsyncListener, ResourceRequest, ResourceResponse)
* method.
*
* If the listener was added through the
* PortletAsyncContext#addListener(PortletAsyncListener)
method,
* the returned resource request will be null
.
*
*
* @since 3.0
*
* @return the resource request provided to the constructor, or null
* if no resource request was provided.
*/
public ResourceRequest getSuppliedRequest() {
return request;
}
/**
*
* Gets the resource response associated with the listener when it was added through the
* PortletAsyncContext#addListener(PortletAsyncListener, ResourceRequest, ResourceResponse)
* method.
*
* If the listener was added through the
* PortletAsyncContext#addListener(PortletAsyncListener)
method,
* the returned resource response will be null
.
*
*
* @since 3.0
*
* @return the resource response provided to the constructor, or null
* if no resource response was provided.
*/
public ResourceResponse getSuppliedResponse() {
return response;
}
/**
*
* Gets the Throwable
associated with the event.
*
*
* @since 3.0
*
* @return The Throwable
that was used to initialize the event, or null
* if no Throwable
was provided.
*/
public Throwable getThrowable() {
return throwable;
}
}