Fawzib Rojas | 2 Nov 14:43 2010

Cocoon 2.2 block+sitemap question

I have 2 blocks (block-a and block-b) and I want to serve an xml from 
block-b in block-a so i did the following:

block-a/block-servlet-service.xml:
<servlet:context mount-path="/block-a" 
context-path="blockcontext:/block-a/">
<servlet:connections>
<entry key="block-b" value-ref="com.my-company.block-b.service"/>
</servlet:connections>
</servlet:context>

block-a/sitemap.xml:
<map:pipeline>
<map:match pattern="document">
<map:generate src="servlet:block-b:/document" />
<map:serialize type="xml" />
</map:match>
</map:pipeline>

That way i can read the my document using /block-a/document.  In certain 
instances block-b wont be included in the war so I want the 
/block-a/document to go to a default document in block-a so I thought of 
adding an error handler, something like this:

<map:pipeline>
<map:match pattern="document">
<map:generate src="servlet:block-b:/document" />
<map:serialize type="xml" />
</map:match>
<map:handle-errors>
(Continue reading)

Robby Pelssers | 2 Nov 16:17 2010

RE: Cocoon 2.2 block+sitemap question

I have a more urgent question to you...

why would you want to sometimes not include block-b???  I think your design should be reconsidered
drastically because this makes no sense to me... so i'll await your reponse for a good reason ;-)

Robby

-----Oorspronkelijk bericht-----
Van: Fawzib Rojas [mailto:f_rojas <at> spectron-msim.com]
Verzonden: di 2-11-2010 14:43
Aan: users <at> cocoon.apache.org
Onderwerp: Cocoon 2.2 block+sitemap question

I have 2 blocks (block-a and block-b) and I want to serve an xml from 
block-b in block-a so i did the following:

block-a/block-servlet-service.xml:
<servlet:context mount-path="/block-a" 
context-path="blockcontext:/block-a/">
<servlet:connections>
<entry key="block-b" value-ref="com.my-company.block-b.service"/>
</servlet:connections>
</servlet:context>

block-a/sitemap.xml:
<map:pipeline>
<map:match pattern="document">
<map:generate src="servlet:block-b:/document" />
<map:serialize type="xml" />
</map:match>
(Continue reading)

florent andré | 3 Nov 10:54 2010

[2.2] RCL not only for dev ?

Hi all,

As I work on 2.2 for Lenya I figured out a "strange" comportment with rcl.

We have this blocks
1) webapp-welcome with goal mvn jetty:run

2) webapp with an rcl.properties

3) export that is call from a usecase component in usecase block. This
export have this bean declaration :
  <bean
name="org.apache.lenya.cms.usecase.Usecase/export.importExampleContent"
    class="org.apache.lenya.cms.export.Import" scope="session"
init-method="initialize">
    <property name="repository"
ref="org.apache.lenya.cms.publication.Repository"/>
    <property name="view">
      <bean class="org.apache.lenya.cms.usecase.UsecaseView">
        <property name="guiManager"
ref="org.apache.lenya.cms.usecase.gui.GUIManager"/>
        <property name="uri"
value="fallback://lenya/modules/export/jx/importExampleContent.jx"/>
        <property name="createContinuation" value="true"/>
      </bean>
    </property>
    <property name="sourceResolver"
ref="org.apache.excalibur.source.SourceResolver"/>
        <property name="documentManager"
ref="org.apache.lenya.cms.publication.DocumentManager"/>
(Continue reading)

Fawzib Rojas | 3 Nov 13:29 2010

Re: Cocoon 2.2 block+sitemap question

I have a webapp (war) that we use at our company it has a few blocks (let say block-a to block-d), I want to install that war at our clients but they should not have block-b. The simplest option would be just remove that block and serve a simple document if its not found. The other option is have 2 projects one for us one for clients which seems extra work since the only difference is:

a) block-b not included
b) change a matcher in block-a sitemap from this:
<map:pipeline> <map:match pattern="document"> <map:generate src="servlet:block-b:/document" /> <map:serialize type="xml" /> </map:match> </map:pipeline> to this:

