URL-Rewriting in Portlet

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

URL-Rewriting in Portlet

Florian.Schultheis

Hi,

we have to integrate an existing homepage in a portal application. The code of the websites can't be changed, because the homepage is furthermore used outside of the portal, too. So we need a dynamic url-rewriting for all links, images, java script and so on. We already developed a solution with string replacement what appears as not fast enough. The url-rewriting of OPS as mentioned here ( http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do exactly the things we need, so I want to give it a try. I searched the whole website, but couldn't find a way to start. So my question: What do I have to do for using the url-rewriting mechanism of OPS in a portal application that should show some "external" websites?

Bye, Florian

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL-Rewriting in Portlet

Erik Bruchez
Administrator
Florian,

OPS has two processors: oxf:xhtml-rewrite and oxf:html-rewrite, that are
able to do some rewriting in a SAX stream. They are called from
epilogue-servlet.xpl and epilogue-portlet.xpl. Here for example is how
oxf:html-rewrite is called:

<p:processor name="oxf:html-rewrite">
     <p:input name="rewrite-in" href="#themed-data"/>
     <p:output name="rewrite-out" id="rewritten-data"/>
</p:processor>

Note that the input must be XML: this won't work with a JavaScript file.

Also note that the processors are not configurable. They have a certain
rewriting policy, and they implement it. However, there are some foreign
attributes you can put on XHTML elements to force certain types of
portlet URLs (f:url-type="render|action|resource")..

In the case of the portlet, we actually don't rewrite right away, but we
produce string (from WSRP, like wsrp_rewrite) that are then parsed and
actually rewritten by the OPS Portlet.

In the case of portlets, you can also use the wsrp_rewrite strings, for
example:

<xhtml:style type="text/css">
     #wsrp_rewrite_flickr-main-body, flickr-main-body {}
     ...

What you could do for a start is fetch an external HTML page or XHTML
page with the URL generator (it is able to "tidy" HTML pages and convert
them to XML), obtain an XML document back, feed that to the rewrite
processor, and see what happens in your portlet. To get something fully
functional, you may have to perform adjustments and transformations on
the resulting page, for example with XSLT, but it's hard to know beforehand.

-Erik

[hidden email] wrote:

