자신 만의 org.apache.tapestry5.ioc.Resource
구현을 제공 할 수 있습니다. 이로 인해 Tapestry의 내부 API를 사용할 필요가 없습니다.
@Contribute(ComponentMessagesSource.class)
public static void provideMessages(OrderedConfiguration<Resource> configuration) {
configuration.add("DBMessages", new Resource() {
// implement interface methods
});
}
당신은 물론, 자원 인스턴스가 데이터베이스 연결 또는 당신이 무엇에서 메시지를 얻으려면와 자원을 제공하는 별도의 서비스 내에서 구성 할 수 있습니다. 까다로운 점은 파일/디렉토리 구조를 위해 명확하게 설계된 메소드를 구현하는 방법이 될 수 있습니다.
/**
* Returns a Resource based on a relative path, relative to the folder containing the resource. Understands the "."
* (current folder) and ".." (parent folder) conventions, and treats multiple sequential slashes as a single slash.
* <p/>
* Virtual resources (resources fabricated at runtime) return themselves.
*/
Resource forFile(String relativePath);
또는
/**
* Returns the portion of the path up to the last forward slash; this is the directory or folder portion of the
* Resource.
*/
String getFolder();
글쎄, 난 당신이 태피스트리의 소스 코드를 들여다을하는 방법과 기존 자원의 구현 작업을보고해야 할 것 같아요.