Package dk.brics.jwig.server

Examples of dk.brics.jwig.server.RequestManager


    @HEAD
    @OPTIONS
    public Object augment() {
        Object o = next();
        ThreadContext c = ThreadContext.get();
        RequestManager manager = c.getRequestManager();
        Response r = getResponse();
        if (o instanceof XML) {
            // log.debug("Augmenting: " + r.getETag());
            XML xml = (XML) o;
            String home = manager.getWebSiteURL(c.getServletRequest()
                    .isSecure());
            xml = xml
                    .prependContent(
                            "//xhtml:head",
                            XML.parseTemplate(
                                    "<script type=\"text/javascript\" src=[JWIG]></script>")
                                    .plug("JWIG", manager.makeURL("jwigJS")));
            xml = xml
                    .prependContent(
                            "//xhtml:body", //It is safe to set a constant id given that only one body may exist
                            XML.parseTemplate("<div id=\"noscript\" style=\"color:red\">" +
                                    "[ This web application uses JavaScript, which is not enabled in your browser - "
                                    + "for full functionality, use a browser that supports JavaScript ]</div>" +
                                    "<script type=\"text/javascript\"> " +
                                    "document.getElementById(\"noscript\").style.display = \"none\";" +
                                    "</script>"));
            xml = xml.appendContent("//xhtml:body",
                    XML.parseTemplate(
                            "<script type=\"text/javascript\">"
                                    + "jwig.run('<[HOME]>');" + "</script>")
                            .plug("HOME", home));
            xml = xml.appendContent("//xhtml:body",
                                    XML.parseTemplate("<script type=\"text/javascript\">"
                                    + "jwig.submitHandlerData = <[SUB]> ;" + "</script>").plug("SUB",
                                                                                               generateSubmitHandlerData(r)));
            if (auto_refresh_sessions) {
                Set<Session> sessions = r.getSessions();
                if (sessions != null && sessions.size() > 0) {
                    int minutes = 0;
                    for (Session s : sessions) {
                        int min = s.getMinutes();
                        if (minutes < min || minutes == 0) {
                            minutes = min;
                        }
                    }
                    Object[] ss = { sessions.toArray() };
                    xml = xml
                            .appendContent(
                                    "//xhtml:head",
                                    XML.parseTemplate(
                                            "<script type=\"text/javascript\">"
                                                    + "jwig.startRefreshSessions('<[REFRESH_URL]>',<[MINUTES]>);"
                                                    + "</script>")
                                            .plug("REFRESH_URL",
                                                    manager.makeURL(
                                                            "touchSessions", ss)
                                                            .toString())
                                            .plug("MINUTES", minutes - 1));
                }
            }
View Full Code Here


        Map<SootClass, RequestManager> managers = new HashMap<SootClass, RequestManager>();
        for (SootClass webApp : webapps) {
            try {
                Class<? extends WebApp> webAppClass = Class.forName(
                        webApp.getName()).asSubclass(WebApp.class);
                RequestManager man = new RequestManager();
                man.introspectWebAppClass(webAppClass);
                managers.put(webApp, man);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(e);
            }
        }
View Full Code Here

     * @return the WebMethods of the {@link WebApp} whose names are matched by
     *         the {@link Automaton}
     */
    public Set<Method> getWebMethodsByName(Class<? extends WebApp> webAppClass,
            Automaton automaton) {
        final RequestManager manager = managers.get(webAppClass);
        if (manager == null)
            throw new IllegalArgumentException("WebApp: "
                    + webAppClass.getName() + " has not been registered");

        HashSet<Method> methodNameMatches = new HashSet<Method>();
        final List<RegisteredMethod> localWebMethods = manager.getWebMethods();
        for (RegisteredMethod methodNameMatch : localWebMethods) {
            final Method method = methodNameMatch.getMethod();
            if (automaton.run(method.getName())) {
                methodNameMatches.add(method);
            }
View Full Code Here

     *            {@link RequestManager} from
     * @return the {@link RequestManager} for the {@link WebApp}.
     */
    private RequestManager makeRequestManager(
            Class<? extends WebApp> webAppClass) {
        RequestManager man = new RequestManager();
        man.introspectWebAppClass(webAppClass);
        return man;
    }
View Full Code Here

TOP

Related Classes of dk.brics.jwig.server.RequestManager

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.