>
> Hi,
>
> we have to integrate an existing homepage in a portal application. The
> code of the websites can't be changed, because the homepage is
> furthermore used outside of the portal, too. So we need a dynamic
> url-rewriting for all links, images, java script and so on. We already
> developed a solution with string replacement what appears as not fast
> enough. The url-rewriting of OPS as mentioned here (
> http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do
> exactly the things we need, so I want to give it a try. I searched the
> whole website, but couldn't find a way to start. So my question: What do
> I have to do for using the url-rewriting mechanism of OPS in a portal
> application that should show some "external" websites?
>
> Bye, Florian
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL-Rewriting in Portlet

Florian.Schultheis

Erik,

thanks for your reply. But I have some problems with understanding all these .xpl-files or more exactly with understanding when and how I have to use them.
The current solution looks like this: We built the so called WebappPortalizer-framework that consists of a fistful java-classes. All the changes in the source code of a website - necessary for using this website in the portal context - are made by these classes.

Is it now possible to use this URL generator programmatically by doing something like

String xmlCodeOfWebsite = URLGenerator.htmlToXml(htmlCodeOfWebsite);
String rewrittenCodeOfWebsite = htmlRewrite(xmlCodeOfWebsite );

instead of using all these .xpl-files?

Bye,
Florian



Florian,

OPS has two processors: oxf:xhtml-rewrite and oxf:html-rewrite, that are
able to do some rewriting in a SAX stream. They are called from
epilogue-servlet.xpl and epilogue-portlet.xpl. Here for example is how
oxf:html-rewrite is called:

<p:processor name="oxf:html-rewrite">
    <p:input name="rewrite-in" href="#themed-data"/>
    <p:output name="rewrite-out" id="rewritten-data"/>
</p:processor>

Note that the input must be XML: this won't work with a JavaScript file.

Also note that the processors are not configurable. They have a certain
rewriting policy, and they implement it. However, there are some foreign
attributes you can put on XHTML elements to force certain types of
portlet URLs (f:url-type="render|action|resource")..

In the case of the portlet, we actually don't rewrite right away, but we
produce string (from WSRP, like wsrp_rewrite) that are then parsed and
actually rewritten by the OPS Portlet.

In the case of portlets, you can also use the wsrp_rewrite strings, for u
example:

<xhtml:style type="text/css">
    #wsrp_rewrite_flickr-main-body, flickr-main-body {}
    ...

What you could do for a start is fetch an external HTML page or XHTML
page with the URL generator (it is able to "tidy" HTML pages and convert
them to XML), obtain an XML document back, feed that to the rewrite
processor, and see what happens in your portlet. To get something fully
functional, you may have to perform adjustments and transformations on
the resulting page, for example with XSLT, but it's hard to know beforehand.

-Erik

[hidden email] wrote:
>
> Hi,
>
> we have to integrate an existing homepage in a portal application. The
> code of the websites can't be changed, because the homepage is
> furthermore used outside of the portal, too. So we need a dynamic
> url-rewriting for all links, images, java script and so on. We already
> developed a solution with string replacement what appears as not fast
> enough. The url-rewriting of OPS as mentioned here (
> http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do
> exactly the things we need, so I want to give it a try. I searched the
> whole website, but couldn't find a way to start. So my question: What do
> I have to do for using the url-rewriting mechanism of OPS in a portal
> application that should show some "external" websites?
>
> Bye, Florian


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL-Rewriting in Portlet

Erik Bruchez
Administrator
Florian,

OPS is built around an XML pipeline engine, which runs pipelines
described with the XPL language. Most of the OPS components such as the
URL generator and HTML rewrite discussed below are built as XML
processors, i.e. components you use in an XML pipeline.

There is certainly some code you may be able to call directly from Java
without involving processors and pipelines, but the native way of using
these components is to put them in a pipeline. We don't have an API such
as the one you propose below.

This said, you could programmatically build a pipeline that calls the
processors, or just run an XPL pipeline from your Java code. In fact
there have been related questions here lately. You only need one XPL
file to do what you are trying to achieve.

-Erik

[hidden email] wrote:

>
> Erik,
>
> thanks for your reply. But I have some problems with understanding all
> these .xpl-files or more exactly with understanding when and how I have
> to use them.
> The current solution looks like this: We built the so called
> WebappPortalizer-framework that consists of a fistful java-classes. All
> the changes in the source code of a website - necessary for using this
> website in the portal context - are made by these classes.
>
> Is it now possible to use this URL generator programmatically by doing
> something like
>
> String xmlCodeOfWebsite = URLGenerator.htmlToXml(htmlCodeOfWebsite);
> String rewrittenCodeOfWebsite = htmlRewrite(xmlCodeOfWebsite );
>
> instead of using all these .xpl-files?
>
> Bye,
> Florian
>
>
>
> Florian,
>
> OPS has two processors: oxf:xhtml-rewrite and oxf:html-rewrite, that are
> able to do some rewriting in a SAX stream. They are called from
> epilogue-servlet.xpl and epilogue-portlet.xpl. Here for example is how
> oxf:html-rewrite is called:
>
> <p:processor name="oxf:html-rewrite">
>     <p:input name="rewrite-in" href="#themed-data"/>
>     <p:output name="rewrite-out" id="rewritten-data"/>
> </p:processor>
>
> Note that the input must be XML: this won't work with a JavaScript file.
>
> Also note that the processors are not configurable. They have a certain
> rewriting policy, and they implement it. However, there are some foreign
> attributes you can put on XHTML elements to force certain types of
> portlet URLs (f:url-type="render|action|resource")..
>
> In the case of the portlet, we actually don't rewrite right away, but we
> produce string (from WSRP, like wsrp_rewrite) that are then parsed and
> actually rewritten by the OPS Portlet.
>
> In the case of portlets, you can also use the wsrp_rewrite strings, for u
> example:
>
> <xhtml:style type="text/css">
>     #wsrp_rewrite_flickr-main-body, flickr-main-body {}
>     ...
>
> What you could do for a start is fetch an external HTML page or XHTML
> page with the URL generator (it is able to "tidy" HTML pages and convert
> them to XML), obtain an XML document back, feed that to the rewrite
> processor, and see what happens in your portlet. To get something fully
> functional, you may have to perform adjustments and transformations on
> the resulting page, for example with XSLT, but it's hard to know beforehand.
>
> -Erik
>
> [hidden email] wrote:
>  >
>  > Hi,
>  >
>  > we have to integrate an existing homepage in a portal application. The
>  > code of the websites can't be changed, because the homepage is
>  > furthermore used outside of the portal, too. So we need a dynamic
>  > url-rewriting for all links, images, java script and so on. We already
>  > developed a solution with string replacement what appears as not fast
>  > enough. The url-rewriting of OPS as mentioned here (
>  > http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do
>  > exactly the things we need, so I want to give it a try. I searched the
>  > whole website, but couldn't find a way to start. So my question: What do
>  > I have to do for using the url-rewriting mechanism of OPS in a portal
>  > application that should show some "external" websites?
>  >
>  > Bye, Florian
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL-Rewriting in Portlet

Florian.Schultheis

This said, you could programmatically build a pipeline that calls the
processors, or just run an XPL pipeline from your Java code.


Ok, and how do I do this? I spent the whole day (not meant as a reproach but for showing you that I'm not just sitting around and want you to do my work) with searching the website and mailing lists. All I could find for addressing my problems was the class  org.orbeon.oxf.main.OPS.java .  So I tried to use the code fragments in a servlet without really understanding what all that stuff does.
I set the url of the examined website in the source code (not getting it via commond line arguments like in the OPS.java-example) and when running the servlet the following error is shown:

2006-06-21 17:05:05,343 ERROR OPSTestServlet null - Exception with no location data
org.orbeon.oxf.resources.ResourceNotFoundException: Cannot read from file www.timetoact.de
        at org.orbeon.oxf.resources.FilesystemResourceManagerImpl.getContentAsStream(FilesystemResourceManagerImpl.java:67)
        at org.orbeon.oxf.resources.ResourceManagerBase.getContentAsSAX(ResourceManagerBase.java:133)
        at org.orbeon.oxf.resources.PriorityResourceManagerImpl$4.run(PriorityResourceManagerImpl.java:106)
        at org.orbeon.oxf.resources.PriorityResourceManagerImpl.delegate(PriorityResourceManagerImpl.java:252)
        at org.orbeon.oxf.resources.PriorityResourceManagerImpl.getContentAsSAX(PriorityResourceManagerImpl.java:104)
        at org.orbeon.oxf.processor.generator.URLGenerator$OXFResourceHandler.readXML(URLGenerator.java:636)
        at org.orbeon.oxf.processor.generator.URLGenerator$1.readImpl(URLGenerator.java:404)
        at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:987)
        at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1170)
        at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:349)
        at org.orbeon.oxf.processor.validation.MSVValidationProcessor.access$700(MSVValidationProcessor.java:44)
        at org.orbeon.oxf.processor.validation.MSVValidationProcessor$5.readImpl(MSVValidationProcessor.java:219)
        at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:987)
        at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1170)
        at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:349)
        at org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$1000(PipelineProcessor.java:66)
        at org.orbeon.oxf.processor.pipeline.PipelineProcessor$5.readImpl(PipelineProcessor.java:457)
        at org.orbeon.oxf.processor.ProcessorImpl$6.read(ProcessorImpl.java:987)
        at org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(ProcessorImpl.java:1170)
        at org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(ProcessorImpl.java:349)
        at org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(ProcessorImpl.java:404)
        at org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(ProcessorImpl.java:413)
        at org.orbeon.oxf.processor.pipeline.PipelineReader.start(PipelineReader.java:79)
        at org.orbeon.oxf.processor.pipeline.PipelineProcessor.readPipelineConfig(PipelineProcessor.java:469)
        at org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$2300(PipelineProcessor.java:66)
        at org.orbeon.oxf.processor.pipeline.PipelineProcessor$9.read(PipelineProcessor.java:626)
        at org.orbeon.oxf.processor.ProcessorImpl.readCacheInputAsObject(ProcessorImpl.java:470)
        at org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(PipelineProcessor.java:622)
        at org.orbeon.oxf.pipeline.InitUtils.runProcessor(InitUtils.java:86)
        at org.orbeon.oxf.pipeline.PipelineEngineImpl.executePipeline(PipelineEngineImpl.java:31)
        at OPSTestServlet.doServiceDistributed(OPSTestServlet.java:134)
        at OPSTestServlet.doGet(OPSTestServlet.java:68)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)

