|
|
| Resolution Date: |
11/Oct/06 07:08 AM
|
| Date of First Response: |
10/Oct/06 12:18 PM
|
|
If I create nodetype, say exo:image, with child node to hold an image, and use DisplayResourceCommand for this inner resource to display it as the image, DisplayResourceCommand throws "Invalid node type, expected nt:file or exo:article, have exo:image at /test" exception.
Massimo Gai proposed a solution:
Index: DisplayResourceCommand.java
===================================================================
--- DisplayResourceCommand.java (revision 9321)
+++ DisplayResourceCommand.java (working copy)
@@ -42,13 +42,11 @@
//file.refresh(false);
////
- Node content;
- if(file.isNodeType("nt:file")) {
- content = file.getNode("jcr:content");
- } else if(file.isNodeType("exo:article")) {
- content = file.getNode("exo:image");
- } else
- throw new Exception("Invalid node type, expected nt:file or exo:article, have "+file.getPrimaryNodeType().getName
()+" at "+file.getPath());
+ String relativePath=(String)request.getParameter("relativePath");
+ Node content=file.getNode(relativePath);
+ if (content==null ) {
+ throw new Exception("Path not found: " + file.getPath() + "/" + file.getPrimaryNodeType().getName() + "/" + rela
tivePath);
+ }
Property data = content.getProperty("jcr:data");
String mime = content.getProperty("jcr:mimeType").getString();
---
Note, extending nt:file or nesting nt:file does not work either.
|
|
Description
|
If I create nodetype, say exo:image, with child node to hold an image, and use DisplayResourceCommand for this inner resource to display it as the image, DisplayResourceCommand throws "Invalid node type, expected nt:file or exo:article, have exo:image at /test" exception.
Massimo Gai proposed a solution:
Index: DisplayResourceCommand.java
===================================================================
--- DisplayResourceCommand.java (revision 9321)
+++ DisplayResourceCommand.java (working copy)
@@ -42,13 +42,11 @@
//file.refresh(false);
////
- Node content;
- if(file.isNodeType("nt:file")) {
- content = file.getNode("jcr:content");
- } else if(file.isNodeType("exo:article")) {
- content = file.getNode("exo:image");
- } else
- throw new Exception("Invalid node type, expected nt:file or exo:article, have "+file.getPrimaryNodeType().getName
()+" at "+file.getPath());
+ String relativePath=(String)request.getParameter("relativePath");
+ Node content=file.getNode(relativePath);
+ if (content==null ) {
+ throw new Exception("Path not found: " + file.getPath() + "/" + file.getPrimaryNodeType().getName() + "/" + rela
tivePath);
+ }
Property data = content.getProperty("jcr:data");
String mime = content.getProperty("jcr:mimeType").getString();
---
Note, extending nt:file or nesting nt:file does not work either. |
Show » |
|