<map:pipeline>
<map:match pattern="document"> <map:generate type="file" src="block-a-resources/document.xml" /> <map:serialize type="xml"/> </map:match> </map:pipeline>
On 11/2/2010 11:17 AM, Robby Pelssers wrote:
I have a more urgent question to you... why would you want to sometimes not include block-b??? I think your design should be reconsidered drastically because this makes no sense to me... so i'll await your reponse for a good reason ;-) Robby -----Oorspronkelijk bericht----- Van: Fawzib Rojas [mailto:f_rojas <at> spectron-msim.com] Verzonden: di 2-11-2010 14:43 Aan: users <at> cocoon.apache.org Onderwerp: Cocoon 2.2 block+sitemap question I have 2 blocks (block-a and block-b) and I want to serve an xml from block-b in block-a so i did the following: block-a/block-servlet-service.xml: <servlet:context mount-path="/block-a" context-path="blockcontext:/block-a/"> <servlet:connections> <entry key="block-b" value-ref="com.my-company.block-b.service"/> </servlet:connections> </servlet:context> block-a/sitemap.xml: <map:pipeline> <map:match pattern="document"> <map:generate src="servlet:block-b:/document" /> <map:serialize type="xml" /> </map:match> </map:pipeline> That way i can read the my document using /block-a/document. In certain instances block-b wont be included in the war so I want the /block-a/document to go to a default document in block-a so I thought of adding an error handler, something like this: <map:pipeline> <map:match pattern="document"> <map:generate src="servlet:block-b:/document" /> <map:serialize type="xml" /> </map:match> <map:handle-errors> <map:select type="exception"> <map:when test="error"> <map:generate type="file" src="block-a-resources/document.xml" /> <map:serialize type="xml"/> </map:when> </map:select> </map:handle-errors> </map:pipeline> Since the connection in the block-a/block-servlet-service.xml cannot be made the war is not loaded so this method wont work. Is there another way to do this? --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org For additional commands, e-mail: users-help <at> cocoon.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org For additional commands, e-mail: users-help <at> cocoon.apache.org

Andre Juffer | 3 Nov 14:43 2010
Picon
Picon

Re: Cocoon 2.2 block+sitemap question

I have to admit that your design is somewhat odd. Apparently you have a 
particular block in your webapp that is only to be used by your company 
but not by your clients.

There is no obvious solution. You could create a Makefile for running 
make or a shell script on *nix boxes. It would copy the relevant blocks 
of your webapp into a separate folder, then automatically replaces the 
relevant portions of your block a sitemap into something else that does 
not rely on block b, and, finally, run maven to create the war for your 
clients. You can do this each time you want to deploy a stripped webapp 
to your clients. This would be a fully automated solution.

If you deploy your webapp to your own server that is also accessible by 
your clients, you could consider to make a small modification in the 
block-a sitemap. Before serving the document, first call a flowscript 
function that decides whether or not block b in fact should called. If 
not, then continue with a pipeline in block a that servers the document 
from block-a-resources/document.xml, otherwise continue with a pipeline 
that calls block b. The flowscript could check whether or not the 
request is from within the company or from outside (e.g. by IP addresses).

Best regards,
Andre

