Package com.volantis.mcs.wbsax

Examples of com.volantis.mcs.wbsax.WBSAXString


        AttributeStartCode hrefStartCode
             = attributeStartFactory.create("href", null);
        optimiser.addAttribute(hrefStartCode);
       
        // send url to optimiser
        optimiser.addAttributeValue(new WBSAXString(codec,
            "http://www.my.com/page.jsp;jsessionid=123?parm=value#ref"));
       
        // Send a title event to optimiser
        AttributeStartCode titleStartCode
            = attributeStartFactory.create("title", null);
        optimiser.addAttribute(titleStartCode);
       
        // Send the value of the title to optimiser
        optimiser.addAttributeValue(new WBSAXString(codec, "my title"));

        // Send another href to optimiser
        optimiser.addAttribute(hrefStartCode);
       
        // send url to optimiser
        optimiser.addAttributeValue(new WBSAXString(codec,
            "http://www.my.com/page2.jsp;jsessionid=123?parm=value#ref2"));
       
        // Get the events      
        Iterator events = contentHandler.getEvents();
       
        // Check startDocument
        assertEquals("Wrong versionCode", versionCode,
                     (VersionCode)events.next());
        assertEquals("Wrong publicIdCode", publicIdCode,
                     (PublicIdCode)events.next());
        assertEquals("Wrong codec", codec, (Codec)events.next());       

        // Skip past the StringTable created by the optimiser
        assertTrue("StringTable should be next",
                   events.next() instanceof StringTable);
       
        // Check href
        AttributeStartCode aStartCode = (AttributeStartCode)events.next();
        assertEquals("Wrong AttributeStartCode integer", 0x4A,
                     aStartCode.getInteger());
        assertEquals("Wrong AttributeStartCode name", "href",
                     aStartCode.getName());
        assertNull("Wrong AttributeStartCode value prefix",
                   aStartCode.getValuePrefix());
       
        // Check prefix
        assertEquals("Wrong url prefix",
                     new WBSAXString(codec, "http://www.my.com/page.jsp"),
                     (WBSAXString)events.next());
       
        // Check jsessionid
        StringReference stringReference1 = (StringReference)events.next();       
        assertEquals("Wrong url jsessionid",
                     new WBSAXString(codec, ";jsessionid=123"),
                     stringReference1.resolveString());
       
        // Check suffix
        assertEquals("Wrong url suffix",
                     new WBSAXString(codec, "?parm=value#ref"),
                     (WBSAXString)events.next());
       
        // Check title
        aStartCode = (AttributeStartCode)events.next();
        assertEquals("Wrong AttributeStartCode integer", 0x36,
                     aStartCode.getInteger());
        assertEquals("Wrong AttributeStartCode name", "title",
                     aStartCode.getName());
        assertNull("Wrong AttributeStartCode value prefix",
                   aStartCode.getValuePrefix());
       
        // Check title's value       
        assertEquals("Wrong title",
                     new WBSAXString(codec, "my title"),
                     (WBSAXString)events.next());
       
        // Check href
        aStartCode = (AttributeStartCode)events.next();
        assertEquals("Wrong AttributeStartCode integer", 0x4A,
                     aStartCode.getInteger());
        assertEquals("Wrong AttributeStartCode name", "href",
                     aStartCode.getName());
        assertNull("Wrong AttributeStartCode value prefix",
                   aStartCode.getValuePrefix());
       
        // Check prefix
        assertEquals("Wrong url prefix",
                     new WBSAXString(codec, "http://www.my.com/page2.jsp"),
                     (WBSAXString)events.next());
       
        // Check jsessionid, can now check logical and physical refs to ensure
        // jsession id was added only once to string table
        StringReference stringReference2 = (StringReference)events.next();       
        assertEquals("Wrong logical ref",
                     stringReference1.resolveLogicalIndex(),
                     stringReference2.resolveLogicalIndex());
        assertEquals("Wrong physical ref",
                     stringReference1.resolvePhysicalIndex(),
                     stringReference2.resolvePhysicalIndex());
        assertEquals("Wrong url jsessionid",
                     new WBSAXString(codec, ";jsessionid=123"),
                     stringReference2.resolveString());
       
        // Check suffix
        assertEquals("Wrong url suffix",
                     new WBSAXString(codec, "?parm=value#ref2"),
                events.next());

        optimiser.endDocument();
    }
