cancel
Showing results for 
Search instead for 
Did you mean: 

repositoryHelper in WCMQS

lemmy
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to access the repository within an Java-backed Webscript. Hence I'm trying to inject the repositoryHelper in wcmqs-webapp-context.xml:
<bean id="webscript.calendar.display.get" 
      class="de.landhausanders.wcm.client.calendar.CalendarWebScript"
      parent="webscript">
       <property name="repository" ref="repositoryHelper" />
   </bean>

Unfortunately the repositoryHelper bean is not yet defined 😞

I've found the bean in Alfresco folder in file bootstrap-context.xml. Since wcmqs doesn't contain this file I'm trying to use copy everything regarding repositoryHelper into wcmqs-webapp-context.xml.

Is this the recommended way?

Thanks,
Lemmy
3 REPLIES 3

bremmington
Champ on-the-rise
Champ on-the-rise
No. You seem to be in the wrong tier. The repository helper bean lives in the repository tier - it can never be used in the web tier (which is where the WQS webapp lives).

If you describe what you are trying to achieve then I'll try to help.

lemmy
Champ in-the-making
Champ in-the-making
I'm using a java-backed web-script MyWebScript.java for rendering a complex page. The rendering needs the data stored in a text-file stored in share. I've described the solution for the next newbie. It may save a couple of hours 🙂

I've found out that webSiteService can be injected in file wcmqs-webapp-context.xml by

<bean id="webscript.calendar.display.get"
      class="com.samples.wcm.client.MyWebScript"
      parent="webscript">
      <property name="webSiteService" ref="webSiteService"/>
</bean>

The MyWebScript class should have a private member
private WebSiteService webSiteService;

with setters and getters.

The text-file can be read by

WebSite website = webSiteService.getWebSite("localhost", 8080, "wcmqs");      
Asset textfile= website.getAssetByPath("/section/file.txt");
ContentStream cs = textfile.getContentAsInputStream();
InputStream input = cs.getStream();
String text = "";

int data = input.read();
while(data != -1) {      
   text = text + (char) data;            
   data = input.read();
}
input.close();

bremmington
Champ on-the-rise
Champ on-the-rise
Good. Thanks for sharing Smiley Happy