Package org.auraframework.def

Examples of org.auraframework.def.BaseComponentDef


            send404(request, response);
            return;
        }

        DefDescriptor<? extends BaseComponentDef> defDescriptor;
        BaseComponentDef def;

        //
        // Now check and fetch parameters.
        // These are not formally part of the Aura API, as this is the initial
        // request. All we need are a tag/type or descriptor. Except, of course,
        // the special case of nocache, which is required by the appcache handling.
        // I would love for a simpler way to be figured out.
        //
        try {
            String nocache = nocacheParam.get(request);
            if (nocache != null && !nocache.isEmpty()) {
                handleNoCacheRedirect(nocache, response);
                return;
            }
            tagName = tag.get(request);
            defType = defTypeParam.get(request, DefType.COMPONENT);
            if (tagName == null || tagName.isEmpty()) {
                throw new AuraRuntimeException("Invalid request, tag must not be empty");
            }

            Mode mode = context.getMode();
            if (!isValidDefType(defType, mode)) {
                send404(request, response);
                return;
            }

            if (context.getFormat() != Format.HTML) {
                throw new AuraRuntimeException("Invalid request, GET must use HTML");
            }

            defDescriptor = definitionService.getDefDescriptor(tagName,
                    defType == DefType.APPLICATION ? ApplicationDef.class : ComponentDef.class);
        } catch (RequestParam.InvalidParamException ipe) {
            handleServletException(new SystemErrorException(ipe), false, context, request, response, false);
            return;
        } catch (RequestParam.MissingParamException mpe) {
            handleServletException(new SystemErrorException(mpe), false, context, request, response, false);
            return;
        } catch (Throwable t) {
            handleServletException(new SystemErrorException(t), false, context, request, response, false);
            return;
        }

        // Knowing the app, we can do the HTTP headers, so of which depend on
        // the app in play, so we couldn't do this earlier.
        setBasicHeaders(defDescriptor, request, response);

        try {
            context.setFrameworkUID(Aura.getConfigAdapter().getAuraFrameworkNonce());

            context.setApplicationDescriptor(defDescriptor);
            definitionService.updateLoaded(defDescriptor);
            def = definitionService.getDefinition(defDescriptor);
           
            if (!context.isTestMode() && !context.isDevMode()) {
              assertAccess(def);
            }
        } catch (QuickFixException qfe) {
            //
            // Whoops. we need to set up our preloads correctly here.
            //
            setupQuickFix(context);
            handleServletException(qfe, true, context, request, response, false);
            return;
        } catch (Throwable t) {
            handleServletException(t, false, context, request, response, false);
            return;
        }

        SerializationService serializationService = Aura.getSerializationService();
        LoggingService loggingService = Aura.getLoggingService();

        try {
            if (shouldCacheHTMLTemplate(request)) {
                setLongCache(response);
            } else {
                setNoCache(response);
            }
            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION);
            loggingService.startTimer(LoggingService.TIMER_SERIALIZATION_AURA);
            // Prevents Mhtml Xss exploit:
            PrintWriter out = response.getWriter();
            out.write("\n    ");
            serializationService.write(def, getComponentAttributes(request),
                    def.getDescriptor().getDefType().getPrimaryInterface(), out);
        } catch (Throwable e) {
            handleServletException(e, false, context, request, response, true);
        } finally {
            loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION_AURA);
            loggingService.stopTimer(LoggingService.TIMER_SERIALIZATION);
View Full Code Here

TOP

Related Classes of org.auraframework.def.BaseComponentDef

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.