Package org.apache.cocoon.components.notification

Examples of org.apache.cocoon.components.notification.SimpleNotifyingBean


        if (brokenLinkGenerate) {
            String brokenFile = NetUtils.decodePath(filename);
            if (brokenLinkExtension != null) {
                brokenFile = brokenFile + brokenLinkExtension;
            }
            SimpleNotifyingBean n = new SimpleNotifyingBean(this);
            n.setType("resource-not-found");
            n.setTitle("Resource not Found");
            n.setSource("Cocoon commandline (Main.java)");
            n.setMessage("Page Not Available.");
            n.setDescription("The requested resource couldn't be found.");
            n.addExtraDescription(Notifying.EXTRA_REQUESTURI, uri);
            n.addExtraDescription("missing-file", uri);

            ModifiableSource source = target.getSource(filename);
            try {
                OutputStream stream = source.getOutputStream();
View Full Code Here


            //String brokenFile = NetUtils.decodePath(destinationURI);

            if (brokenLinkExtension != null) {
                target.setExtraExtension(brokenLinkExtension);
            }
            SimpleNotifyingBean n = new SimpleNotifyingBean(this);
            n.setType("resource-not-found");
            n.setTitle("Resource not Found");
            n.setSource("Cocoon commandline (Main.java)");
            n.setMessage("Page Not Available.");
            n.setDescription("The requested resource couldn't be found.");
            n.addExtraDescription(Notifying.EXTRA_REQUESTURI, target.getSourceURI());
            n.addExtraDescription("missing-file", target.getSourceURI());

            ModifiableSource source = getSource(target);
            OutputStream stream = null;
            PrintStream out = null;
            try {
View Full Code Here

        // Check if cocoon was initialized
        if (this.cocoon == null) {
            if(manageExceptions){
                res.reset();

                SimpleNotifyingBean n = new SimpleNotifyingBean(this);
                n.setType("fatal");
                n.setTitle("Internal servlet error");
                n.setSource("Cocoon servlet");
                n.setMessage("Cocoon was not initialized.");
                n.setDescription("Cocoon was not initialized. Cannot process request.");
                n.addExtraDescription("request-uri", request.getRequestURI());

                res.setContentType("text/html");
                res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                Notifier.notify(n, res.getOutputStream(), "text/html");
            } else {
                res.sendError
                 (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 "The Cocoon engine said it failed to process the request for an unknown reason." );
                res.flushBuffer();
            }
            return;
        }

        // We got it... Process the request
        String uri = request.getServletPath();
        if (uri == null) {
            uri = "";
        }
        String pathInfo = request.getPathInfo();
        if (pathInfo != null) {
            // VG: WebLogic fix: Both uri and pathInfo starts with '/'
            // This problem exists only in WL6.1sp2, not in WL6.0sp2 or WL7.0b.
            if (uri.length() > 0 && uri.charAt(0) == '/') {
                uri = uri.substring(1);
            }
            uri += pathInfo;
        }

        if (uri.length() == 0) {
            /* empty relative URI
                 -> HTTP-redirect from /cocoon to /cocoon/ to avoid
                    StringIndexOutOfBoundsException when calling
                    "".charAt(0)
               else process URI normally
            */
            String prefix = request.getRequestURI();

            if (prefix == null) {
                prefix = "";
            }

            res.sendRedirect(res.encodeRedirectURL(prefix + "/"));
            return;
        }

        String contentType = null;
        ContextMap ctxMap = null;
        try {
            try {
                if (uri.charAt(0) == '/') {
                    uri = uri.substring(1);
                }

                Environment env = getEnvironment(URLDecoder.decode(uri), request, res);

                // Initialize a fresh log context containing the object model : it
                // will be used by the CocoonLogFormatter
                ctxMap = ContextMap.getCurrentContext();
                // Add thread name (default content for empty context)
                String threadName = Thread.currentThread().getName();
                ctxMap.set("threadName", threadName);
                // Add the object model
                ctxMap.set("objectModel", env.getObjectModel());
                // Add a unique request id (threadName + currentTime
                ctxMap.set("request-id", threadName + System.currentTimeMillis());

                if (this.cocoon.process(env)) {
                    contentType = env.getContentType();
                } else {
                    //NKB Should not get here?
                    log.fatalError("The Cocoon engine said it failed to process the request for an unknown reason.");

                    if(manageExceptions){
                      res.reset();

                      SimpleNotifyingBean n = new SimpleNotifyingBean(this);
                      n.setType("error");
                      n.setTitle("Cocoon confusion");
                      n.setSource("Cocoon servlet");
                      n.setMessage("Cocoon engine failed in process.");
                      n.setDescription("The Cocoon engine said it failed to process the request for an unknown reason.");
                      n.addExtraDescription("request-uri", request.getRequestURI());
                      n.addExtraDescription("path-info", uri);

                      res.setContentType("text/html");
                      res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                      Notifier.notify(n, res.getOutputStream(), "text/html");
                    } else {
                      res.sendError
                       (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                        "The Cocoon engine said it failed to process the request for an unknown reason." );
                      res.flushBuffer();
                    }
                    return;

                }
            } catch (ResourceNotFoundException rse) {
                if (log.isWarnEnabled()) {
                    log.warn("The resource was not found", rse);
                }

                if(manageExceptions){
                  res.reset();

                  SimpleNotifyingBean n = new SimpleNotifyingBean(this);
                  n.setType("resource-not-found");
                  n.setTitle("Resource not found");
                  n.setSource("Cocoon servlet");
                  n.setMessage("Resource not found");
                  n.setDescription("The requested URI \""
                                   + request.getRequestURI()
                                   + "\" was not found.");
                  n.addExtraDescription("request-uri", request.getRequestURI());
                  n.addExtraDescription("path-info", uri);

                  res.setContentType("text/html");
                  res.setStatus(HttpServletResponse.SC_NOT_FOUND);
                  Notifier.notify(n, res.getOutputStream(), "text/html");
                } else {
View Full Code Here

            //String brokenFile = NetUtils.decodePath(destinationURI);

            if (brokenLinkExtension != null) {
                target.setExtraExtension(brokenLinkExtension);
            }
            SimpleNotifyingBean n = new SimpleNotifyingBean(this);
            n.setType("resource-not-found");
            n.setTitle("Resource not Found");
            n.setSource("Cocoon commandline (Main.java)");
            n.setMessage("Page Not Available.");
            n.setDescription("The requested resource couldn't be found.");
            n.addExtraDescription(Notifying.EXTRA_REQUESTURI, target.getSourceURI());
            n.addExtraDescription("missing-file", target.getSourceURI());

            ModifiableSource source = getSource(target);
            try {
                OutputStream stream = source.getOutputStream();
View Full Code Here

            //String brokenFile = NetUtils.decodePath(destinationURI);

            if (brokenLinkExtension != null) {
                target.setExtraExtension(brokenLinkExtension);
            }
            SimpleNotifyingBean n = new SimpleNotifyingBean(this);
            n.setType("resource-not-found");
            n.setTitle("Resource not Found");
            n.setSource("Cocoon commandline (Main.java)");
            n.setMessage("Page Not Available.");
            n.setDescription("The requested resource couldn't be found.");
            n.addExtraDescription(Notifying.EXTRA_REQUESTURI, target.getSourceURI());
            n.addExtraDescription("missing-file", target.getSourceURI());

            ModifiableSource source = getSource(target);
            OutputStream stream = null;
            PrintStream out = null;
            try {
View Full Code Here

            //String brokenFile = NetUtils.decodePath(destinationURI);
           
            if (brokenLinkExtension != null) {
                target.setExtraExtension(brokenLinkExtension);
            }
            SimpleNotifyingBean n = new SimpleNotifyingBean(this);
            n.setType("resource-not-found");
            n.setTitle("Resource not Found");
            n.setSource("Cocoon commandline (Main.java)");
            n.setMessage("Page Not Available.");
            n.setDescription("The requested resource couldn't be found.");
            n.addExtraDescription(Notifying.EXTRA_REQUESTURI, target.getSourceURI());
            n.addExtraDescription("missing-file", target.getSourceURI());

            ModifiableSource source = getSource(target);
            try {
                OutputStream stream = source.getOutputStream();
View Full Code Here

        if (brokenLinkGenerate) {
            String brokenFile = NetUtils.decodePath(filename);
            if (brokenLinkExtension != null) {
                brokenFile = brokenFile + brokenLinkExtension;
            }
            SimpleNotifyingBean n = new SimpleNotifyingBean(this);
            n.setType("resource-not-found");
            n.setTitle("Resource not Found");
            n.setSource("Cocoon commandline (Main.java)");
            n.setMessage("Page Not Available.");
            n.setDescription("The requested resource couldn't be found.");
            n.addExtraDescription(Notifying.EXTRA_REQUESTURI, uri);
            n.addExtraDescription("missing-file", uri);

            ModifiableSource source = getSource(target, filename);
            try {
                OutputStream stream = source.getOutputStream();
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.notification.SimpleNotifyingBean

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.