On 11/03/2010 02:29 PM, Fawzib Rojas wrote:
> I have a webapp (war) that we use at our company it has a few blocks
> (let say block-a to block-d), I want to install that war at our clients
> but they should not have block-b. The simplest option would be just
> remove that block and serve a simple document if its not found. The
> other option is have 2 projects one for us one for clients which seems
> extra work since the only difference is:
>
> a) block-b not included
> b) change a matcher in block-a sitemap from this:
>
> <map:pipeline>
>    <map:match pattern="document">
>      <map:generate src="servlet:block-b:/document" />
>      <map:serialize type="xml" />
>    </map:match>
> </map:pipeline>
>
> to this:
>
> <map:pipeline>
>
>    <map:match pattern="document">
>      <map:generate type="file" src="block-a-resources/document.xml" />
>      <map:serialize type="xml"/>
>    </map:match>
> </map:pipeline>
>
>
> On 11/2/2010 11:17 AM, Robby Pelssers wrote:
>> I have a more urgent question to you...
>>
>> why would you want to sometimes not include block-b???  I think your design should be reconsidered
drastically because this makes no sense to me... so i'll await your reponse for a good reason ;-)
>>
>> Robby
>>
>>
>> -----Oorspronkelijk bericht-----
>> Van: Fawzib Rojas [mailto:f_rojas <at> spectron-msim.com]
>> Verzonden: di 2-11-2010 14:43
>> Aan:users <at> cocoon.apache.org
>> Onderwerp: Cocoon 2.2 block+sitemap question
>>
>> I have 2 blocks (block-a and block-b) and I want to serve an xml from
>> block-b in block-a so i did the following:
>>
>> block-a/block-servlet-service.xml:
>> <servlet:context mount-path="/block-a"
>> context-path="blockcontext:/block-a/">
>> <servlet:connections>
>> <entry key="block-b" value-ref="com.my-company.block-b.service"/>
>> </servlet:connections>
>> </servlet:context>
>>
>> block-a/sitemap.xml:
>> <map:pipeline>
>> <map:match pattern="document">
>> <map:generate src="servlet:block-b:/document" />
>> <map:serialize type="xml" />
>> </map:match>
>> </map:pipeline>
>>
>> That way i can read the my document using /block-a/document.  In certain
>> instances block-b wont be included in the war so I want the
>> /block-a/document to go to a default document in block-a so I thought of
>> adding an error handler, something like this:
>>
>> <map:pipeline>
>> <map:match pattern="document">
>> <map:generate src="servlet:block-b:/document" />
>> <map:serialize type="xml" />
>> </map:match>
>> <map:handle-errors>
>> <map:select type="exception">
>> <map:when test="error">
>> <map:generate type="file" src="block-a-resources/document.xml" />
>> <map:serialize type="xml"/>
>> </map:when>
>> </map:select>
>> </map:handle-errors>
>> </map:pipeline>
>>
>> Since the connection in the block-a/block-servlet-service.xml cannot be
>> made the war is not loaded so this method wont work. Is there another
>> way to do this?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:users-unsubscribe <at> cocoon.apache.org
>> For additional commands, e-mail:users-help <at> cocoon.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:users-unsubscribe <at> cocoon.apache.org
>> For additional commands, e-mail:users-help <at> cocoon.apache.org
>

--

-- 
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: andre.juffer <at> oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
StruBioCat                   | WWW: www.strubiocat.oulu.fi
NordProt                     | WWW: www.nordprot.org
Triacle Biocomputing         | WWW: www.triacle-bc.com
Robby Pelssers | 3 Nov 21:49 2010

RE: Cocoon 2.2 block+sitemap question

I think the main question is if it (block-b) is protected software which cannot be distributed to your
client.  If that is no issue, you could for instance try out if you can replace the value of the  <at> src from

servlet:block-b:/document
to 
${document-pattern} 

and inject this as a property into the sitemap using cocoon-spring-configurator.  The property then would
get a different value depending on the environment profile which is loaded at initialization of the
spring context.

If my proposal is a suitable approach.... feel free to ask for more information if you get stuck.

Kind regards,
Robby Pelssers

-----Oorspronkelijk bericht-----
Van: Fawzib Rojas [mailto:f_rojas <at> spectron-msim.com]
Verzonden: wo 3-11-2010 13:29
Aan: users <at> cocoon.apache.org
Onderwerp: Re: Cocoon 2.2 block+sitemap question

I have a webapp (war) that we use at our company it has a few blocks 
(let say block-a to block-d), I want to install that war at our clients 
but they should not have block-b. The simplest option would be just 
remove that block and serve a simple document if its not found. The 
other option is have 2 projects one for us one for clients which seems 
extra work since the only difference is:

a) block-b not included
b) change a matcher in block-a sitemap from this:

<map:pipeline>
   <map:match pattern="document">
     <map:generate src="servlet:block-b:/document" />
     <map:serialize type="xml" />
   </map:match>
</map:pipeline>

to this:

<map:pipeline>

   <map:match pattern="document">
     <map:generate type="file" src="block-a-resources/document.xml" />
     <map:serialize type="xml"/>
   </map:match>
</map:pipeline>

