More fixes to loading template/script files

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6201 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mike Hatfield
2007-07-09 16:19:29 +00:00
parent d533004036
commit 8773d4b4a0
2 changed files with 22 additions and 3 deletions

View File

@@ -34,9 +34,11 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.repository.ScriptLocation;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.ClassPathResource;
@@ -322,7 +324,14 @@ public class ClassPathStore implements WebScriptStore, InitializingBean
*/
public Reader getReader()
{
return new InputStreamReader(getInputStream());
try
{
return new InputStreamReader(getInputStream(), "UTF-8");
}
catch (UnsupportedEncodingException e)
{
throw new AlfrescoRuntimeException("Unsupported Encoding", e);
}
}
@Override

View File

@@ -28,10 +28,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
@@ -587,7 +589,7 @@ public class RepoStore implements WebScriptStore, ApplicationContextAware, Appli
public Reader execute() throws Exception
{
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
return new InputStreamReader(reader.getContentInputStream());
return new InputStreamReader(reader.getContentInputStream(), reader.getEncoding());
}
});
}
@@ -676,7 +678,15 @@ public class RepoStore implements WebScriptStore, ApplicationContextAware, Appli
*/
public Reader getReader()
{
return new InputStreamReader(getInputStream());
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
try
{
return new InputStreamReader(getInputStream(), reader.getEncoding());
}
catch (UnsupportedEncodingException e)
{
throw new AlfrescoRuntimeException("Unsupported Encoding", e);
}
}
@Override