Package org.auraframework.service

Examples of org.auraframework.service.SerializationService


    public AuraSerializationServiceImplTest(String name) {
        super(name);
    }

    public void testAuraSerializationService() {
        SerializationService serializationService = Aura.getSerializationService();
        assertTrue(serializationService instanceof SerializationServiceImpl);
    }
View Full Code Here


        assertTrue(serializationService instanceof SerializationServiceImpl);
    }

    public void testWriteJson() throws Exception {
        InstanceService instanceService = Aura.getInstanceService();
        SerializationService serializationService = Aura.getSerializationService();

        StringWriter out = new StringWriter();
        Map<String, Object> attributes = new HashMap<>();
        attributes.put("attr", "yo");
        Component c = instanceService.getInstance("test:child1", ComponentDef.class, attributes);
        serializationService.write(c, null, Component.class, out);
        goldFileJson(out.toString());
        attributes.put("invalid", "joe");
        c = instanceService.getInstance("test:child1", ComponentDef.class, attributes);
        serializationService.write(c, null, Component.class, out);
        assertFalse(out.toString().contains("invalid"));
    }
View Full Code Here

        } 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);
View Full Code Here

     *      javax.servlet.http.HttpServletResponse)
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
            IOException {
        SerializationService serializationService = Aura.getSerializationService();
        LoggingService loggingService = Aura.getLoggingService();
        ContextService contextService = Aura.getContextService();
        ServerService serverService = Aura.getServerService();
        AuraContext context = contextService.getCurrentContext();
        response.setCharacterEncoding(UTF_ENCODING);
        boolean written = false;
        setNoCache(response);

        try {
            if (context.getFormat() != Format.JSON) {
                throw new AuraRuntimeException("Invalid request, post must use JSON");
            }
            response.setContentType(getContentType(Format.JSON));
            String msg = messageParam.get(request);
            if (msg == null) {
                throw new AuraRuntimeException("Invalid request, no message");
            }
            //
            // handle transaction beacon JSON data
            // FIXME: this should be an action.
            //
            String beaconData = beaconParam.get(request);
            if (!"undefined".equals(beaconData) && !AuraTextUtil.isNullEmptyOrWhitespace(beaconData)) {
                loggingService.setValue(LoggingService.BEACON_DATA, new JsonReader().read(beaconData));
            }


            String fwUID = Aura.getConfigAdapter().getAuraFrameworkNonce();
            if (!fwUID.equals(context.getFrameworkUID())) {
                throw new ClientOutOfSyncException("Framework has been updated");
            }
            context.setFrameworkUID(fwUID);

            Message message;

            loggingService.startTimer(LoggingService.TIMER_DESERIALIZATION);
            try {
                message = serializationService.read(new StringReader(msg), Message.class);
            } finally {
                loggingService.stopTimer(LoggingService.TIMER_DESERIALIZATION);
            }

            // The bootstrap action cannot not have a CSRF token so we let it
View Full Code Here

TOP

Related Classes of org.auraframework.service.SerializationService

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.