Examples of WGARequestInformation


Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

        this.addWarning("Could not find tag by id: " + status.ref);
      }
          if (getTMLContext().getwgacore().isProfilingEnabled()) {
            HttpServletRequest request = getTMLContext().getrequest();
            if (request != null) {
              WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
              if (info != null) {
                long duration = System.currentTimeMillis() - status._startTime;
                IncludeInformation includeInfo = new IncludeInformation(getType(), status.ref, duration);
                info.getIncludes().add(includeInfo);
              }
            }
          }
    }
   
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

        }
       
        if (getTMLContext().getwgacore().isProfilingEnabled()) {
          HttpServletRequest request = getTMLContext().getrequest();
          if (request != null) {
            WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
            if (info != null) {
              long duration = System.currentTimeMillis() - status._startTime;
              IncludeInformation includeInfo = new IncludeInformation(getType(), status.ref, duration);
              info.getIncludes().add(includeInfo);
            }
          }
        }
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

        }
       
        if (getTMLContext().getwgacore().isProfilingEnabled()) {
          HttpServletRequest request = getTMLContext().getrequest();
          if (request != null) {
            WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
            if (info != null) {
              long duration = System.currentTimeMillis() - status._startTime;
              IncludeInformation includeInfo = new IncludeInformation(getType(), status.ref, duration);
              info.getIncludes().add(includeInfo);
            }
          }
        }
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

        }
       
        if (getTMLContext().getwgacore().isProfilingEnabled()) {
          HttpServletRequest request = getTMLContext().getrequest();
          if (request != null) {
            WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
            if (info != null) {
              long duration = System.currentTimeMillis() - status._startTime;
              IncludeInformation includeInfo = new IncludeInformation(getType(), tmllib.getName(), duration);
              includeInfo.setDesignDb(tmllib.getDatabase().getDbReference());
              info.getIncludes().add(includeInfo);
            }
          }
        }
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

     * @param request
     * @param response
     */
    private void dispatchAjaxForm(HttpServletRequest request, HttpServletResponse response) {
        // skip logging
        WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
        if (info != null) {
            info.setType(WGARequestInformation.TYPE_AJAXFORM);
        }

        if (FileUpload.isMultipartContent(request)) {
            DiskFileUpload dfu = new DiskFileUpload();
            // F000037B2
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

            // Set access logging for this request
            if (path.getDatabase() != null) {
                String accessLoggingEnabled = (String) path.getDatabase().getAttribute(WGACore.DBATTRIB_ENABLE_ACCESSLOGGING);
                if (accessLoggingEnabled != null) {
                    WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
                    if (info != null) {
                        info.setLoggingEnabled(Boolean.parseBoolean(accessLoggingEnabled));
                    }
                }
            }

            int iPathType = path.getPathType();

            // Treatment of special URL types
            String dbKey = path.getDatabaseKey();
            if (iPathType == WGPRequestPath.TYPE_INVALID) {
                throw new HttpErrorException(404, "Invalid path: " + path.getBasePath(), dbKey);
            }
            if (iPathType == WGPRequestPath.TYPE_INVALID_DB) {
                throw new HttpErrorException(404, "Specified database '" + dbKey + "' is unknown", null);
            }

            if (iPathType == WGPRequestPath.TYPE_UNKNOWN_CONTENT) {
                sendNoContentNotification(path, request, response, path.getDatabase());
                return;
            }

            if (iPathType == WGPRequestPath.TYPE_GOTO_HOMEPAGE) {
                iPathType = determineHomepage(request, path, iPathType);
            }

            if (iPathType == WGPRequestPath.TYPE_UNAVAILABLE_DB) {
                throw new HttpErrorException(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "The website is currently unavailable", path.getDatabaseKey());
            }

            if (iPathType == WGPRequestPath.TYPE_UNDEFINED_HOMEPAGE) {
                throw new HttpErrorException(HttpServletResponse.SC_NOT_FOUND, "No home page was defined for database '" + path.getDatabaseKey() + "'. Please specify an explicit content path.", path
                        .getDatabaseKey());
            }

            if (iPathType == WGPRequestPath.TYPE_TMLDEBUG) {
                _tmlDebugger.performDebugMode(request, response, session);
                return;
            }

            if (iPathType == WGPRequestPath.TYPE_JOBLOG) {
                sendJobLog(request, response, session);
                return;
            }

            if (iPathType == WGPRequestPath.TYPE_LOGOUT) {
                WGDatabase db = (WGDatabase) _core.getContentdbs().get(dbKey);
                String domain = (String) db.getAttribute(WGACore.DBATTRIB_DOMAIN);
                _core.logout(domain, session);
                removeSessionCookie(response, request.getSession(), db);

                iPathType = WGPRequestPath.TYPE_REDIRECT;
            }

            if (iPathType == WGPRequestPath.TYPE_FAVICON) {
                String faviconPath = determineFavicon(request);
                if (faviconPath != null) {
                    iPathType = WGPRequestPath.TYPE_REDIRECT;
                    path.setResourcePath(faviconPath);
                }
                else {
                    response.sendError(HttpServletResponse.SC_NOT_FOUND, "Favicon not defined");
                    return;
                }
            }

            // Treatment of base URL Types
            if (iPathType == WGPRequestPath.TYPE_REDIRECT) {
                String url = path.getResourcePath();
                if (path.appendQueryString() == true && request.getQueryString() != null && !request.getQueryString().equals("")) {
                    if (url.indexOf("?") != -1) {
                        url += "&" + request.getQueryString();
                    }
                    else {
                        url += "?" + request.getQueryString();
                    }
                }

                if (path.isPermanentRedirect()) {
                    sendPermanentRedirect(response, url);
                }
                else {
                    sendRedirect(response, url);
                }
            }
            else if (iPathType != WGPRequestPath.TYPE_RESOURCE && iPathType != WGPRequestPath.TYPE_STATICTML && !_core.getContentdbs().containsKey(path.getDatabaseKey())) {
                throw new HttpErrorException(404, "Database '" + dbKey + "' is unknown", null);
            }
            else {

                String requestMethod = request.getMethod().toLowerCase();
                switch (iPathType) {
                    case (WGPRequestPath.TYPE_TML):
                    case (WGPRequestPath.TYPE_TITLE_PATH):
                        if (path.isCompletePath() || !(requestMethod.equals("get") || requestMethod.equals("head"))) {

                            if (!path.isCompletePath()) {
                                _log.warn("Received " + request.getMethod() + " request to incomplete URL '" + path.getCompleteURL()
                                        + "' which cannot be redirected. Please use complete URLs on this HTTP method for consistent behaviour.");
                            }

                            dispatchTmlRequest(path, request, response, startDate);
                        }
                        else {
                            sendRedirect(response, path.expandToCompletePath(request));
                        }
                        break;

                    case (WGPRequestPath.TYPE_FILE):
                        dispatchFileRequest(path, request, response);
                        break;

                    case (WGPRequestPath.TYPE_CSS):
                    case (WGPRequestPath.TYPE_JS):
                        dispatchCssjsRequest(path, request, response);
                        break;

                    case (WGPRequestPath.TYPE_RESOURCE):
                        dispatchResourceRequest(path, request, response);
                        break;

                    case (WGPRequestPath.TYPE_STATICTML):
                        dispatchStaticTmlRequest(path, request, response);
                        break;

                    default:
                        throw new HttpErrorException(500, "Invalid url format", dbKey);
                }
            }

            // moved from finally block to ensure errorpage can be displayed
            commitResponse(response);
        }
        catch (HttpErrorException exc) {
            request.setAttribute(WGACore.ATTRIB_EXCEPTION, exc);
            if (!response.isCommitted()) {
                // throw exception to display errorpage - with senderror() the
                // applicationserver use the buildin errorpage
                if (exc.getCode() == HttpServletResponse.SC_NOT_FOUND || exc.getCode() == HttpServletResponse.SC_FORBIDDEN) {
                    _log.warn(exc.getLogMessage(request));
                    response.sendError(exc.getCode(), exc.getMessage());
                }
                else {
                    throw new ServletException(exc);
                }
            }
            else {
                _log.warn(exc.getLogMessage(request));
            }
        }
        catch (SocketException exc) {
            _log.warn("Socket Exception: " + exc.getMessage());
        }
        catch (Exception exc) {
            _log.error("Exception in processing of request URL " + String.valueOf(request.getRequestURL()), exc);
            request.setAttribute(WGACore.ATTRIB_EXCEPTION, exc);
            throw new ServletException(exc);
        }
        catch (Error err) {
            _log.error("Error in processing of request URL " + String.valueOf(request.getRequestURL()), err);
            request.setAttribute(WGACore.ATTRIB_EXCEPTION, err);
            throw new ServletException(err);
        }
        finally {
            WGARequestInformation reqInfo = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
            if (reqInfo != null) {
                reqInfo.setCommited(true);
            }
        }
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

            // database.getAttribute(WGACore.DBATTRIB_LOGGER);
            // if (logger != null) {
            // logger.logRequest(mimeType, path, request, content,
            // tmlUserProfile, tmlLib);
            // }
            WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
            if (info != null) {
                if (content == null || content.isDummy()) {
                    info.setType(WGARequestInformation.TYPE_TML);
                }
                else {
                    info.setType(WGARequestInformation.TYPE_CONTENT);
                }
                info.setDatabase(database);
                info.setMimeType(mimeType);
                info.setPath(path);
                info.setContent(content);
                info.setProfile(tmlUserProfile);
                info.setDesign(tmlLib);
                info.setAjax(ajax);
            }
        }
    }
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

    }

    private void dispatchFileRequest(WGPRequestPath path, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {

        WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);

        // Fetch database
        WGDatabase database = path.getDatabase();
        if (info != null) {
            info.setType(WGARequestInformation.TYPE_FILE);
            if (database != null) {
                info.setDatabase(database);
            }
        }

        // Parse container key - This may be a path when we have the /~file/
        // syntax. We use different parts depending on the type of container
        String containerKey = path.getContainerKey();
        List containerKeyElems = WGUtils.deserializeCollection(containerKey, "/");
        String containerKeyLastElement = (String) containerKeyElems.get(containerKeyElems.size() - 1);

        // Fetch the file container
        WGDocument fileContainer = database.getFileContainer(containerKeyLastElement);
        if (fileContainer == null) {

            // Container addressed by some kind of content key?
            WGContent content = getContentByAnyKey(containerKeyLastElement, database, request);

            // Container addressed by Title path?
            if (content == null) {
                TitlePathManager tpm = (TitlePathManager) database.getAttribute(WGACore.DBATTRIB_TITLEPATHMANAGER);
                if (tpm != null && tpm.isGenerateTitlePathURLs()) {
                    TitlePathManager.TitlePath url = tpm.parseTitlePathURL(containerKeyElems);
                    if (url != null) {
                        path.setTitlePathURL(url);
                        content = path.getContentByTitlePath(request);
                    }
                }
            }

            if (content == null || !content.mayBePublished(isBrowserInterface(request.getSession()) || isAuthoringMode(database.getDbReference(), request.getSession()), WGContent.DISPLAYTYPE_NONE)) {
                sendNoFileContainerNotification(path, request, response, database);
                return;
            }

            fileContainer = content;
        }

        if (info != null && fileContainer != null && fileContainer instanceof WGContent) {
            info.setContent((WGContent) fileContainer);
        }

        String fileName = path.getFileName();
        if (fileName == null || fileName.equals("")) {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No file name in file URL: " + path.getCompleteURL());
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

        }
    }

    private void dispatchResourceRequest(WGPRequestPath path, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception {

        WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
        if (info != null) {
            info.setType(WGARequestInformation.TYPE_RESOURCE);
        }

        // determine mimeType
        String resourcePath = path.getResourcePath();
        String mimeType = this.getServletContext().getMimeType(resourcePath);
View Full Code Here

Examples of de.innovationgate.wgpublisher.log.WGARequestInformation

       
    }

    private void dispatchCssjsRequest(WGPRequestPath path, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception {

        WGARequestInformation info = (WGARequestInformation) request.getAttribute(WGARequestInformation.REQUEST_ATTRIBUTENAME);
        if (info != null) {
            info.setType(WGARequestInformation.TYPE_SCRIPT);
        }

        // Fetch the database
        WGDatabase database = path.getDatabase();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.