2013-05-08 2 views
0

나는 자바에 대해 너무 익숙해서 나와 함께 곰. 자식 노드의 속성을 검색하려고합니다. 예를 들어 나는 이미지 속성과 관련된 모든 속성을 검색하기 위해 노력하고있어 :자식 노드의 속성 검색

/content 
    /foo 
     /jcr:content 
      /page 
       /page_child 
        /image <----- 

현재 내 스크립트는 page_child에서 모든 속성을 검색되지만 어떻게 "이미지"

public void setPageContext(PageContext context) { 
    ValueMap properties = (ValueMap) context.getAttribute("properties"); 
    closeText = properties.get("closeText", ""); 
    imageURL = properties.get("fileReference", ""); 
} 

public String getCloseText() { return closeText; } 
public String getCloseText() { return imageURL; } 
의 특성을받을 수 있나요

답변

0

/libs/foundation/components/adaptiveimage

JSP에서 이미지 파일의 jcr : 내용을 사용하여 새 자원을 만듭니다.

Resource fileJcrContent = resource.getChild("file").getChild("jcr:content"); 
if (fileJcrContent != null) { 
    ValueMap fileProperties = fileJcrContent.adaptTo(ValueMap.class); 
    String mimeType = fileProperties.get("jcr:mimeType", "jpg"); 
    extension = mimeType.substring(mimeType.lastIndexOf("/") + 1); 
} 

거기부터 모든 속성에 fileProperties를 통해 액세스 할 수 있습니다.

관련 문제