/*
   Copyright 2006 Attila Szegedi

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
package org.szegedi.spring.web.jsflow;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import org.szegedi.spring.web.jsflow.support.AbstractFlowStateStorage;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

/**
 * An implementation of the flowstate storage that returns the BASE64-encoded
 * serialized state as the ID. This way, the ID encapsulates the whole state,
 * and the client will store it as part of the rendered HTML page, with no state
 * whatsoever remaining on the server, allowing for truly massive scalability.
 * Note however that in order to prevent the users from tampering with the
 * flowstates while they are on the client side, or forging false flowstates,
 * you should install at least a digital signature providing
 * {@link org.szegedi.spring.web.jsflow.codec.IntegrityCodec} into this storage
 * instance, although you can go for a full codec stack including compression,
 * encryption, and digital signature by using a
 * {@link org.szegedi.spring.web.jsflow.codec.CompositeCodec} (that you can
 * further enhance with {@link org.szegedi.spring.web.jsflow.codec.PooledCodec
 * pooling}).
 * 
 * @author Attila Szegedi
 * @version $Id$
 */
public class ClientSideFlowStateStorage extends AbstractFlowStateStorage {
    @Override
    protected byte[] getSerializedState(final HttpServletRequest request, final String id) throws IOException {
        return new BASE64Decoder().decodeBuffer(id);
    }

    @Override
    protected String storeSerializedState(final HttpServletRequest request, final byte[] state) {
        return new BASE64Encoder().encodeBuffer(state);
    }
}

@@ -645,37 +645,8 @@
 %0D%0A%0D%0A
-import java.io.IOException;%0D%0A
 impo
@@ -688,16 +688,62 @@
 quest;%0D%0A
+import org.springframework.util.Base64Utils;%0D%0A
 import o
@@ -809,72 +809,8 @@
 ge;%0D
-%0Aimport sun.misc.BASE64Decoder;%0D%0Aimport sun.misc.BASE64Encoder;%0D
 %0A%0D%0A/
@@ -1738,11 +1738,10 @@
 %0D%0A *
- 
 %0D%0A
+
  * @
@@ -1972,77 +1972,54 @@
 id) 
-throws IOException %7B%0D%0A        return new BASE64Decoder().decodeBuffer
+%7B%0D%0A        return Base64Utils.decodeFromString
 (id)
@@ -2163,40 +2163,34 @@
 urn 
-new BASE64Encoder().encodeBuffer
+Base64Utils.encodeToString
 (sta

Remove dependency on sun.misc Base64 codec