froehlich 02/02/13 01:37:59 Added: src/java/org/apache/cocoon/acting SetCharacterEncodingAction.java Log: applied patch from MIYABE Tatsuhiko [[EMAIL PROTECTED]]. Form encoding enhancement! Revision Changes Path 1.1 xml-cocoon2/src/java/org/apache/cocoon/acting/SetCharacterEncodingAction.java Index: SetCharacterEncodingAction.java =================================================================== /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * * ------------------------------------------------------------------------- * * This software is published under the terms of the Apache Software License * * version 1.1, a copy of which has been included with this distribution in * * the LICENSE file. * *****************************************************************************/ package org.apache.cocoon.acting; import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.parameters.Parameterizable; import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Redirector; import org.apache.cocoon.environment.SourceResolver; import java.util.Map; /** * Sets the character encoding of parameters. * Components use this encoding as default after the action. * <p> * <b>Configuration options:</b> * <dl> * <dt> <i>form-encoding</i> (required) * <dd> The supposed encoding of the request parameter. * <dt> <i>form-encoding</i> (optional) * </dl> * These configuration options supported in both declaration and use time. * * @author <a href="mailto:[EMAIL PROTECTED]">MIYABE Tatsuhiko</a> */ public class SetCharacterEncodingAction extends ComposerAction implements ThreadSafe, Parameterizable { private String global_form_encoding = null; public void parameterize(Parameters parameters) throws ParameterException { // super.parameterize(parameters); global_form_encoding = parameters.getParameter("form-encoding", null); } /** * Set character encoding of current request. */ public Map act (Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters par) throws Exception { Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT); if (request != null) { String form_encoding = par.getParameter("form-encoding", global_form_encoding); if (form_encoding != null) { request.setCharacterEncoding(form_encoding); } } return null; } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]