Example usage for org.apache.wicket.util.lang Objects isEqual

List of usage examples for org.apache.wicket.util.lang Objects isEqual

Introduction

In this page you can find the example usage for org.apache.wicket.util.lang Objects isEqual.

Prototype

public static boolean isEqual(final Object object1, final Object object2) 

Source Link

Document

Returns true if object1 is equal to object2 in either the sense that they are the same object or, if both are non-null if they are equal in the equals() sense.

Usage

From source file:com.github.javawithmarcus.wicket.cdi.ConversationExpiryChecker.java

License:Apache License

@Override
public void onBeforeRender(Component component) {
    if (component instanceof Page || RequestCycle.get().find(AjaxRequestTarget.class) != null) {
        Page page = component.getPage();
        String cid = container.getConversationMarker(page);
        if (cid != null && !Objects.isEqual(container.getCurrentConversation().getId(), cid)) {
            logger.info("Conversation {} has expired for {}", cid, page);
            throw new ConversationExpiredException(null, cid, page,
                    RequestCycle.get().getActiveRequestHandler());
        }//  ww w  .j ava2 s  .  c om
    }
}

From source file:com.github.javawithmarcus.wicket.cdi.ConversationPropagator.java

License:Apache License

@Override
public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler) {
    Conversation conversation = getConversation();
    logger.debug("In onRequestHandlerResolved id = {}", conversation.getId());
    String cid = cycle.getRequest().getRequestParameters().getParameterValue(CID_ATTR).toString();
    Page page = getPage(handler);//from   ww w.j  av  a2s  .c  o m

    if (page == null) {
        return;
    }

    if (cid == null) {
        cid = page.getMetaData(CID_KEY);
    }

    if (cid != null && !conversation.isTransient() && !Objects.isEqual(conversation.getId(), cid)) {
        logger.info("Conversation {} has expired for {}", cid, page);
        throw new ConversationExpiredException(null, cid, page, handler);
    }

    activateConversationIfNeeded(page, cycle, handler, cid);
}