View Full Code Here


        });
    }

    protected DissectableString createDissectableString(String string)
            throws Exception {
        WBSAXString wbsaxString = strings.create(string);
        DissectableString dstring = new DissectableWBSAXString(wbsaxString);
        return dstring;
    }
View Full Code Here

        super.tearDown();
    }

    protected DissectableString createDissectableString(String string)
            throws Exception {
        WBSAXString wbsaxString = strings.create(string);
        DissectableWBSAXValueBuffer buffer = new DissectableWBSAXValueBuffer();
        buffer.append(wbsaxString);
        DissectableString dstring = new DissectableWBDOMCompositeString(buffer);
        return dstring;
    }
View Full Code Here

                    logger.debug("Adding attribute value opaque: " +
                                 "using accesskey: " + accessKeyValue);
                }
                flushCache(false);
                AccesskeyOpaqueValue value = (AccesskeyOpaqueValue) part;
                value.setValue(new WBSAXString(codec,
                                               String.valueOf(accessKeyValue)));
                super.addAttributeValueOpaque(value);
            }
        } else {
            if (logger.isDebugEnabled()) {
View Full Code Here

                if (logger.isDebugEnabled()) {
                    logger.debug("Adding content value opaque: " +
                                 "using accesskey: " + accessKeyValue);
                }
                String accessKeyPrefix = accessKeyValue + " ";
                value.setValue(new WBSAXString(codec, accessKeyPrefix));
                super.addContentValueOpaque(part);
            }
        } else {
            // We are not interested in this opaque value, just pass it thru
            if (logger.isDebugEnabled()) {
View Full Code Here

                 = SessionIdentifierSearcherFactory.create();           
            SessionIdentifierURL splitURL
                 = searcher.getJSessionId(part.toString());
           
            // Add the part of the url before the jsessionid as an inline string
            WBSAXString prefix = strings.create(splitURL.getPrefix());
            handler.addAttributeValue(prefix);
           
            // If present, add jsessionid to the string table  
            if (splitURL.hasJsessionid()) {
                StringReference jsessionid
                     = references.createReference(splitURL.getJsessionid());
                handler.addAttributeValue(jsessionid);
            }
           
            // If present, add the part of the url after the jsessionid as an
            // inline string
            if (splitURL.hasSuffix())  {
                WBSAXString suffix = strings.create(splitURL.getSuffix());
                handler.addAttributeValue(suffix);                  
            }
            expectUrl = false;
        } else {
            handler.addAttributeValue(part);
View Full Code Here

        SessionIdentifierURL splitURL
             = searcher.getJSessionId(dopaque.getString());
           
        StringFactory strings = inputReferences.getStringFactory();
        // Add the part of the url before the jsessionid as an inline string
        WBSAXString prefix = strings.create(splitURL.getPrefix());
        visitString(prefix);
           
        // If present, add jsessionid to the string table  
        if (splitURL.hasJsessionid()) {
            StringReference jsessionid
                 = inputReferences.getReference(splitURL.getJsessionid());
            visitReference(jsessionid);
        }
           
        // If present, add the part of the url after the jsessionid as an
        // inline string
        if (splitURL.hasSuffix())  {
            WBSAXString suffix = strings.create(splitURL.getSuffix());
            visitString(suffix);                  
        }
    }
View Full Code Here

        SessionIdentifierURL splitURL
             = searcher.getJSessionId(dopaque.getString());
           
        // Add the part of the url before the jsessionid as an inline string
        StringFactory strings = outputReferences.getStringFactory();
        WBSAXString prefix = strings.create(splitURL.getPrefix());
        visitString(prefix);
           
        // If present, add jsessionid to the string table  
        if (splitURL.hasJsessionid()) {
            StringReference jsessionid
                 = outputReferences.createReference(splitURL.getJsessionid());
            visitReference(jsessionid);
        }
           
        // If present, add the part of the url after the jsessionid as an
        // inline string
        if (splitURL.hasSuffix())  {
            WBSAXString suffix = strings.create(splitURL.getSuffix());
            visitString(suffix);                  
        }
    }
View Full Code Here

                    throws WBSAXException {
                if (startIndex > 0 || endIndex < childLength) {
                    // serialise substring
                    String substring = string.getString().substring(
                            startIndex, endIndex);
                    WBSAXString saxSubString = strings.create(substring);
                    elementValueSerialiser.visitString(saxSubString);
                } else {
                    // serialise entire string
                    elementValueSerialiser.visitString(string);
                }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.wbsax.WBSAXString

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.