On 11/2/2010 11:17 AM, Robby Pelssers
begin_of_the_skype_highlighting     end_of_the_skype_highlighting wrote:
> I have a more urgent question to you...
>
> why would you want to sometimes not include block-b???  I think your design should be reconsidered
drastically because this makes no sense to me... so i'll await your reponse for a good reason ;-)
>
> Robby
>
>
> -----Oorspronkelijk bericht-----
> Van: Fawzib Rojas [mailto:f_rojas <at> spectron-msim.com]
> Verzonden: di 2-11-2010 14:43
> Aan: users <at> cocoon.apache.org
> Onderwerp: Cocoon 2.2 block+sitemap question
>
> I have 2 blocks (block-a and block-b) and I want to serve an xml from
> block-b in block-a so i did the following:
>
> block-a/block-servlet-service.xml:
> <servlet:context mount-path="/block-a"
> context-path="blockcontext:/block-a/">
> <servlet:connections>
> <entry key="block-b" value-ref="com.my-company.block-b.service"/>
> </servlet:connections>
> </servlet:context>
>
> block-a/sitemap.xml:
> <map:pipeline>
> <map:match pattern="document">
> <map:generate src="servlet:block-b:/document" />
> <map:serialize type="xml" />
> </map:match>
> </map:pipeline>
>
> That way i can read the my document using /block-a/document.  In certain
> instances block-b wont be included in the war so I want the
> /block-a/document to go to a default document in block-a so I thought of
> adding an error handler, something like this:
>
> <map:pipeline>
> <map:match pattern="document">
> <map:generate src="servlet:block-b:/document" />
> <map:serialize type="xml" />
> </map:match>
> <map:handle-errors>
> <map:select type="exception">
> <map:when test="error">
> <map:generate type="file" src="block-a-resources/document.xml" />
> <map:serialize type="xml"/>
> </map:when>
> </map:select>
> </map:handle-errors>
> </map:pipeline>
>
> Since the connection in the block-a/block-servlet-service.xml cannot be
> made the war is not loaded so this method wont work. Is there another
> way to do this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org

Attachment (winmail.dat): application/ms-tnef, 5918 bytes

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
For additional commands, e-mail: users-help <at> cocoon.apache.org
tgarijo | 4 Nov 17:57 2010
Picon

How to I can do to capture the html code


Hi all

I am developing an application where a remote url call my url defined in my
sitemap. I will return it to the url a number of data and the url returns me
a html code. I develop with myeclipse and html code that it returned , is
printed in the console of my eclipse. How to  I can do to capture the html
code that url send me and set up a web page?

Thank you

Sorry for my English.

--

-- 
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
Robby Pelssers | 5 Nov 09:04 2010

RE: How to I can do to capture the html code

A vague question if you ask me...

What version of cocoon are you using by the way?  2.2?

Let's assume you have one of 2 options below configured in your sitemap:

<!-- option 1: using request parameters -->
<map:match pattern="mypage.html">
  <map:call function="generateMyPage"/>
</map:match>

<!-- option 2: using sitemap parameters -->
<map:match pattern="mypage/*">
  <map:call function="generateMyPage">
    <map:parameter name="id" value="{1}"/>
  </map:call>
</map:match>

You would invoke option 1 like:

http://localhost:8080/mywebapp/myblock/mypage.html?id=1040

option 2 can be invoked like:

http://localhost:8080/mywebapp/myblock/mypage/1040

Now your flowscript controller 

option 1:

function generateMyPage() {
    var id = cocoon.request.getParameter("id");
    //fetch additional data
    var employees = cocooon.getComponent("dataSource").findById(id);
    cocoon.sendPage(
        "mypage2html",
        { 
          "id": id, "employees ": employees
        }
    );
}

option 2:

function generateMyPage() {
   var id = cocoon.parameters["id"];
    //fetch additional data
    var employees = cocooon.getComponent("dataSource").findById(id);
    cocoon.sendPage(
        "mypage2html",
        { 
          "id": id, "employees ": employees
        }
    );
}

So you will also need a jxtemplate to render you html:

<map:match pattern="mypage2html">
  <map:generate src="pages/mypage.jx" type="jx"/>
  <map:serialize type="xhtml"/>
</map:match>

the template could look like:

<?xml version="1.0" encoding="UTF-8"?>
<jx:template 
  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
  <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />     
      <title>Some Title </title>
      <link type="text/css" rel="stylesheet" href="resource/external/css/styles.css"/> 	    			       	    
    </head>
    <body>
      <span>You invoked page with id ${id}</span>
      <table>
        <thead>
          <tr> 
            <th>First Name</th>
            <th>Last Name</th>
          </tr>
        </thead>
        <tbody>
          <jx:forEach var="employee" items="${employees}">
            <tr>
              <td>${employee.fName}</td>
              <td>${employee.lName}</td>
            </tr>
          </jx:forEach>         
        </tbody>
      </table>
    </body>    
  </html>
</jx:template>

So the result of invoking both URL's is an xhtml page.

