Package de.innovationgate.wga.common.beans.csconfig.v1

Examples of de.innovationgate.wga.common.beans.csconfig.v1.RemoteAction


      _elementMappingsModel.remove((ElementMapping) _tblElementMappings.getSelection()[0].getData());
    }
  }   
 
  private void handleAddMediaKey() {
    MediaKey key = new MediaKey();
    key.setKey("<key>");
    key.setMimeType("<mime type>");
    key.setBinary(false);
    key.setHttpLogin(false);   
    _mediaKeysModel.add(key);
  }
View Full Code Here


            }
        }
     
    if (this.pathType == TYPE_TML) {
       
        MediaKey mediaKey = (this.mediaKey != null ? this.mediaKey : core.getMediaKey((String) this.database.getAttribute(WGACore.DBATTRIB_DEFAULT_MEDIAKEY)));
            String layoutKey = (this.layoutKey != null ? this.layoutKey : "default");
     
      path.append(mediaKey.getKey()).append("/");
     
      if (this.content != null) {
            path.append(layoutKey).append("/");
            path.append(WGPDispatcher.buildContentURLID(content, mediaKey.getKey(), core.getDispatcher().isBrowserInterface(req.getSession())));
         
      }
      else {
          path.append(WGPDispatcher.buildLayoutURLID(this.database, layoutKey, this.requestLanguage, mediaKey.getKey()));
      }
    }
   
   
   
View Full Code Here

    private boolean isHttpLoginUsed(WGDatabase db) {
        if (db.getAttribute(WGACore.DBATTRIB_HTTPLOGIN) != null && db.getAttribute(WGACore.DBATTRIB_HTTPLOGIN).equals("true")) {
            return true;
        } else {
            for (String mediaKeyStr : core.getMediaKeys()) {
                MediaKey mediaKey = core.getMediaKey(mediaKeyStr);
                if (mediaKey != null && mediaKey.isHttpLogin()) {
                    return true;
                }
            }
        }       
        return false;       
View Full Code Here

                layoutKey = layoutKey + "//" + databaseKey;
            }
       
            mediaKey = tmlLib.getMediaKey().toLowerCase();
            if (_core.isMediaKeyDefined(mediaKey) == false) {
                _core.addMediaMapping(new MediaKey(mediaKey, "text/html", false, false), false);
            }

            // Build complete code
            StringBuffer tmlCode = new StringBuffer();
            tmlCode.append("<%@ taglib uri=\"http://www.innovationgate.de/wgpublisher/webtml/2.2\" prefix=\"tml\" %>");
