1 16 package org.apache.cocoon.acting; 17 18 import org.apache.avalon.framework.parameters.ParameterException; 19 import org.apache.avalon.framework.parameters.Parameterizable; 20 import org.apache.avalon.framework.parameters.Parameters; 21 import org.apache.avalon.framework.thread.ThreadSafe; 22 23 import org.apache.cocoon.environment.ObjectModelHelper; 24 import org.apache.cocoon.environment.Redirector; 25 import org.apache.cocoon.environment.Request; 26 import org.apache.cocoon.environment.SourceResolver; 27 28 import java.util.Map ; 29 30 45 public class SetCharacterEncodingAction extends ServiceableAction implements ThreadSafe, Parameterizable { 46 private String global_form_encoding = null; 47 48 public void parameterize(Parameters parameters) 49 throws ParameterException { 50 52 global_form_encoding = parameters.getParameter("form-encoding", null); 53 } 54 55 58 public Map act (Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters par) throws Exception { 59 Request request = ObjectModelHelper.getRequest(objectModel); 60 if (request != null) { 61 String form_encoding = par.getParameter("form-encoding", global_form_encoding); 62 if (form_encoding != null) { 63 request.setCharacterEncoding(form_encoding); 64 } 65 } 66 67 return null; 68 } 69 } 70 | Popular Tags |