Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Virgo Snaps: Templating via Fillter
Virgo Snaps: Templating via Fillter [message #981737] Mon, 12 November 2012 11:58 Go to previous message
Markus Schmailzl is currently offline Markus Schmailzl
Messages: 6
Registered: November 2012
Junior Member
Hey,

Currently i am developing a pluggable Webapplication with virgo-server and virgo snaps. Therefore i would like to implement some kind of templating where the
host provides a general layout. If a snap is called the snap should integrate its output in the hosts template.

My approach so far is to use a filter which wrapps html around the response of every snap. My problem is that the filter that i have defined after the SnapHostFilter in the web.xml is not executed.

If i define my filter before the SnapHostFilter it gets executed but then the actual response to the client only contains the wrapping-html but not the output from the snap.

Does anybody have an idea why it is not working? or how i could implement some kind of templating that is controlled by the host?

Thanks very much


public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
						
		OutputStream out = response.getOutputStream();
		  out.write("<HR>PRE<HR>".getBytes());
		  GenericResponseWrapper wrapper = new GenericResponseWrapper((HttpServletResponse) response); 
		  chain.doFilter(request,wrapper);
		  out.write(wrapper.getData());
		  //out.write("<HR>POST<HR>".getBytes());
		  out.close(); 		
	}



web.xml

        <filter>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

         <filter>
		<filter-name>templateFilter</filter-name>		
		<filter-class>de.project.bai.webapp.templating.TemplateFilter</filter-class>
	</filter>

        <filter-mapping>
		<filter-name>templateFilter</filter-name>
		<url-pattern>/base/web/*</url-pattern>		
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>
	
	<filter>
		<filter-name>host-filter</filter-name>
		<filter-class>org.eclipse.virgo.snaps.core.SnapHostFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>host-filter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>
 
Read Message
Read Message
Read Message
Read Message
Previous Topic:Start VTS in Debian as process - define execution user
Next Topic:Virgo 3.6.0.M04
Goto Forum:
  


Current Time: Fri May 24 04:22:55 EDT 2013

Powered by FUDForum. Page generated in 0.02210 seconds