View Full Code Here

    }

    public String getValueTitle(String value, Locale locale) {
        WGACore core = (WGACore) _reg.getContextObjects().get(WGACore.class);
        if (core != null) {
            MediaKey key = core.getMediaKey(value);
            if (key != null) {
                return value + " (" + key.getMimeType() + ")";
            }
        }

        return value;
View Full Code Here

        // Determine requested mime type and type key
        String mediaKey = path.getMediaKey();
        if (mediaKey == null) {
            mediaKey = database.getAttribute(WGACore.DBATTRIB_DEFAULT_MEDIAKEY).toString();
        }
        MediaKey mediaKeyObj = _core.getMediaKey(mediaKey);
        String mimeType = mediaKeyObj.getMimeType();
        response.setContentType(mimeType);

        // Look if a session cookie has to be set
        _core.setSessionCookie(request, response, database);

        // Determine the content for this request
        WGContent content = path.getContent();

        // Context request, if content key filled or we have a title path
        if (content != null) {

            if (!content.mayBePublished(isBrowserInterface(session) || isAuthoringMode(database.getDbReference(), session), WGContent.DISPLAYTYPE_NONE)) {
                sendNoContentNotification(path, request, response, database);
                return;
            }

            if (content.isVirtual()) {
                if (isBrowserInterface(session)) {
                    if (!content.getStatus().equals(WGContent.STATUS_DRAFT) && request.getParameter("forceVLink") == null) {

                        String url = getVirtualContentURL(request, database, path, content);
                        sendRedirect(response, url);
                        return;
                    }
                }
                else {
                    sendRedirect(response, buildVirtualLink(content, request, path.getMediaKey(), path.getLayoutKey()));
                    return;
                }
            }

        }

        // Contextless request. We use a dummy content
        else {
            content = database.getDummyContent(path.getRequestLanguage());
        }

        // Test browsability of content
        if (!content.isDummy() && getBrowsingSecurity(database) <= BrowsingSecurity.NO_BROWSING) {
            throw new HttpErrorException(java.net.HttpURLConnection.HTTP_FORBIDDEN, "Browsing not allowed in database '" + path.getDatabaseKey() + "'", path.getDatabaseKey());
        }

        // Drop cache if requested by url param
        if (request.getQueryString() != null && request.getQueryString().toLowerCase().indexOf("dropcache") != -1 && isAdminLoggedIn(request)) {
            content.dropCache();
        }

        // Personalize
        TMLUserProfile tmlUserProfile = null;
        try {
            if (_core.isPersonalisationEnabled()) {
                tmlUserProfile = this.fetchUserProfile(request, response, database, session);
                if (tmlUserProfile != null && !tmlUserProfile.getprofile().isDeleted()) {
                    if (!isBrowserInterface(session)) {
                        this.registerHit(tmlUserProfile.getprofile(), database, content);
                    }
                }
            }
        }
        catch (WGAPIException e) {
            _log.error("Unable to personalize tmlrequest.", e);
        }

        // Set context attributes for tml
        request.setAttribute(WGACore.ATTRIB_MAINCONTEXT, content);
        request.setAttribute(WGACore.ATTRIB_WGPPATH, path.getPublisherURL());
        request.setAttribute(WGACore.ATTRIB_TAGIDS, WGUtils.createSynchronizedMap());
        request.setAttribute(WGACore.ATTRIB_TMLCONTEXTS, WGUtils.createSynchronizedMap());
        request.setAttribute(WGACore.ATTRIB_REQUESTURL, completeUrl);
        request.setAttribute(WGACore.ATTRIB_MIMETYPE, mimeType);
        request.setAttribute(WGACore.ATTRIB_MEDIAKEY, mediaKey);
        request.setAttribute(WGACore.ATTRIB_REQUESTTYPE, REQUESTTYPE_TML);

        if (mediaKeyObj.isBinary()) {
            request.setAttribute(WGACore.ATTRIB_SERVLETRESPONSE, response);
        }

        // Determine tml design for this request
        WGTMLModule tmlLib = null;
        if (path.getLayoutKey() != null) {
            tmlLib = (WGTMLModule) database.getDesignObject(WGDocument.TYPE_TML, path.getLayoutKey(), mediaKey);
            if (tmlLib != null && tmlLib.isDirectAccessAllowed() == false) {
                throw new HttpErrorException(java.net.HttpURLConnection.HTTP_FORBIDDEN, "This design is not allowed for direct access: " + tmlLib.getName() + " (" + tmlLib.getMediaKey() + ")", path
                        .getDatabaseKey());
            }
        }
        else {
            WGStructEntry entry = content.getStructEntry();
            if (entry == null) {
                throw new HttpErrorException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Content " + content.getContentKey().toString() + " has no struct entry", path.getDatabaseKey());
            }
            tmlLib = entry.getOuterLayout(mediaKey);
        }

        if (tmlLib == null || tmlLib.isDummy()) {
            if (path.getLayoutKey() != null) {
                throw new HttpErrorException(404, "No WebTML layout '" + path.getLayoutKey() + "' for media key '" + mediaKey + "' available in app '" + database.getDbReference() + "'", path.getDatabaseKey());
            }
            else {
                throw new HttpErrorException(500, "Outer layout of struct entry '" + content.getStructEntry().getTitle() + "(" + content.getStructEntry().getStructKey() + ")"
                        + "' not available for media key '" + mediaKey + "'", path.getDatabaseKey());
            }
        }

        request.setAttribute(WGACore.ATTRIB_OUTER_DESIGN, tmlLib.getName());


        // TML Cache control
        if (tmlLib.isCacheable()) {
            response.setHeader("Cache-Control", "must-revalidate");

            long lastModified;
            // determine lastModified
            // - last modified of binary response depends only on resource
            // change date
            // - last change date of textual response additionally depends on
            // character encoding change date
            if (isBinary(response)) {
                lastModified = getCore().getDeployer().getLastChangedOrDeployed(database).getTime();
            }
            else {
                lastModified = Math.max(getCore().getDeployer().getLastChangedOrDeployed(database).getTime(), _core.getCharacterEncodingLastModified());
                lastModified = Math.max(lastModified, _core.getDesignEncodingLastModified(database.getDbReference()));
            }

            // Test modified since
            if (browserCacheIsValid(request, lastModified)) {
                response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                return;
            }
            else {
                response.setDateHeader("Last-Modified", lastModified);
                response.setHeader("ETag", '"' + String.valueOf(lastModified) + '"');
            }
        }
        else {
            response.setHeader("Pragma", "No-Cache");
            if (mediaKeyObj.isBinary()) {
                response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
            }
            else {
                response.setHeader("Cache-Control", "No-Cache");
            }
        }

        // check if we have an ajaxcall
        String encAjaxInfo = request.getParameter("$ajaxInfo");
        if (encAjaxInfo != null) {
            tmlLib = processAjaxCall(request, database, encAjaxInfo);
            ajax = true;
        }

        // Update usage statistics
        getCore().getUsageStatistics().addRequestStatistic(request, session, database, tmlUserProfile);

        // Dispatch to jsp
        String targetJSP = _core.getDeployer().locateTmlResource(tmlLib);

        try {
            if (targetJSP != null) {
                if (!"HEAD".equalsIgnoreCase(request.getMethod())) {
                    if (mediaKeyObj.isBinary()) {
                        if (request instanceof RenderServletRequestWrapper) {
                            HttpServletRequestWrapper wrapper = (HttpServletRequestWrapper) request;
                            wrapper.getRequest().getRequestDispatcher(targetJSP).include(wrapper.getRequest(), new DummyServletResponse(response));
                        }
                        else {
View Full Code Here

        // determine contentType (mimeType)
        if (mediaKey == null) {
           
            mediaKey = tag.getMainMediaKey();
        }
        MediaKey key = getwgacore().getMediaKey(mediaKey);       
        String contentType = key.getMimeType();
       
        /** this works on WAS - on tomcat the result is an endless loop        
        // create wrapper for request and response
        RenderServletRequestWrapper req = new RenderServletRequestWrapper(this.getrequest(), url);       
        RenderServletResponseWrapper res = new RenderServletResponseWrapper(this.getresponse());
View Full Code Here

        return new ApplogPage(pageReached, endReached, totalLinesCount, messages);
    }

    public MediaKey getMediaKey(String key) {

        MediaKey mediaKey = this.systemMediaKeys.get(key);
        if (mediaKey == null) {
           mediaKey = this.customMediaKeys.get(key);
        }
        return mediaKey;
    }
View Full Code Here

     
        // get mapping class loader
        buildLibraryLoaders();

        // Default media mappings
        this.systemMediaKeys.put(ENCODER_HTML, new MediaKey(ENCODER_HTML, "text/html", false, false));
        this.systemMediaKeys.put(ENCODER_XML, new MediaKey(ENCODER_XML, "text/xml", false, true));
        this.systemMediaKeys.put("wml", new MediaKey("wml", "text/wml", false, false));
        this.systemMediaKeys.put("pdf", new MediaKey("pdf", "application/pdf", true, true));
       
        log.info("Registering defaultAnalyzer to '" + defaultAnalyzer.getClass().getName() + "'");
       
    }
View Full Code Here

        if (system) {
            this.systemMediaKeys.put(mediaKey.getKey(), mediaKey);
            return true;
        }
        else if (systemMediaKeys.containsKey(mediaKey.getKey())) {
            MediaKey key = systemMediaKeys.get(mediaKey.getKey());
            if (!key.equals(mediaKey)) {
                getLog().warn("Cannot add media key '" + mediaKey.getKey() + "' because the key is already used in WGA configuration with different data");
            }
            return false;
        }
        else {
View Full Code Here

TOP

Related Classes of de.innovationgate.wga.common.beans.csconfig.v1.RemoteAction

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.