本文整理汇总了Java中javax.servlet.ServletRequestAttributeEvent类的典型用法代码示例。如果您正苦于以下问题:Java ServletRequestAttributeEvent类的具体用法?Java ServletRequestAttributeEvent怎么用?Java ServletRequestAttributeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServletRequestAttributeEvent类属于javax.servlet包,在下文中一共展示了ServletRequestAttributeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyAttributeRemoved
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
/**
* Notify interested listeners that attribute has been removed.
*/
private void notifyAttributeRemoved(String name, Object value) {
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0)) {
return;
}
ServletRequestAttributeEvent event =
new ServletRequestAttributeEvent(context.getServletContext(),
getRequest(), name, value);
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof ServletRequestAttributeListener)) {
continue;
}
ServletRequestAttributeListener listener =
(ServletRequestAttributeListener) listeners[i];
try {
listener.attributeRemoved(event);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t);
// Error valve will pick this exception up and display it to user
attributes.put(RequestDispatcher.ERROR_EXCEPTION, t);
}
}
}
示例2: notifyAttributeRemoved
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
/**
* Notify interested listeners that attribute has been removed.
*/
private void notifyAttributeRemoved(String name, Object value) {
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0)) {
return;
}
ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(context.getServletContext(), getRequest(),
name, value);
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof ServletRequestAttributeListener)) {
continue;
}
ServletRequestAttributeListener listener = (ServletRequestAttributeListener) listeners[i];
try {
listener.attributeRemoved(event);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t);
// Error valve will pick this exception up and display it to
// user
attributes.put(RequestDispatcher.ERROR_EXCEPTION, t);
}
}
}
示例3: removeAttribute
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void removeAttribute(final String name) {
final Object value = attributes.get(name);
if (value == null) {
return;
}
// fire event
if (requestAttributeListeners != null) {
for (int n = 0; n < requestAttributeListeners.length; n++) {
final ClassLoader cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getWebAppConfig().getLoader());
requestAttributeListeners[n].attributeRemoved(new ServletRequestAttributeEvent(webappConfig, this, name, value));
Thread.currentThread().setContextClassLoader(cl);
}
}
attributes.remove(name);
}
示例4: setAttribute
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void setAttribute(String name, Object value)
{
if (value == null)
{
this.removeAttribute(name);
}
else if (name != null)
{
Object oldValue = this.getAttribute(name);
super.setAttribute(name, value);
if (oldValue == null)
{
requestAttributeListener.attributeAdded(new ServletRequestAttributeEvent(servletContext, this,
name, value));
}
else
{
requestAttributeListener.attributeReplaced(new ServletRequestAttributeEvent(servletContext, this,
name, oldValue));
}
}
}
示例5: attributeAdded
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeAdded(ServletRequestAttributeEvent servletRequestAttributeEvent){
if (LOGGER.isTraceEnabled()){
LOGGER.trace(
"name:[{}],value:[{}] added to [servletRequest]",
servletRequestAttributeEvent.getName(),
servletRequestAttributeEvent.getValue());
}
}
示例6: attributeRemoved
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeRemoved(ServletRequestAttributeEvent servletRequestAttributeEvent){
if (LOGGER.isDebugEnabled()){
LOGGER.debug(
"name:[{}],value:[{}] removed from [servletRequest]",
servletRequestAttributeEvent.getName(),
servletRequestAttributeEvent.getValue());
}
}
示例7: attributeReplaced
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeReplaced(ServletRequestAttributeEvent servletRequestAttributeEvent){
if (LOGGER.isTraceEnabled()){
LOGGER.trace(
"name:[{}],value:[{}] replaced to [servletRequest]",
servletRequestAttributeEvent.getName(),
servletRequestAttributeEvent.getValue());
}
}
示例8: setAttribute
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void setAttribute(String name, Object value) {
if (value == null) {
this.removeAttribute(name);
} else if (name != null) {
Object oldValue = this.getAttribute(name);
super.setAttribute(name, value);
if (oldValue == null) {
requestAttributeListener.attributeAdded(new ServletRequestAttributeEvent(servletContext, this, name, value));
} else {
requestAttributeListener.attributeReplaced(new ServletRequestAttributeEvent(servletContext, this, name, oldValue));
}
}
}
示例9: removeAttribute
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void removeAttribute(String name) {
Object oldValue = this.getAttribute(name);
super.removeAttribute(name);
if (oldValue != null) {
requestAttributeListener.attributeRemoved(new ServletRequestAttributeEvent(servletContext, this, name, oldValue));
}
}
示例10: attributeAdded
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void attributeAdded(final ServletRequestAttributeEvent srae)
{
final Iterator<ServletRequestAttributeListener> listeners = getContextListeners();
while (listeners.hasNext())
{
listeners.next().attributeAdded(srae);
}
}
示例11: attributeRemoved
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void attributeRemoved(final ServletRequestAttributeEvent srae)
{
final Iterator<ServletRequestAttributeListener> listeners = getContextListeners();
while (listeners.hasNext())
{
listeners.next().attributeRemoved(srae);
}
}
示例12: attributeReplaced
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void attributeReplaced(final ServletRequestAttributeEvent srae)
{
final Iterator<ServletRequestAttributeListener> listeners = getContextListeners();
while (listeners.hasNext())
{
listeners.next().attributeReplaced(srae);
}
}
示例13: removeAttribute
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
public void removeAttribute(String name)
{
Object oldValue = this.getAttribute(name);
super.removeAttribute(name);
if (oldValue != null)
{
requestAttributeListener.attributeRemoved(new ServletRequestAttributeEvent(servletContext, this, name,
oldValue));
}
}
示例14: attributeAdded
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeAdded(ServletRequestAttributeEvent srae) {
logger.info("MyServletRequestAttributeListener.attributeAdded: " + srae.getName());
sampleServletRequestAttributeSet.add(1);
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:6,代码来源:SampleServletRequestAttributeListener.java
示例15: attributeRemoved
import javax.servlet.ServletRequestAttributeEvent; //导入依赖的package包/类
@Override
public void attributeRemoved(ServletRequestAttributeEvent srae) {
logger.info("MyServletRequestAttributeListener.attributeRemoved: " + srae.getName());
sampleServletRequestAttributeSet.add(2);
}
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:6,代码来源:SampleServletRequestAttributeListener.java