Robby
-----Oorspronkelijk bericht-----
Van: tgarijo [mailto:tgarijo <at> clickonline.es]
Verzonden: do 4-11-2010 17:57
Aan: users <at> cocoon.apache.org
Onderwerp: How to  I can do to capture the html code

Hi all

I am developing an application where a remote url call my url defined in my
sitemap. I will return it to the url a number of data and the url returns me
a html code. I develop with myeclipse and html code that it returned , is
printed in the console of my eclipse. How to  I can do to capture the html
code that url send me and set up a web page?

Thank you

Sorry for my English.

--

-- 
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.

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

Attachment (winmail.dat): application/ms-tnef, 5529 bytes

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
For additional commands, e-mail: users-help <at> cocoon.apache.org
tgarijo | 5 Nov 12:09 2010
Picon

RE: How to I can do to capture the html code


Hi Robby nice to meet you.

when  i return the control program to
es.clickonline.transformation.Transformer
the remote gci return to me html code and printed in the console of my
eclipse

My code its the next

Sitemap

.
.
<map:transformer name="transformer"
src="es.clickonline.transformation.Transformer"/>
.
.
.
<map:match pattern="ReciveData4B">			
   <map:generate type="request"/>		
   <map:transform src="./xslt/efacturaRequest.xsl"/> 		
   <map:transform type="transformer"/>		
   <map:transform src="./xslt/efacturaPaymentResponse.xsl"/> 		
   <map:serialize type="text"/>		
</map:match>		