I also changed the url to http://www.sixtus.net/weblog.xml (because of the .xml-file) with getting the same error. What's the reason for that? Btw: Am I on the right track?

Bye,
Florian





Erik Bruchez <[hidden email]>
Sent by: Erik Bruchez <[hidden email]>

20.06.2006 20:02

Please respond to
[hidden email]

To
[hidden email]
cc
Subject
Re: [ops-users] URL-Rewriting in Portlet





Florian,

OPS is built around an XML pipeline engine, which runs pipelines
described with the XPL language. Most of the OPS components such as the
URL generator and HTML rewrite discussed below are built as XML
processors, i.e. components you use in an XML pipeline.

There is certainly some code you may be able to call directly from Java
without involving processors and pipelines, but the native way of using
these components is to put them in a pipeline. We don't have an API such
as the one you propose below.

This said, you could programmatically build a pipeline that calls the
processors, or just run an XPL pipeline from your Java code. In fact
there have been related questions here lately. You only need one XPL
file to do what you are trying to achieve.

-Erik

[hidden email] wrote:
>
> Erik,
>
> thanks for your reply. But I have some problems with understanding all
> these .xpl-files or more exactly with understanding when and how I have
> to use them.
> The current solution looks like this: We built the so called
> WebappPortalizer-framework that consists of a fistful java-classes. All
> the changes in the source code of a website - necessary for using this
> website in the portal context - are made by these classes.
>
> Is it now possible to use this URL generator programmatically by doing
> something like
>
> String xmlCodeOfWebsite = URLGenerator.htmlToXml(htmlCodeOfWebsite);
> String rewrittenCodeOfWebsite = htmlRewrite(xmlCodeOfWebsite );
>
> instead of using all these .xpl-files?
>
> Bye,
> Florian
>
>
>
> Florian,
>
> OPS has two processors: oxf:xhtml-rewrite and oxf:html-rewrite, that are
> able to do some rewriting in a SAX stream. They are called from
> epilogue-servlet.xpl and epilogue-portlet.xpl. Here for example is how
> oxf:html-rewrite is called:
>
> <p:processor name="oxf:html-rewrite">
>     <p:input name="rewrite-in" href="#themed-data"/>
>     <p:output name="rewrite-out" id="rewritten-data"/>
> </p:processor>
>
> Note that the input must be XML: this won't work with a JavaScript file.
>
> Also note that the processors are not configurable. They have a certain
> rewriting policy, and they implement it. However, there are some foreign
> attributes you can put on XHTML elements to force certain types of
> portlet URLs (f:url-type="render|action|resource")..
>
> In the case of the portlet, we actually don't rewrite right away, but we
> produce string (from WSRP, like wsrp_rewrite) that are then parsed and
> actually rewritten by the OPS Portlet.
>
> In the case of portlets, you can also use the wsrp_rewrite strings, for u
> example:
>
> <xhtml:style type="text/css">
>     #wsrp_rewrite_flickr-main-body, flickr-main-body {}
>     ...
>
> What you could do for a start is fetch an external HTML page or XHTML
> page with the URL generator (it is able to "tidy" HTML pages and convert
> them to XML), obtain an XML document back, feed that to the rewrite
> processor, and see what happens in your portlet. To get something fully
> functional, you may have to perform adjustments and transformations on
> the resulting page, for example with XSLT, but it's hard to know beforehand.
>
> -Erik
>
> [hidden email] wrote:
>  >
>  > Hi,
>  >
>  > we have to integrate an existing homepage in a portal application. The
>  > code of the websites can't be changed, because the homepage is
>  > furthermore used outside of the portal, too. So we need a dynamic
>  > url-rewriting for all links, images, java script and so on. We already
>  > developed a solution with string replacement what appears as not fast
>  > enough. The url-rewriting of OPS as mentioned here (
>  > http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do
>  > exactly the things we need, so I want to give it a try. I searched the
>  > whole website, but couldn't find a way to start. So my question: What do
>  > I have to do for using the url-rewriting mechanism of OPS in a portal
>  > application that should show some "external" websites?
>  >
>  > Bye, Florian
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL-Rewriting in Portlet

Erik Bruchez
Administrator
Florian,

It looks like you are trying to access a URL called "www.timetoact.de".
Did you put "http://" before it? Do you have this string
"www.timetoact.de" somwehere?

-Erik

[hidden email] wrote:

>
> This said, you could programmatically build a pipeline that calls the
> processors, or just run an XPL pipeline from your Java code.
>
> Ok, and how do I do this? I spent the whole day (not meant as a reproach
> but for showing you that I'm not just sitting around and want you to do
> my work) with searching the website and mailing lists. All I could find
> for addressing my problems was the class  org.orbeon.oxf.main.OPS.java .
>  So I tried to use the code fragments in a servlet without really
> understanding what all that stuff does.
> I set the url of the examined website in the source code (not getting it
> via commond line arguments like in the OPS.java-example) and when
> running the servlet the following error is shown:
>
> 2006-06-21 17:05:05,343 ERROR OPSTestServlet null - Exception with no
> location data
> _org.orbeon.oxf.resources.ResourceNotFoundException_: Cannot read from
> file www.timetoact.de
>         at
> org.orbeon.oxf.resources.FilesystemResourceManagerImpl.getContentAsStream(_FilesystemResourceManagerImpl.java:67_)
>
>         at
> org.orbeon.oxf.resources.ResourceManagerBase.getContentAsSAX(_ResourceManagerBase.java:133_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl$4.run(_PriorityResourceManagerImpl.java:106_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl.delegate(_PriorityResourceManagerImpl.java:252_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl.getContentAsSAX(_PriorityResourceManagerImpl.java:104_)
>
>         at
> org.orbeon.oxf.processor.generator.URLGenerator$OXFResourceHandler.readXML(_URLGenerator.java:636_)
>
>         at
> org.orbeon.oxf.processor.generator.URLGenerator$1.readImpl(_URLGenerator.java:404_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.validation.MSVValidationProcessor.access$700(_MSVValidationProcessor.java:44_)
>
>         at
> org.orbeon.oxf.processor.validation.MSVValidationProcessor$5.readImpl(_MSVValidationProcessor.java:219_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$1000(_PipelineProcessor.java:66_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor$5.readImpl(_PipelineProcessor.java:457_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(_ProcessorImpl.java:404_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(_ProcessorImpl.java:413_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineReader.start(_PipelineReader.java:79_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.readPipelineConfig(_PipelineProcessor.java:469_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$2300(_PipelineProcessor.java:66_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor$9.read(_PipelineProcessor.java:626_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readCacheInputAsObject(_ProcessorImpl.java:470_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(_PipelineProcessor.java:622_)
>
>         at
> org.orbeon.oxf.pipeline.InitUtils.runProcessor(_InitUtils.java:86_)
>         at
> org.orbeon.oxf.pipeline.PipelineEngineImpl.executePipeline(_PipelineEngineImpl.java:31_)
>
>         at OPSTestServlet.doServiceDistributed(_OPSTestServlet.java:134_)
>         at OPSTestServlet.doGet(_OPSTestServlet.java:68_)
>         at javax.servlet.http.HttpServlet.service(_HttpServlet.java:689_)
>         at javax.servlet.http.HttpServlet.service(_HttpServlet.java:802_)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:252_)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:173_)
>
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:213_)
>
>         at
> org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:178_)
>
>         at
> org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:126_)
>
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:105_)
>
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:107_)
>
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:148_)
>
>         at
> org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:869_)
>
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(_Http11BaseProtocol.java:664_)
>
>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(_PoolTcpEndpoint.java:527_)
>
>         at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(_LeaderFollowerWorkerThread.java:80_)
>
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(_ThreadPool.java:684_)
>
>         at java.lang.Thread.run(_Thread.java:595_)
>
> I also changed the url to http://www.sixtus.net/weblog.xml (because of
> the .xml-file) with getting the same error. What's the reason for that?
> Btw: Am I on the right track?
>
> Bye,
> Florian
>
>
>
>
>
> *Erik Bruchez <[hidden email]>*
> Sent by: Erik Bruchez <[hidden email]>
>
> 20.06.2006 20:02
> Please respond to
> [hidden email]
>
>
>
> To
> [hidden email]
> cc
>
> Subject
> Re: [ops-users] URL-Rewriting in Portlet
>
>
>
>
>
>
>
>
> Florian,
>
> OPS is built around an XML pipeline engine, which runs pipelines
> described with the XPL language. Most of the OPS components such as the
> URL generator and HTML rewrite discussed below are built as XML
> processors, i.e. components you use in an XML pipeline.
>
> There is certainly some code you may be able to call directly from Java
> without involving processors and pipelines, but the native way of using
> these components is to put them in a pipeline. We don't have an API such
> as the one you propose below.
>
> This said, you could programmatically build a pipeline that calls the
> processors, or just run an XPL pipeline from your Java code. In fact
> there have been related questions here lately. You only need one XPL
> file to do what you are trying to achieve.
>
> -Erik
>
> [hidden email] wrote:
>  >
>  > Erik,
>  >
>  > thanks for your reply. But I have some problems with understanding all
>  > these .xpl-files or more exactly with understanding when and how I have
>  > to use them.
>  > The current solution looks like this: We built the so called
>  > WebappPortalizer-framework that consists of a fistful java-classes. All
>  > the changes in the source code of a website - necessary for using this
>  > website in the portal context - are made by these classes.
>  >
>  > Is it now possible to use this URL generator programmatically by doing
>  > something like
>  >
>  > String xmlCodeOfWebsite = URLGenerator.htmlToXml(htmlCodeOfWebsite);
>  > String rewrittenCodeOfWebsite = htmlRewrite(xmlCodeOfWebsite );
>  >
>  > instead of using all these .xpl-files?
>  >
>  > Bye,
>  > Florian
>  >
>  >
>  >
>  > Florian,
>  >
>  > OPS has two processors: oxf:xhtml-rewrite and oxf:html-rewrite, that are
>  > able to do some rewriting in a SAX stream. They are called from
>  > epilogue-servlet.xpl and epilogue-portlet.xpl. Here for example is how
>  > oxf:html-rewrite is called:
>  >
>  > <p:processor name="oxf:html-rewrite">
>  >     <p:input name="rewrite-in" href="#themed-data"/>
>  >     <p:output name="rewrite-out" id="rewritten-data"/>
>  > </p:processor>
>  >
>  > Note that the input must be XML: this won't work with a JavaScript file.
>  >
>  > Also note that the processors are not configurable. They have a certain
>  > rewriting policy, and they implement it. However, there are some foreign
>  > attributes you can put on XHTML elements to force certain types of
>  > portlet URLs (f:url-type="render|action|resource")..
>  >
>  > In the case of the portlet, we actually don't rewrite right away, but we
>  > produce string (from WSRP, like wsrp_rewrite) that are then parsed and
>  > actually rewritten by the OPS Portlet.
>  >
>  > In the case of portlets, you can also use the wsrp_rewrite strings, for u
>  > example:
>  >
>  > <xhtml:style type="text/css">
>  >     #wsrp_rewrite_flickr-main-body, flickr-main-body {}
>  >     ...
>  >
>  > What you could do for a start is fetch an external HTML page or XHTML
>  > page with the URL generator (it is able to "tidy" HTML pages and convert
>  > them to XML), obtain an XML document back, feed that to the rewrite
>  > processor, and see what happens in your portlet. To get something fully
>  > functional, you may have to perform adjustments and transformations on
>  > the resulting page, for example with XSLT, but it's hard to know
> beforehand.
>  >
>  > -Erik
>  >
>  > [hidden email] wrote:
>  >  >
>  >  > Hi,
>  >  >
>  >  > we have to integrate an existing homepage in a portal application. The
>  >  > code of the websites can't be changed, because the homepage is
>  >  > furthermore used outside of the portal, too. So we need a dynamic
>  >  > url-rewriting for all links, images, java script and so on. We already
>  >  > developed a solution with string replacement what appears as not fast
>  >  > enough. The url-rewriting of OPS as mentioned here (
>  >  > http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do
>  >  > exactly the things we need, so I want to give it a try. I searched the
>  >  > whole website, but couldn't find a way to start. So my question:
> What do
>  >  > I have to do for using the url-rewriting mechanism of OPS in a portal
>  >  > application that should show some "external" websites?
>  >  >
>  >  > Bye, Florian
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  >
>  > --
>  > You receive this message as a subscriber of the
> [hidden email] mailing list.
>  > To unsubscribe: mailto:[hidden email]
>  > For general help: mailto:[hidden email]?subject=help
>  > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
> --
> Orbeon - XForms Everywhere:
> http://www.orbeon.com/blog/
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: URL-Rewriting in Portlet

Florian.Schultheis

The url was ok, but used in wrong way. I had to give the path to the file containing the processors' definition, not the url to the document the processor should convert... I changed this and tried to understand the .xpl-files. I wrote the following .xpl-file for reading an html-file, replacing the urls and writing the result to an output file:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors">

  <p:processor name="oxf:url-generator">
    <p:input name="config">
      <config>
        <url>http://www.timetoact.de</url>
        <content-type>text/html</content-type>
      </config>
    </p:input>
    <p:output name="data" id="html"/>
  </p:processor>

  <p:processor name="oxf:html-rewrite">
    <p:input name="rewrite-in" href="#html" />
    <p:output name="rewrite-out" id="rewritten-data" />
  </p:processor>
 
  <p:processor name="oxf:file-serializer">
    <p:input name="config">
      <config>
        <content-type>text/xml</content-type>
        <file>my-result-file.html</file>
        <directory>c:/temp</directory>
      </config>
    </p:input>
    <p:input name="data" href="#html"/>
  </p:processor>
</p:config>

When running the OPS.java class with the given .xpl-file I get an error:

Exception at file:D:/eclipse/OPSTest/src/pipeline.xml, line 30, column 38, description reading processor output
org.orbeon.oxf.common.OXFException: Root element must contain an xsi:type attribute

All examples I saw so far didn't also have such an xsi:type attribute, so what is wrong here?

Bye, Florian





Erik Bruchez <[hidden email]>
Sent by: Erik Bruchez <[hidden email]>

23.06.2006 14:16

Please respond to
[hidden email]

To
[hidden email]
cc
Subject
Re: [ops-users] URL-Rewriting in Portlet





Florian,

It looks like you are trying to access a URL called "www.timetoact.de".
Did you put "http://" before it? Do you have this string
"www.timetoact.de" somwehere?

-Erik

[hidden email] wrote:
>
> This said, you could programmatically build a pipeline that calls the
> processors, or just run an XPL pipeline from your Java code.
>
> Ok, and how do I do this? I spent the whole day (not meant as a reproach
> but for showing you that I'm not just sitting around and want you to do
> my work) with searching the website and mailing lists. All I could find
> for addressing my problems was the class  org.orbeon.oxf.main.OPS.java .
>  So I tried to use the code fragments in a servlet without really
> understanding what all that stuff does.
> I set the url of the examined website in the source code (not getting it
> via commond line arguments like in the OPS.java-example) and when
> running the servlet the following error is shown:
>
> 2006-06-21 17:05:05,343 ERROR OPSTestServlet null - Exception with no
> location data
> _org.orbeon.oxf.resources.ResourceNotFoundException_: Cannot read from
> file www.timetoact.de
>         at
> org.orbeon.oxf.resources.FilesystemResourceManagerImpl.getContentAsStream(_FilesystemResourceManagerImpl.java:67_)
>
>         at
> org.orbeon.oxf.resources.ResourceManagerBase.getContentAsSAX(_ResourceManagerBase.java:133_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl$4.run(_PriorityResourceManagerImpl.java:106_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl.delegate(_PriorityResourceManagerImpl.java:252_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl.getContentAsSAX(_PriorityResourceManagerImpl.java:104_)
>
>         at
> org.orbeon.oxf.processor.generator.URLGenerator$OXFResourceHandler.readXML(_URLGenerator.java:636_)
>
>         at
> org.orbeon.oxf.processor.generator.URLGenerator$1.readImpl(_URLGenerator.java:404_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.validation.MSVValidationProcessor.access$700(_MSVValidationProcessor.java:44_)
>
>         at
> org.orbeon.oxf.processor.validation.MSVValidationProcessor$5.readImpl(_MSVValidationProcessor.java:219_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$1000(_PipelineProcessor.java:66_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor$5.readImpl(_PipelineProcessor.java:457_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(_ProcessorImpl.java:404_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(_ProcessorImpl.java:413_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineReader.start(_PipelineReader.java:79_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.readPipelineConfig(_PipelineProcessor.java:469_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$2300(_PipelineProcessor.java:66_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor$9.read(_PipelineProcessor.java:626_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readCacheInputAsObject(_ProcessorImpl.java:470_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(_PipelineProcessor.java:622_)
>
>         at
> org.orbeon.oxf.pipeline.InitUtils.runProcessor(_InitUtils.java:86_)
>         at
> org.orbeon.oxf.pipeline.PipelineEngineImpl.executePipeline(_PipelineEngineImpl.java:31_)
>
>         at OPSTestServlet.doServiceDistributed(_OPSTestServlet.java:134_)
>         at OPSTestServlet.doGet(_OPSTestServlet.java:68_)
>         at javax.servlet.http.HttpServlet.service(_HttpServlet.java:689_)
>         at javax.servlet.http.HttpServlet.service(_HttpServlet.java:802_)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:252_)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:173_)
>
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:213_)
>
>         at
> org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:178_)
>
>         at
> org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:126_)
>
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:105_)
>
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:107_)
>
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:148_)
>
>         at
> org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:869_)
>
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(_Http11BaseProtocol.java:664_)
>
>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(_PoolTcpEndpoint.java:527_)
>
>         at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(_LeaderFollowerWorkerThread.java:80_)
>
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(_ThreadPool.java:684_)
>
>         at java.lang.Thread.run(_Thread.java:595_)
>
> I also changed the url to http://www.sixtus.net/weblog.xml (because of
> the .xml-file) with getting the same error. What's the reason for that?
> Btw: Am I on the right track?
>
> Bye,
> Florian
>
>
>
>
>
> *Erik Bruchez <[hidden email]>*
> Sent by: Erik Bruchez <[hidden email]>
>
> 20.06.2006 20:02
> Please respond to
> [hidden email]
>
>
>                  
> To
>                  [hidden email]
> cc
>                  
> Subject
>                  Re: [ops-users] URL-Rewriting in Portlet
>
>
>                  
>
>
>
>
>
> Florian,
>
> OPS is built around an XML pipeline engine, which runs pipelines
> described with the XPL language. Most of the OPS components such as the
> URL generator and HTML rewrite discussed below are built as XML
> processors, i.e. components you use in an XML pipeline.
>
> There is certainly some code you may be able to call directly from Java
> without involving processors and pipelines, but the native way of using
> these components is to put them in a pipeline. We don't have an API such
> as the one you propose below.
>
> This said, you could programmatically build a pipeline that calls the
> processors, or just run an XPL pipeline from your Java code. In fact
> there have been related questions here lately. You only need one XPL
> file to do what you are trying to achieve.
>
> -Erik
>
> [hidden email] wrote:
>  >
>  > Erik,
>  >
>  > thanks for your reply. But I have some problems with understanding all
>  > these .xpl-files or more exactly with understanding when and how I have
>  > to use them.
>  > The current solution looks like this: We built the so called
>  > WebappPortalizer-framework that consists of a fistful java-classes. All
>  > the changes in the source code of a website - necessary for using this
>  > website in the portal context - are made by these classes.
>  >
>  > Is it now possible to use this URL generator programmatically by doing
>  > something like
>  >
>  > String xmlCodeOfWebsite = URLGenerator.htmlToXml(htmlCodeOfWebsite);
>  > String rewrittenCodeOfWebsite = htmlRewrite(xmlCodeOfWebsite );
>  >
>  > instead of using all these .xpl-files?
>  >
>  > Bye,
>  > Florian
>  >
>  >
>  >
>  > Florian,
>  >
>  > OPS has two processors: oxf:xhtml-rewrite and oxf:html-rewrite, that are
>  > able to do some rewriting in a SAX stream. They are called from
>  > epilogue-servlet.xpl and epilogue-portlet.xpl. Here for example is how
>  > oxf:html-rewrite is called:
>  >
>  > <p:processor name="oxf:html-rewrite">
>  >     <p:input name="rewrite-in" href="#themed-data"/>
>  >     <p:output name="rewrite-out" id="rewritten-data"/>
>  > </p:processor>
>  >
>  > Note that the input must be XML: this won't work with a JavaScript file.
>  >
>  > Also note that the processors are not configurable. They have a certain
>  > rewriting policy, and they implement it. However, there are some foreign
>  > attributes you can put on XHTML elements to force certain types of
>  > portlet URLs (f:url-type="render|action|resource")..
>  >
>  > In the case of the portlet, we actually don't rewrite right away, but we
>  > produce string (from WSRP, like wsrp_rewrite) that are then parsed and
>  > actually rewritten by the OPS Portlet.
>  >
>  > In the case of portlets, you can also use the wsrp_rewrite strings, for u
>  > example:
>  >
>  > <xhtml:style type="text/css">
>  >     #wsrp_rewrite_flickr-main-body, flickr-main-body {}
>  >     ...
>  >
>  > What you could do for a start is fetch an external HTML page or XHTML
>  > page with the URL generator (it is able to "tidy" HTML pages and convert
>  > them to XML), obtain an XML document back, feed that to the rewrite
>  > processor, and see what happens in your portlet. To get something fully
>  > functional, you may have to perform adjustments and transformations on
>  > the resulting page, for example with XSLT, but it's hard to know
> beforehand.
>  >
>  > -Erik
>  >
>  > [hidden email] wrote:
>  >  >
>  >  > Hi,
>  >  >
>  >  > we have to integrate an existing homepage in a portal application. The
>  >  > code of the websites can't be changed, because the homepage is
>  >  > furthermore used outside of the portal, too. So we need a dynamic
>  >  > url-rewriting for all links, images, java script and so on. We already
>  >  > developed a solution with string replacement what appears as not fast
>  >  > enough. The url-rewriting of OPS as mentioned here (
>  >  > http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do
>  >  > exactly the things we need, so I want to give it a try. I searched the
>  >  > whole website, but couldn't find a way to start. So my question:
> What do
>  >  > I have to do for using the url-rewriting mechanism of OPS in a portal
>  >  > application that should show some "external" websites?
>  >  >
>  >  > Bye, Florian
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  >
>  > --
>  > You receive this message as a subscriber of the
> [hidden email] mailing list.
>  > To unsubscribe: mailto:[hidden email]
>  > For general help: mailto:[hidden email]?subject=help
>  > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
> --
> Orbeon - XForms Everywhere:
> http://www.orbeon.com/blog/
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: URL-Rewriting in Portlet

Ryan Puddephatt

Florian,

            You will need to run the rewritted-data output through the XML convertor processor

 

Have a look here http://www.orbeon.com/ops/doc/processors-converters#xml-converter

 

Ryan

 

Ryan Puddephatt

Software Engineer

TFX Group - IT UK

1 Michaelson Square

Livingston

West Lothian

Scotand

EH54 7DP

 

* [hidden email]

( 01506 407 110

7  01506 407 108

 


From: [hidden email] [mailto:[hidden email]]
Sent: 23 June 2006 16:06
To: [hidden email]
Subject: Re: [ops-users] URL-Rewriting in Portlet

 


The url was ok, but used in wrong way. I had to give the path to the file containing the processors' definition, not the url to the document the processor should convert... I changed this and tried to understand the .xpl-files. I wrote the following .xpl-file for reading an html-file, replacing the urls and writing the result to an output file:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors">

  <p:processor name="oxf:url-generator">
    <p:input name="config">
      <config>
        <url>http://www.timetoact.de</url>
        <content-type>text/html</content-type>
      </config>
    </p:input>
    <p:output name="data" id="html"/>
  </p:processor>

  <p:processor name="oxf:html-rewrite">
    <p:input name="rewrite-in" href="#html" />
    <p:output name="rewrite-out" id="rewritten-data" />
  </p:processor>
 
  <p:processor name="oxf:file-serializer">
    <p:input name="config">
      <config>
        <content-type>text/xml</content-type>
        <file>my-result-file.html</file>
        <directory>c:/temp</directory>
      </config>
    </p:input>
    <p:input name="data" href="#html"/>
  </p:processor>
</p:config>

When running the OPS.java class with the given .xpl-file I get an error:

Exception at file:D:/eclipse/OPSTest/src/pipeline.xml, line 30, column 38, description reading processor output
org.orbeon.oxf.common.OXFException: Root element must contain an xsi:type attribute

All examples I saw so far didn't also have such an xsi:type attribute, so what is wrong here?

Bye, Florian




Erik Bruchez <[hidden email]>
Sent by: Erik Bruchez <[hidden email]>

23.06.2006 14:16

Please respond to
[hidden email]

To

[hidden email]

cc

 

Subject

Re: [ops-users] URL-Rewriting in Portlet

 

 

 




Florian,

It looks like you are trying to access a URL called "www.timetoact.de".
Did you put "http://" before it? Do you have this string
"www.timetoact.de" somwehere?

-Erik

[hidden email] wrote:
>
> This said, you could programmatically build a pipeline that calls the
> processors, or just run an XPL pipeline from your Java code.
>
> Ok, and how do I do this? I spent the whole day (not meant as a reproach
> but for showing you that I'm not just sitting around and want you to do
> my work) with searching the website and mailing lists. All I could find
> for addressing my problems was the class  org.orbeon.oxf.main.OPS.java .
>  So I tried to use the code fragments in a servlet without really
> understanding what all that stuff does.
> I set the url of the examined website in the source code (not getting it
> via commond line arguments like in the OPS.java-example) and when
> running the servlet the following error is shown:
>
> 2006-06-21 17:05:05,343 ERROR OPSTestServlet null - Exception with no
> location data
> _org.orbeon.oxf.resources.ResourceNotFoundException_: Cannot read from
> file www.timetoact.de
>         at
> org.orbeon.oxf.resources.FilesystemResourceManagerImpl.getContentAsStream(_FilesystemResourceManagerImpl.java:67_)
>
>         at
> org.orbeon.oxf.resources.ResourceManagerBase.getContentAsSAX(_ResourceManagerBase.java:133_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl$4.run(_PriorityResourceManagerImpl.java:106_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl.delegate(_PriorityResourceManagerImpl.java:252_)
>
>         at
> org.orbeon.oxf.resources.PriorityResourceManagerImpl.getContentAsSAX(_PriorityResourceManagerImpl.java:104_)
>
>         at
> org.orbeon.oxf.processor.generator.URLGenerator$OXFResourceHandler.readXML(_URLGenerator.java:636_)
>
>         at
> org.orbeon.oxf.processor.generator.URLGenerator$1.readImpl(_URLGenerator.java:404_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.validation.MSVValidationProcessor.access$700(_MSVValidationProcessor.java:44_)
>
>         at
> org.orbeon.oxf.processor.validation.MSVValidationProcessor$5.readImpl(_MSVValidationProcessor.java:219_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$1000(_PipelineProcessor.java:66_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor$5.readImpl(_PipelineProcessor.java:457_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl$6.read(_ProcessorImpl.java:987_)
>         at
> org.orbeon.oxf.processor.ProcessorImpl$ProcessorOutputImpl.read(_ProcessorImpl.java:1170_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsSAX(_ProcessorImpl.java:349_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(_ProcessorImpl.java:404_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readInputAsDOM4J(_ProcessorImpl.java:413_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineReader.start(_PipelineReader.java:79_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.readPipelineConfig(_PipelineProcessor.java:469_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.access$2300(_PipelineProcessor.java:66_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor$9.read(_PipelineProcessor.java:626_)
>
>         at
> org.orbeon.oxf.processor.ProcessorImpl.readCacheInputAsObject(_ProcessorImpl.java:470_)
>
>         at
> org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(_PipelineProcessor.java:622_)
>
>         at
> org.orbeon.oxf.pipeline.InitUtils.runProcessor(_InitUtils.java:86_)
>         at
> org.orbeon.oxf.pipeline.PipelineEngineImpl.executePipeline(_PipelineEngineImpl.java:31_)
>
>         at OPSTestServlet.doServiceDistributed(_OPSTestServlet.java:134_)
>         at OPSTestServlet.doGet(_OPSTestServlet.java:68_)
>         at javax.servlet.http.HttpServlet.service(_HttpServlet.java:689_)
>         at javax.servlet.http.HttpServlet.service(_HttpServlet.java:802_)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:252_)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:173_)
>
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:213_)
>
>         at
> org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:178_)
>
>         at
> org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:126_)
>
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:105_)
>
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:107_)
>
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:148_)
>
>         at
> org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:869_)
>
>         at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(_Http11BaseProtocol.java:664_)
>
>         at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(_PoolTcpEndpoint.java:527_)
>
>         at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(_LeaderFollowerWorkerThread.java:80_)
>
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(_ThreadPool.java:684_)
>
>         at java.lang.Thread.run(_Thread.java:595_)
>
> I also changed the url to http://www.sixtus.net/weblog.xml (because of
> the .xml-file) with getting the same error. What's the reason for that?
> Btw: Am I on the right track?
>
> Bye,
> Florian
>
>
>
>
>
> *Erik Bruchez <[hidden email]>*
> Sent by: Erik Bruchez <[hidden email]>
>
> 20.06.2006 20:02
> Please respond to
> [hidden email]
>
>
>                  
> To
>                  [hidden email]
> cc
>                  
> Subject
>                  Re: [ops-users] URL-Rewriting in Portlet
>
>
>                  
>
>
>
>
>
> Florian,
>
> OPS is built around an XML pipeline engine, which runs pipelines
> described with the XPL language. Most of the OPS components such as the
> URL generator and HTML rewrite discussed below are built as XML
> processors, i.e. components you use in an XML pipeline.
>
> There is certainly some code you may be able to call directly from Java
> without involving processors and pipelines, but the native way of using
> these components is to put them in a pipeline. We don't have an API such
> as the one you propose below.
>
> This said, you could programmatically build a pipeline that calls the
> processors, or just run an XPL pipeline from your Java code. In fact
> there have been related questions here lately. You only need one XPL
> file to do what you are trying to achieve.
>
> -Erik
>
> [hidden email] wrote:
>  >
>  > Erik,
>  >
>  > thanks for your reply. But I have some problems with understanding all
>  > these .xpl-files or more exactly with understanding when and how I have
>  > to use them.
>  > The current solution looks like this: We built the so called
>  > WebappPortalizer-framework that consists of a fistful java-classes. All
>  > the changes in the source code of a website - necessary for using this
>  > website in the portal context - are made by these classes.
>  >
>  > Is it now possible to use this URL generator programmatically by doing
>  > something like
>  >
>  > String xmlCodeOfWebsite = URLGenerator.htmlToXml(htmlCodeOfWebsite);
>  > String rewrittenCodeOfWebsite = htmlRewrite(xmlCodeOfWebsite );
>  >
>  > instead of using all these .xpl-files?
>  >
>  > Bye,
>  > Florian
>  >
>  >
>  >
>  > Florian,
>  >
>  > OPS has two processors: oxf:xhtml-rewrite and oxf:html-rewrite, that are
>  > able to do some rewriting in a SAX stream. They are called from
>  > epilogue-servlet.xpl and epilogue-portlet.xpl. Here for example is how
>  > oxf:html-rewrite is called:
>  >
>  > <p:processor name="oxf:html-rewrite">
>  >     <p:input name="rewrite-in" href="#themed-data"/>
>  >     <p:output name="rewrite-out" id="rewritten-data"/>
>  > </p:processor>
>  >
>  > Note that the input must be XML: this won't work with a JavaScript file.
>  >
>  > Also note that the processors are not configurable. They have a certain
>  > rewriting policy, and they implement it. However, there are some foreign
>  > attributes you can put on XHTML elements to force certain types of
>  > portlet URLs (f:url-type="render|action|resource")..
>  >
>  > In the case of the portlet, we actually don't rewrite right away, but we
>  > produce string (from WSRP, like wsrp_rewrite) that are then parsed and
>  > actually rewritten by the OPS Portlet.
>  >
>  > In the case of portlets, you can also use the wsrp_rewrite strings, for u
>  > example:
>  >
>  > <xhtml:style type="text/css">
>  >     #wsrp_rewrite_flickr-main-body, flickr-main-body {}
>  >     ...
>  >
>  > What you could do for a start is fetch an external HTML page or XHTML
>  > page with the URL generator (it is able to "tidy" HTML pages and convert
>  > them to XML), obtain an XML document back, feed that to the rewrite
>  > processor, and see what happens in your portlet. To get something fully
>  > functional, you may have to perform adjustments and transformations on
>  > the resulting page, for example with XSLT, but it's hard to know
> beforehand.
>  >
>  > -Erik
>  >
>  > [hidden email] wrote:
>  >  >
>  >  > Hi,
>  >  >
>  >  > we have to integrate an existing homepage in a portal application. The
>  >  > code of the websites can't be changed, because the homepage is
>  >  > furthermore used outside of the portal, too. So we need a dynamic
>  >  > url-rewriting for all links, images, java script and so on. We already
>  >  > developed a solution with string replacement what appears as not fast
>  >  > enough. The url-rewriting of OPS as mentioned here (
>  >  > http://www.orbeon.com/ops/doc/reference-url-rewriting ) seems to do
>  >  > exactly the things we need, so I want to give it a try. I searched the
>  >  > whole website, but couldn't find a way to start. So my question:
> What do
>  >  > I have to do for using the url-rewriting mechanism of OPS in a portal
>  >  > application that should show some "external" websites?
>  >  >
>  >  > Bye, Florian
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  >
>  > --
>  > You receive t