diff --git a/source/java/org/alfresco/repo/web/scripts/solr/GetNodeContent.java b/source/java/org/alfresco/repo/web/scripts/solr/GetNodeContent.java index 767c359563..40b20740f9 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/GetNodeContent.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/GetNodeContent.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.io.IOException; @@ -39,6 +57,9 @@ import org.springframework.extensions.webscripts.WebScriptResponse; */ public class GetNodeContent extends StreamContent { + private static final String TRANSFORM_STATUS_HEADER = "X-Alfresco-transformStatus"; + private static final String TRANSFORM_EXCEPTION_HEADER = "X-Alfresco-transformException"; + private static final Log logger = LogFactory.getLog(GetNodeContent.class); /** @@ -110,9 +131,9 @@ public class GetNodeContent extends StreamContent } catch (Throwable e) { - if (logger.isInfoEnabled()) + if (logger.isWarnEnabled()) { - logger.info("Browser sent badly-formatted If-Modified-Since header: " + modifiedSinceStr); + logger.warn("Browser sent badly-formatted If-Modified-Since header: " + modifiedSinceStr); } } @@ -151,14 +172,14 @@ public class GetNodeContent extends StreamContent ContentTransformer transformer = contentService.getTransformer(reader.getMimetype(), MimetypeMap.MIMETYPE_TEXT_PLAIN); if(transformer == null) { + res.setHeader(TRANSFORM_STATUS_HEADER, "noTransform"); res.setStatus(HttpStatus.SC_NO_CONTENT); return; } - try { - // TODO how to ensure UTF-8? + // TODO how to ensure UTF-8 in the transformed text? transformer.transform(reader, writer); } catch (ContentIOException e) @@ -181,11 +202,14 @@ public class GetNodeContent extends StreamContent if(transformException != null) { - res.setHeader("XAlfresco-transformException", transformException.getMessage()); + res.setHeader(TRANSFORM_STATUS_HEADER, "failed"); + res.setHeader(TRANSFORM_EXCEPTION_HEADER, transformException.getMessage()); res.setStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR); } else { + res.setHeader(TRANSFORM_STATUS_HEADER, "ok"); + res.setStatus(HttpStatus.SC_OK); streamContentImpl(req, res, textReader, false, modified, String.valueOf(modified.getTime()), null); } diff --git a/source/java/org/alfresco/repo/web/scripts/solr/GetNodes.java b/source/java/org/alfresco/repo/web/scripts/solr/GetNodes.java index 45d5a4f9d0..deccd87179 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/GetNodes.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/GetNodes.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.io.IOException; diff --git a/source/java/org/alfresco/repo/web/scripts/solr/GetNodesMetaData.java b/source/java/org/alfresco/repo/web/scripts/solr/GetNodesMetaData.java index 3eb63b770f..9d441f5467 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/GetNodesMetaData.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/GetNodesMetaData.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.io.IOException; diff --git a/source/java/org/alfresco/repo/web/scripts/solr/GetNodesParameters.java b/source/java/org/alfresco/repo/web/scripts/solr/GetNodesParameters.java index 216112386b..21ac3d7ea7 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/GetNodesParameters.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/GetNodesParameters.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.util.List; diff --git a/source/java/org/alfresco/repo/web/scripts/solr/GetTransactions.java b/source/java/org/alfresco/repo/web/scripts/solr/GetTransactions.java index b1c80f3cc6..c2b83bbb09 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/GetTransactions.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/GetTransactions.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.util.HashMap; diff --git a/source/java/org/alfresco/repo/web/scripts/solr/JSONWriter.java b/source/java/org/alfresco/repo/web/scripts/solr/JSONWriter.java index b487548d3d..c3fc58f853 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/JSONWriter.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/JSONWriter.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.io.IOException; diff --git a/source/java/org/alfresco/repo/web/scripts/solr/NodeMetaData.java b/source/java/org/alfresco/repo/web/scripts/solr/NodeMetaData.java index 6fff5955c4..d3bc8468e7 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/NodeMetaData.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/NodeMetaData.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.io.Serializable; diff --git a/source/java/org/alfresco/repo/web/scripts/solr/SOLRSerializer.java b/source/java/org/alfresco/repo/web/scripts/solr/SOLRSerializer.java index 12f663a846..426dd4f294 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/SOLRSerializer.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/SOLRSerializer.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.io.IOException; diff --git a/source/java/org/alfresco/repo/web/scripts/solr/SOLRWebScriptTest.java b/source/java/org/alfresco/repo/web/scripts/solr/SOLRWebScriptTest.java index c2f4dce8bb..1f735f6029 100644 --- a/source/java/org/alfresco/repo/web/scripts/solr/SOLRWebScriptTest.java +++ b/source/java/org/alfresco/repo/web/scripts/solr/SOLRWebScriptTest.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.repo.web.scripts.solr; import java.io.PrintWriter; @@ -630,7 +648,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest }); } -/* public void testGetTransactions1() throws Exception + public void testGetTransactions1() throws Exception { long fromCommitTime = System.currentTimeMillis(); @@ -1028,7 +1046,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest parameters.setTransactionIds(transactionIds); parameters.setExcludeAspects(excludeAspects); JSONArray nodes = getNodes(parameters, 0, 51); - }*/ + } public void testNodeMetaData() throws Exception { @@ -1079,7 +1097,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest assertEquals("Path element " + i + " is incorrect", expectedPath, path); } } -/* + public void testNodeMetaDataManyNodes() throws Exception { long fromCommitTime = System.currentTimeMillis(); @@ -1127,7 +1145,7 @@ public class SOLRWebScriptTest extends BaseWebScriptTest nodeDAO.clear(); nodesMetaData = getNodesMetaData(nodeIds, 0, 2001); - }*/ + } private boolean containsAspect(JSONArray aspectsArray, QName aspect) throws Exception {