public Document setup(org.w3c.dom.Node node,
org.apache.cocoon.environment.Session session) throws UnknownHostException,
SQLException 
	{	
		String				order 					= null;
		String 				store 					= null;		
		Data 				data 					= null;
		Session 			sessioneFacturaResponse = null;		
		boolean				bGrabar					= true;	
		User 				user					= null;
		String 				sCliente 				= null;
		String				payment 				= null;
		String 				Session 				= null;
		String 				datos 					= null;

		
		EfacturaResponseDocument document;
		document = EfacturaResponseDocument.Factory.newInstance();
		EfacturaResponse   efacturaResponse;
	
// Create new invoicde document by xmlbeans

		efacturaResponse = document.addNewEfacturaResponse();
		

		sessioneFacturaResponse = 	efacturaResponse.addNewHead().addNewSession();
    	sessioneFacturaResponse.setId(session.getId()) ;
    	
    	// Nueva Data
    	data = efacturaResponse.addNewData();
    	

    	XmlCursor xmlcursor =data.newCursor();
    	xmlcursor.toFirstContentToken();
    	
    	  	
               //This data its sending by cgi program from url

		order = getParametersDataOfRequest(node, "order");
		store= getParametersDataOfRequest(node, "store");								
		payment= getParametersDataOfRequest(node, "payment");
		
		
			
		Session =String.copyValueOf(getParametersDataOfRequest(node,
"order").toCharArray(),0,32);
			
		int tamaño = getParametersDataOfRequest(node,
"order").length()-Session.length();			
		order = String.copyValueOf(getParametersDataOfRequest(node,   
order").toCharArray(),32,tamaño-1);			
		store = getParametersDataOfRequest(node, "store");
			
		driverDatabase drvDatabase = new driverDatabase();
			
		// Nos conectamos a la base de datos que corresponda
		drvDatabase.connectDatabases();
			
		String s_Sql = "Select * from ExContadorPayment where session = '" +
Session + "' oRDER BY counter DESC" ;
				       
	    	drvDatabase.generateSql(s_Sql)
	    	
	        String rt = "\n";
	        
	        ResultSet rs = drvDatabase.getRs();

	    	Double  Payment = Double.valueOf(rs.getString("payment"))*100;
	    	
	        DecimalFormat df = new DecimalFormat("###");
	    	
	    	String importeTotal= "M978" +   df.format(Payment);
	    	String numeroReg ="1";
	    	String referencia =rs.getString("order"); //"A2530";
	    	String unidades = "1";
	    	String Precio =  df.format(Payment);	    		    	
	    	
	    	ResultDocument  docPaymentResponse;
	    	
	    	docPaymentResponse = ResultDocument.Factory.newInstance();    	
	    	es.clickonline.response.efacturaPaymentResponse.Result result;
	    	result=docPaymentResponse.addNewResult();
	    	
	    	XmlCursor xmlCursorResult = result.newCursor();
	    	es.clickonline.response.efacturaPaymentResponse.Data data1;
	    	
	    	data1= result.addNewData();  
	     
               // I return this data to url
	
	    	data1.setImporteTotal(importeTotal.toString());
	    	data1.setNumeroReg(numeroReg.toString());
	    	data1.setReferencia(referencia);
	    	data1.setUnidades(unidades);
	    	data1.setPrecio(Precio);
	    	
	    	
	    	xmlCursorResult.moveXml(xmlcursor);        
			xmlcursor.dispose();

		System.out.println("datos" + "\n" + datos);
			
		
	    	
	    	
		
          // return control program to
es.clickonline.transformation.Transformer
		return this.parseXmlStringReader(document.toString(),false); 
		
in this moment the remote url return html code and printed in myeclipse
console. I need capture this html code and set up html page 
	}

Robby Pelssers-3 wrote:
> 
> A vague question if you ask me...
> 
> What version of cocoon are you using by the way?  2.2?
> 
> 
> Let's assume you have one of 2 options below configured in your sitemap:
> 
> <!-- option 1: using request parameters -->
> <map:match pattern="mypage.html">
>   <map:call function="generateMyPage"/>
> </map:match>
> 
> <!-- option 2: using sitemap parameters -->
> <map:match pattern="mypage/*">
>   <map:call function="generateMyPage">
>     <map:parameter name="id" value="{1}"/>
>   </map:call>
> </map:match>
> 
> You would invoke option 1 like:
> 
> http://localhost:8080/mywebapp/myblock/mypage.html?id=1040
> 
> option 2 can be invoked like:
> 
> http://localhost:8080/mywebapp/myblock/mypage/1040
> 
> 
> Now your flowscript controller 
> 
> option 1:
> 
> function generateMyPage() {
>     var id = cocoon.request.getParameter("id");
>     //fetch additional data
>     var employees = cocooon.getComponent("dataSource").findById(id);
>     cocoon.sendPage(
>         "mypage2html",
>         { 
>           "id": id, "employees ": employees
>         }
>     );
> }
> 
> option 2:
> 
> function generateMyPage() {
>    var id = cocoon.parameters["id"];
>     //fetch additional data
>     var employees = cocooon.getComponent("dataSource").findById(id);
>     cocoon.sendPage(
>         "mypage2html",
>         { 
>           "id": id, "employees ": employees
>         }
>     );
> }
> 
> So you will also need a jxtemplate to render you html:
> 
> <map:match pattern="mypage2html">
>   <map:generate src="pages/mypage.jx" type="jx"/>
>   <map:serialize type="xhtml"/>
> </map:match>
> 
> 
> the template could look like:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <jx:template 
>   xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>   <html>
>     <head>
>       <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />     
>       <title>Some Title </title>
>       <link type="text/css" rel="stylesheet"
> href="resource/external/css/styles.css"/> 	    			       	    
>     </head>
>     <body>
>       You invoked page with id ${id}
>       <table>
>         <thead>
>           <tr> 
>             <th>First Name</th>
>             <th>Last Name</th>
>           </tr>
>         </thead>
>         <tbody>
>           <jx:forEach var="employee" items="${employees}">
>             <tr>
>               <td>${employee.fName}</td>
>               <td>${employee.lName}</td>
>             </tr>
>           </jx:forEach>         
>         </tbody>
>       </table>
>     </body>    
>   </html>
> </jx:template>
> 
> So the result of invoking both URL's is an xhtml page.
> 
> Robby
> -----Oorspronkelijk bericht-----
> Van: tgarijo [mailto:tgarijo <at> clickonline.es]
> Verzonden: do 4-11-2010 17:57
> Aan: users <at> cocoon.apache.org
> Onderwerp: How to  I can do to capture the html code
>  
> 
> Hi all
> 
> I am developing an application where a remote url call my url defined in
> my
> sitemap. I will return it to the url a number of data and the url returns
> me
> a html code. I develop with myeclipse and html code that it returned , is
> printed in the console of my eclipse. How to  I can do to capture the html
> code that url send me and set up a web page?
> 
> Thank you
> 
> Sorry for my English.
> 
> -- 
> View this message in context:
> http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
> Sent from the Cocoon - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 
> 
> 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 

--

-- 
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30140111.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
Robby Pelssers | 5 Nov 13:44 2010

RE: How to I can do to capture the html code

Are you trying to extract data from a xhtml page returned by invoking a cgi script? At least that is the
impression I get.

Yikes... of course that is possible but in that case i would definitely choose to have the CGI script return
an xml document instead of xhtml and use a xml schema to define what the xml content is supposed to look like.

In that way you can easily extract the data in a meaningfull way by using xpath or xquery.

Robby

-----Oorspronkelijk bericht-----
Van: tgarijo [mailto:tgarijo <at> clickonline.es]
Verzonden: vr 5-11-2010 12:09
Aan: users <at> cocoon.apache.org
Onderwerp: RE: How to  I can do to capture the html code

Hi Robby nice to meet you.

when  i return the control program to
es.clickonline.transformation.Transformer
the remote gci return to me html code and printed in the console of my
eclipse

My code its the next

Sitemap

.
.
<map:transformer name="transformer"
src="es.clickonline.transformation.Transformer"/>
.
.
.
<map:match pattern="ReciveData4B">			
   <map:generate type="request"/>		
   <map:transform src="./xslt/efacturaRequest.xsl"/> 		
   <map:transform type="transformer"/>		
   <map:transform src="./xslt/efacturaPaymentResponse.xsl"/> 		
   <map:serialize type="text"/>		
</map:match>		

public Document setup(org.w3c.dom.Node node,
org.apache.cocoon.environment.Session session) throws UnknownHostException,
SQLException 
	{	
		String				order 					= null;
		String 				store 					= null;		
		Data 				data 					= null;
		Session 			sessioneFacturaResponse = null;		
		boolean				bGrabar					= true;	
		User 				user					= null;
		String 				sCliente 				= null;
		String				payment 				= null;
		String 				Session 				= null;
		String 				datos 					= null;

		
		EfacturaResponseDocument document;
		document = EfacturaResponseDocument.Factory.newInstance();
		EfacturaResponse   efacturaResponse;
	
// Create new invoicde document by xmlbeans

		efacturaResponse = document.addNewEfacturaResponse();
		

		sessioneFacturaResponse = 	efacturaResponse.addNewHead().addNewSession();
    	sessioneFacturaResponse.setId(session.getId()) ;
    	
    	// Nueva Data
    	data = efacturaResponse.addNewData();
    	

    	XmlCursor xmlcursor =data.newCursor();
    	xmlcursor.toFirstContentToken();
    	
    	  	
               //This data its sending by cgi program from url

		order = getParametersDataOfRequest(node, "order");
		store= getParametersDataOfRequest(node, "store");								
		payment= getParametersDataOfRequest(node, "payment");
		
		
			
		Session =String.copyValueOf(getParametersDataOfRequest(node,
"order").toCharArray(),0,32);
			
		int tamaño = getParametersDataOfRequest(node,
"order").length()-Session.length();			
		order = String.copyValueOf(getParametersDataOfRequest(node,   
order").toCharArray(),32,tamaño-1);			
		store = getParametersDataOfRequest(node, "store");
			
		driverDatabase drvDatabase = new driverDatabase();
			
		// Nos conectamos a la base de datos que corresponda
		drvDatabase.connectDatabases();
			
		String s_Sql = "Select * from ExContadorPayment where session = '" +
Session + "' oRDER BY counter DESC" ;
				       
	    	drvDatabase.generateSql(s_Sql)
	    	
	        String rt = "\n";
	        
	        ResultSet rs = drvDatabase.getRs();

	    	Double  Payment = Double.valueOf(rs.getString("payment"))*100;
	    	
	        DecimalFormat df = new DecimalFormat("###");
	    	
	    	String importeTotal= "M978" +   df.format(Payment);
	    	String numeroReg ="1";
	    	String referencia =rs.getString("order"); //"A2530";
	    	String unidades = "1";
	    	String Precio =  df.format(Payment);	    		    	
	    	
	    	ResultDocument  docPaymentResponse;
	    	
	    	docPaymentResponse = ResultDocument.Factory.newInstance();    	
	    	es.clickonline.response.efacturaPaymentResponse.Result result;
	    	result=docPaymentResponse.addNewResult();
	    	
	    	XmlCursor xmlCursorResult = result.newCursor();
	    	es.clickonline.response.efacturaPaymentResponse.Data data1;
	    	
	    	data1= result.addNewData();  
	     
               // I return this data to url
	
	    	data1.setImporteTotal(importeTotal.toString());
	    	data1.setNumeroReg(numeroReg.toString());
	    	data1.setReferencia(referencia);
	    	data1.setUnidades(unidades);
	    	data1.setPrecio(Precio);
	    	
	    	
	    	xmlCursorResult.moveXml(xmlcursor);        
			xmlcursor.dispose();

		System.out.println("datos" + "\n" + datos);
			
		
	    	
	    	
		
          // return control program to
es.clickonline.transformation.Transformer
		return this.parseXmlStringReader(document.toString(),false); 
		
in this moment the remote url return html code and printed in myeclipse
console. I need capture this html code and set up html page 
	}

Robby Pelssers-3 wrote:
> 
> A vague question if you ask me...
> 
> What version of cocoon are you using by the way?  2.2?
> 
> 
> Let's assume you have one of 2 options below configured in your sitemap:
> 
> <!-- option 1: using request parameters -->
> <map:match pattern="mypage.html">
>   <map:call function="generateMyPage"/>
> </map:match>
> 
> <!-- option 2: using sitemap parameters -->
> <map:match pattern="mypage/*">
>   <map:call function="generateMyPage">
>     <map:parameter name="id" value="{1}"/>
>   </map:call>
> </map:match>
> 
> You would invoke option 1 like:
> 
> http://localhost:8080/mywebapp/myblock/mypage.html?id=1040
> 
> option 2 can be invoked like:
> 
> http://localhost:8080/mywebapp/myblock/mypage/1040
> 
> 
> Now your flowscript controller 
> 
> option 1:
> 
> function generateMyPage() {
>     var id = cocoon.request.getParameter("id");
>     //fetch additional data
>     var employees = cocooon.getComponent("dataSource").findById(id);
>     cocoon.sendPage(
>         "mypage2html",
>         { 
>           "id": id, "employees ": employees
>         }
>     );
> }
> 
> option 2:
> 
> function generateMyPage() {
>    var id = cocoon.parameters["id"];
>     //fetch additional data
>     var employees = cocooon.getComponent("dataSource").findById(id);
>     cocoon.sendPage(
>         "mypage2html",
>         { 
>           "id": id, "employees ": employees
>         }
>     );
> }
> 
> So you will also need a jxtemplate to render you html:
> 
> <map:match pattern="mypage2html">
>   <map:generate src="pages/mypage.jx" type="jx"/>
>   <map:serialize type="xhtml"/>
> </map:match>
> 
> 
> the template could look like:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <jx:template 
>   xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>   <html>
>     <head>
>       <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />     
>       <title>Some Title </title>
>       <link type="text/css" rel="stylesheet"
> href="resource/external/css/styles.css"/> 	    			       	    
>     </head>
>     <body>
>       You invoked page with id ${id}
>       <table>
>         <thead>
>           <tr> 
>             <th>First Name</th>
>             <th>Last Name</th>
>           </tr>
>         </thead>
>         <tbody>
>           <jx:forEach var="employee" items="${employees}">
>             <tr>
>               <td>${employee.fName}</td>
>               <td>${employee.lName}</td>
>             </tr>
>           </jx:forEach>         
>         </tbody>
>       </table>
>     </body>    
>   </html>
> </jx:template>
> 
> So the result of invoking both URL's is an xhtml page.
> 
> Robby
> -----Oorspronkelijk bericht-----
> Van: tgarijo [mailto:tgarijo <at> clickonline.es]
> Verzonden: do 4-11-2010 17:57
> Aan: users <at> cocoon.apache.org
> Onderwerp: How to  I can do to capture the html code
>  
> 
> Hi all
> 
> I am developing an application where a remote url call my url defined in
> my
> sitemap. I will return it to the url a number of data and the url returns
> me
> a html code. I develop with myeclipse and html code that it returned , is
> printed in the console of my eclipse. How to  I can do to capture the html
> code that url send me and set up a web page?
> 
> Thank you
> 
> Sorry for my English.
> 
> -- 
> View this message in context:
> http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30134015.html
> Sent from the Cocoon - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 
> 
> 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 

--

-- 
View this message in context: http://old.nabble.com/How-to--I-can-do-to-capture-the-html-code-tp30134015p30140111.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.

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

Attachment (winmail.dat): application/ms-tnef, 8 KiB

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

Gmane