Package org.apache.wicket.util.encoding

Examples of org.apache.wicket.util.encoding.UrlEncoder


        Charset charset = url.getCharset();

        Url mergedUrl = Url.parse(url.toString(), charset);

        UrlEncoder urlEncoder = UrlEncoder.QUERY_INSTANCE;

        Set<String> setParameters = new HashSet<String>();

        int indexedCount = params.getIndexedCount();
        if (indexedCount > 0)
        {
            String jsessionidString = null;
            List<String> segments = mergedUrl.getSegments();
            if (segments.size() > 0)
            {
                String lastSegment = segments.get(segments.size() - 1);
                int jsessionidIndex = lastSegment.indexOf(";jsessionid=");
                if (jsessionidIndex != -1)
                {
                   segments.set(segments.size() - 1, lastSegment.substring(0, jsessionidIndex));
                   jsessionidString = lastSegment.substring(jsessionidIndex);
                }
            }
            for (int i = 0; i < indexedCount; i++)
            {
                segments.add(params.get(i).toString());
            }
            if (jsessionidString != null)
            {
                segments.set(segments.size() - 1, segments.get(segments.size() - 1).concat(jsessionidString));
            }
        }

        for (INamedParameters.NamedPair pair : params.getAllNamed())
        {
            String key = urlEncoder.encode(pair.getKey(), charset);
            String value = urlEncoder.encode(pair.getValue(), charset);

            if (setParameters.contains(key)) {
                mergedUrl.addQueryParameter(key, value);
            } else {
                mergedUrl.setQueryParameter(key, value);
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.encoding.UrlEncoder

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.