Package nextapp.echo2.webcontainer

Examples of nextapp.echo2.webcontainer.ContainerContext


    private void startGhostTask() {
        if (ghostTaskQueue != null) {
            return;
        }
        ghostTaskQueue = createTaskQueue();
        ContainerContext containerContext =
                (ContainerContext) getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
        containerContext.setTaskQueueCallbackInterval(ghostTaskQueue, 0);
        GhostTask.start(this, ghostTaskQueue);
    }
View Full Code Here


            Document document = builder.newDocument();
            Element rootElement = document.createElement("chat-server-request");
           
            ChatApp chatApp = ChatApp.getApp();
            if (chatApp != null) {
                ContainerContext containerContext = (ContainerContext) chatApp.getContextProperty(
                        ContainerContext.CONTEXT_PROPERTY_NAME);
                String remoteHost = containerContext.getClientProperties().getString(ClientProperties.REMOTE_HOST);
                rootElement.setAttribute("remote-host", remoteHost);
            }
           
            if (lastRetrievedId != null) {
                rootElement.setAttribute("last-retrieved-id", lastRetrievedId);
View Full Code Here

        SplitPaneLayoutData splitPaneLayoutData = new SplitPaneLayoutData();
        splitPaneLayoutData.setInsets(new Insets(10));
        setLayoutData(splitPaneLayoutData);
       
        ApplicationInstance app = ApplicationInstance.getActive();
        ContainerContext containerContext
                = (ContainerContext) app.getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
       
        Column clientPropertiesColumn = new Column();
        add(clientPropertiesColumn);
        clientPropertiesColumn.add(new Label("Client Properties"));
View Full Code Here

    public void displayWelcomePane() {
        mainWindow.setContent(new WelcomePane());
    }
   
    private String getRequestParameter(String parameterName) {
        ContainerContext cc = (ContainerContext) getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
        Object parameterValue = cc.getInitialRequestParameterMap().get(parameterName);
        if (parameterValue instanceof String) {
            return (String) parameterValue;
        } else if (parameterValue instanceof String[]) {
            return ((String[]) parameterValue).length == 0 ? null : ((String[]) parameterValue)[0];
        } else {
View Full Code Here

        setStyleSheet(Styles.DEFAULT_STYLE_SHEET);
        mainWindow = new Window();
        mainWindow.setTitle("NextApp Echo2 Test Application");
        mainWindow.setContent(new WelcomePane());
       
        ContainerContext cc = (ContainerContext) getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
        if (!LIVE_DEMO_SERVER) {
            if (cc.getInitialRequestParameterMap().containsKey("ghost")) {
                GhostTask ghostTask = new GhostTask();
               
                if ("1".equals(getRequestParameter("script"))) {
                    ghostTask.setScript(GHOST_SCRIPT_1);
                }
                if (cc.getInitialRequestParameterMap().containsKey("clicks")) {
                    ghostTask.setClicksPerIteration(Integer.parseInt(getRequestParameter("clicks")));
                }
                if (cc.getInitialRequestParameterMap().containsKey("iterations")) {
                    ghostTask.setTotalIterations(Integer.parseInt(getRequestParameter("iterations")));
                }
                startGhostTask(ghostTask, 0);
            }
        }
       
        ClientConfiguration clientConfiguration = new ClientConfiguration();
        clientConfiguration.setProperty(ClientConfiguration.PROPERTY_SERVER_ERROR_MESSAGE,
                "KA-BOOM! (test non-default server error message)");
        cc.setClientConfiguration(clientConfiguration);
       
        return mainWindow;
    }
View Full Code Here

    public void startGhostTask(GhostTask ghostTask, int interval) {
        if (ghostTaskQueue != null) {
            return;
        }
        ghostTaskQueue = createTaskQueue();
        ContainerContext containerContext =
                (ContainerContext) getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
        containerContext.setTaskQueueCallbackInterval(ghostTaskQueue, interval);
        ghostTask.startTask(this, ghostTaskQueue);
    }
View Full Code Here

        mainColumn.setBorder(new Border(new Extent(4), Color.BLUE, Border.STYLE_OUTSET));
        mainColumn.setInsets(new Insets(40));
        mainColumn.setCellSpacing(new Extent(20));
        content.add(mainColumn);
       
        ContainerContext containerContext = (ContainerContext) getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
       
        Principal principal = containerContext.getUserPrincipal();
        mainColumn.add(new Label("getUserPrincipal(): " + (principal == null ? "null" : principal.getName())));
        mainColumn.add(new Label("isUserInRole(\"role1\"): " + containerContext.isUserInRole("role1")));
       
        return mainWindow;
    }
View Full Code Here

        }
       
    }
   
    private HttpSession getSession() {
        ContainerContext containerContext = (ContainerContext) getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
        return containerContext.getSession();
    }
View Full Code Here

        if (sessionExpirationMessageText.getText().trim().length() > 0) {
            clientConfiguration.setProperty(ClientConfiguration.PROPERTY_SESSION_EXPIRATION_MESSAGE,
                    sessionExpirationMessageText.getText());
        }
       
        ContainerContext containerContext
                = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
        containerContext.setClientConfiguration(clientConfiguration);
    }
View Full Code Here

       
        Button setNullButton = new Button("Set ServerDelayMessage to None");
        setNullButton.setStyleName("Default");
        setNullButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(null);
            }
        });
        add(setNullButton);
       
        Button setDefaultButton = new Button("Set ServerDelayMessage to Default");
        setDefaultButton.setStyleName("Default");
        setDefaultButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(DefaultServerDelayMessage.INSTANCE);
            }
        });
        add(setDefaultButton);
       
        Button setCustomDefaultButton = new Button("Set ServerDelayMessage to Custom DefaultServerDelayMessage");
        setCustomDefaultButton.setStyleName("Default");
        setCustomDefaultButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(new DefaultServerDelayMessage("Well, this seems to be taking a while.  "
                        + "Now might be a good time to grab a snack or a frosty beverage from the kitchen."));
            }
        });
        add(setCustomDefaultButton);
       
        Button coolButton = new Button("Set ServerDelayMessage to CoolDelayMessage");
        coolButton.setStyleName("Default");
        coolButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ContainerContext containerContext
                        = (ContainerContext) getApplicationInstance().getContextProperty(ContainerContext.CONTEXT_PROPERTY_NAME);
                containerContext.setServerDelayMessage(new CoolDelayMessage(containerContext, "PLEASE WAIT"));
            }
        });
        add(coolButton);
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.webcontainer.ContainerContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.