Refine search
private void callAttributeListenersRemovedMethod(String key, Object value) { for (Object anAttributeListener : attributeListener) { ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(getServletContext(), this, key, value); ((ServletRequestAttributeListener) anAttributeListener).attributeRemoved(event); } }
/** * Notification that an attribute was replaced on the servlet request. Called after the * attribute is replaced. * * @param event the notification event */ public void attributeReplaced(ServletRequestAttributeEvent event) { String attrName = event.getName(); Object newValue = event.getServletRequest().getAttribute(attrName); // perhaps a bit paranoid, but since the javadocs are a bit vague, // only handle the event if oldValue and newValue are not the // exact same object // noinspection ObjectEquality if (event.getValue() != newValue) { handleAttributeEvent(attrName, event.getValue(), ELUtils.Scope.REQUEST); } }
/** * Notification that an existing attribute has been removed from the servlet request. Called * after the attribute is removed. * * @param event the notification event */ public void attributeRemoved(ServletRequestAttributeEvent event) { handleAttributeEvent(event.getName(), event.getValue(), ELUtils.Scope.REQUEST); }
public void attributeRemoved(ServletRequestAttributeEvent srae) { // use this phase attribute as an indicator of whether // we are actively working on a request PortletPhase phase = (PortletPhase) srae.getServletRequest().getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE); // If not in a render this means the attribute has been removed before we have // saved the request scope -- since the managed bean has been informed we are // running in a portlet environment it should have ignored the PreDestroy. // To make up for this we call its BridgePredestroy if (phase != null && phase != PortletPhase.RENDER_PHASE) { notifyPreDestroy(srae.getValue()); // in outerclass (BridgeImpl) } }
private void attributeNotify(ServletRequest request,String name,Object oldValue,Object newValue) { ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(_servletContext,request,name,oldValue==null?newValue:oldValue); for (int i=0;i<LazyList.size(_requestAttributeListeners);i++) { ServletRequestAttributeListener listener = ((ServletRequestAttributeListener)LazyList.get(_requestAttributeListeners,i)); if (oldValue==null) listener.attributeAdded(event); else if (newValue==null) listener.attributeRemoved(event); else listener.attributeReplaced(event); } }
public void servletRequestAttributeReplaced(final HttpServletRequest request, final String name, final Object value) { if(!started) { return; } final ServletRequestAttributeEvent sre = new ServletRequestAttributeEvent(servletContext, request, name, value); for (int i = 0; i < servletRequestAttributeListeners.length; ++i) { this.<ServletRequestAttributeListener>get(servletRequestAttributeListeners[i]).attributeReplaced(sre); } }
private void callAttributeListenersAddedMethod(String key, Object value) { for (int ii = 0; ii < attributeListener.size(); ii++) { ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(getServletContext(), this, key, value); ((ServletRequestAttributeListener) attributeListener.get(ii)).attributeAdded(event); } }
public void setAttribute(String name, Object value) { boolean added = (request.getAttribute(name) == null); request.setAttribute(name, value); EventListeners eventListeners = dispatchTargets.peek().getContextController().getEventListeners(); List<ServletRequestAttributeListener> listeners = eventListeners.get( ServletRequestAttributeListener.class); if (listeners.isEmpty()) { return; } ServletRequestAttributeEvent servletRequestAttributeEvent = new ServletRequestAttributeEvent( dispatchTargets.peek().getServletRegistration().getServletContext(), this, name, value); for (ServletRequestAttributeListener servletRequestAttributeListener : listeners) { if (added) { servletRequestAttributeListener.attributeAdded( servletRequestAttributeEvent); } else { servletRequestAttributeListener.attributeReplaced( servletRequestAttributeEvent); } } }
void requestAttributeAdded(ServletRequest request, String name, Object o) { final ServletRequestAttributeEvent event = new ServletRequestAttributeEvent( context, request, name, o); fireEvent(REQUEST_ATTRIBUTE_LISTENER_CLASS, new EventInvoker<ServletRequestAttributeListener>() { public void invoke(ServletRequestAttributeListener listener) { listener.attributeAdded(event); } }); }
public void attributeRemoved(ServletRequestAttributeEvent evt) { final String name = evt.getName(); if (!shallIgnore(name)) { final Execution exec = Executions.getCurrent(); if (exec instanceof ExecutionImpl && evt.getServletRequest().equals(exec.getNativeRequest())) ((ExecutionImpl) exec).getScopeListeners().notifyRemoved(name); } }
/** * <p>Respond to a request scope attribute being added. If the * value is an {@link AbstractRequestBean}, call its <code>init()</code> method. * </p> * * @param event Event to be processed */ public void attributeAdded(ServletRequestAttributeEvent event) { Object value = event.getValue(); if (value != null) { fireRequestInit(value); } }
private void attributeNotify(ServletRequest request,String name,Object oldValue,Object newValue) { ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(_servletContext,request,name,oldValue==null?newValue:oldValue); for (int i=0;i<LazyList.size(_requestAttributeListeners);i++) { ServletRequestAttributeListener listener = ((ServletRequestAttributeListener)LazyList.get(_requestAttributeListeners,i)); if (oldValue==null) listener.attributeAdded(event); else if (newValue==null) listener.attributeRemoved(event); else listener.attributeReplaced(event); } }
private void callAttributeListenersReplacedMethod(String key, Object value) { for (int ii = 0; ii < attributeListener.size(); ii++) { ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(getServletContext(), this, key, value); ((ServletRequestAttributeListener) attributeListener.get(ii)).attributeReplaced(event); } }
public void servletRequestAttributeAdded(final HttpServletRequest request, final String name, final Object value) { if(!started) { return; } final ServletRequestAttributeEvent sre = new ServletRequestAttributeEvent(servletContext, request, name, value); for (int i = 0; i < servletRequestAttributeListeners.length; ++i) { this.<ServletRequestAttributeListener>get(servletRequestAttributeListeners[i]).attributeAdded(sre); } }
@Override public void setAttribute(final String name, final Object value) { if ( value == null ) { this.removeAttribute(name); } final Object oldValue = this.getAttribute(name); super.setAttribute(name, value); if ( this.servletContext.getServletRequestAttributeListener() != null ) { if ( oldValue == null ) { this.servletContext.getServletRequestAttributeListener().attributeAdded(new ServletRequestAttributeEvent(this.servletContext, this, name, value)); } else { this.servletContext.getServletRequestAttributeListener().attributeReplaced(new ServletRequestAttributeEvent(this.servletContext, this, name, oldValue)); } } }
void requestAttributeRemoved(ServletRequest request, String name, Object removed) { final ServletRequestAttributeEvent event = new ServletRequestAttributeEvent( context, request, name, removed); fireEvent(REQUEST_ATTRIBUTE_LISTENER_CLASS, new EventInvoker<ServletRequestAttributeListener>() { public void invoke(ServletRequestAttributeListener listener) { listener.attributeRemoved(event); } }); }
/** * This method is called after an attribute is replaced in the ServletRequest. One might expect that this is a good * time to call any managed bean methods annotated with @BridgePreDestroy, but that actually takes place in the * Bridge's {@link RequestAttributeMap#remove(Object)} method. Note that this should only get called for remote WSRP * portlets. For more info, see: http://issues.liferay.com/browse/FACES-146 */ public void attributeReplaced(ServletRequestAttributeEvent servletRequestAttributeEvent) { String attributeName = servletRequestAttributeEvent.getName(); Object attributeValue = servletRequestAttributeEvent.getValue(); logger.trace("Attribute replaced name=[{0}] value=[{1}]", attributeName, attributeValue); }
public void attributeReplaced(ServletRequestAttributeEvent srae) { // use this phase attribute as an indicator of whether // we are actively working on a request PortletPhase phase = (PortletPhase) srae.getServletRequest().getAttribute(Bridge.PORTLET_LIFECYCLE_PHASE); // If in an action this means the attribute has been replaced before we have // saved the action scope -- since the managed bean has been informed we are // running in a portlet environment it should have ignored the PreDestroy. // To make up for this we call its BridgePredestroy if (phase != null && phase != PortletPhase.RENDER_PHASE) { notifyPreDestroy(srae.getValue()); // in outerclass (BridgeImpl) } }
/** * <p>Respond to a request scope attribute being removed. * If the old value was an {@link AbstractRequestBean}, * call its <code>destroy()</code> method.</p> * * @param event Event to be processed */ public void attributeRemoved(ServletRequestAttributeEvent event) { Object value = event.getValue(); if (value != null) { fireRequestDestroy(value); } }
private void callAttributeListenersRemovedMethod(String key, Object value) { for (int ii = 0; ii < attributeListener.size(); ii++) { ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(getServletContext(), this, key, value); ((ServletRequestAttributeListener) attributeListener.get(ii)).attributeRemoved(event); } }