cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Piroumian, Konstantin" <KPiroum...@flagship.ru>
Subject RE: including cocoon in jsp using struts
Date Thu, 21 Mar 2002 09:34:40 GMT
Why not to use RequestDispatcher's include? Opening a new URL connection for
every include on a page is performance overhead.

Do you have separate web application contexts for Struts and Cocoon? If yes,
then URL connection is the only way, but if you place Cocoon in the same
webapp context and map to path like "*.xml" or "*.xsp" then you'll be able
to use include().
--
Konstantin Piroumian 
kpiroumian@flagship.ru

> -----Original Message-----
> From: Moritz Petersen [mailto:devmaillist@pnpconsult.com] 
> Sent: Thursday, March 21, 2002 12:30 PM
> To: Cocoon-Users; Struts-User
> Subject: including cocoon in jsp using struts
> 
> 
> hello!
> 
> ------------------------------------------------------------
> sorry for cross-posting this to cocoon-uses and struts-user!
> ------------------------------------------------------------
> 
> i have the problem, that i need to dynamically include cocoon 
> results into a
> jsp page. because we use struts for our webapplication, i'd 
> like to find a
> way to combine both.
> 
> i'd like to have something like
> 
> <struts:include>
> 	<bean:write name="url">
> </struts:include>
> 
> where struts:include is a tag, that evaluates its body to a 
> valid url. the
> content of the url shall be included, where the 
> struts:include tag was.
> 
> i have written a tag, that works, but only with exsiting 
> files, not with
> cocoon pipelines (because it calls file:/ urls):
> 
> public class IncludeTag extends BodyTagSupport
> {
> 	public int doAfterBody()
> 		throws
> 		JspException
> 	{
> 		String key = getBodyContent().getString().trim();
> 
> 		try
> 		{
> 			// call cocoon servlet with key
> 			URL cocoon = new URL(key);
> 			BufferedInputStream in = new 
> BufferedInputStream(cocoon.openStream());
> 
> 			// read the output in a buffer.
> 			byte[] buf = new byte[in.available()];
> 			in.read(buf);
> 
> 			// write the buffer to the page.
> 			getPreviousOut().print(new String(buf));
> 			in.close();
> 		}
> 		catch (Exception e)
> 		{
> 			e.printStackTrace();
> 		}
> 
> 		return SKIP_BODY;
> 	}
> }
> 
> 
> any help will be appreciated!
> 
> -moritz.
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message