You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by Christophe DENEUX <ch...@capgemini.com> on 2006/03/01 15:05:21 UTC

How to use beehive with J2EE filter ?

Hi all,

How to use Beehive with J2EE filter ?

My JSPs generates XML that is processed by a filter to be transformed in 
HTML. My web.xml is as:

<filter>
        <filter-name>XSLT</filter-name>
        <filter-class>xxxxxxxxxxxxxxx</filter-class>
</filter>
<filter-mapping>
        <filter-name>XSLT</filter-name>
        <url-pattern>/html/*</url-pattern>
</filter-mapping>

<servlet>
        <servlet-name>action</servlet-name>
        
<servlet-class>org.apache.beehive.netui.pageflow.PageFlowActionServlet</servlet-class>
</servlet>
<servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.jpf</url-pattern>
</servlet-mapping>

My controller is "jpf/main/Controller.jpf"

When I call: http://<server:port/context/html/jpf/main/Controller.jpf, I 
have org.apache.struts.action.RequestProcessor : Invalid path 
/html/jpf/main/Controller was requested in traces.



Regards,
Christophe

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


Re: How to use beehive with J2EE filter ?

Posted by Carlin Rogers <ca...@gmail.com>.
Hi Christophe,

Yes, the NetUI maps the servlet path portion of the URI, as the module path
for the Controller. The "/html" prefix to the servlet path causes the
behavior you identified. However, one solution would be to implement a
wrapper (extend HttpServletRequestWrapper) for the request  and override the
methods that return servlet path, request URI/URL, etc. Your wrapper will
strip the "/html" from the URI. Then the page flow internals will not see
this as part of the request and should be OK. After the chain.doFilter()
call returns, your filter can do the transformation as desired.

There is one issue you should be aware of... if your JSP use the NetUI tag
library to write URIs in the response, they would not include the /html
prefix. You may not be using the tags, depending on the XML you are writing,
and the majority of the NetUI tags map to and generate HTML tag output. But
if you are, the URIs would be incorrect for your final response. During the
page flow processing, NetUI just sees your request wrapper and has no idea
about your "/html" format prefix in the URI of the real request. For
example, if you use the NetUI anchor tag to produce <a href="...">...</a>,
the href attribute would not include the "/html" prefix.

To solve this you could role your own stuff in your filter to process the
URIs when you translate the response, but a better solution would be to
extend the NetUI URLRewriter and register it with the URLRewriterService.
Then, during the NetUI tag processing for rendering your JSP, the NetUI tags
would pass a mutable URI object into your rewriter implementation and you
could add the desired path prefix. Your filter would register your rewriter
with the URLRewriterService before calling chain.doFilter(). The NetUI API
Javadoc describes the methods to override on the URLRewriter class and the
register methods on the service.
http://beehive.apache.org/docs/1.0.1/netui/apidocs/javadoc/index.html

Hope this helps. Kind regards,
Carlin

On 3/2/06, Christophe DENEUX <ch...@capgemini.com> wrote:
>
>
> Antony,
>
> Your suggestion changes anything.
>
> I think that the PageFlowActionServlet use the full path of the URL to
> find the controller or the action to execute.
> How can I remove "/html" from the path before PageFlowActionServlet  ?
>
> Christophe
>
> Antony Chien a écrit :
> > Chris,
> > Please see below:
> >
> > 2006/3/1, Christophe DENEUX <ch...@capgemini.com>:
> >
> >> Hi all,
> >>
> >> How to use Beehive with J2EE filter ?
> >>
> >> My JSPs generates XML that is processed by a filter to be transformed
> in
> >> HTML. My web.xml is as:
> >>
> >> <filter>
> >>         <filter-name>XSLT</filter-name>
> >>         <filter-class>xxxxxxxxxxxxxxx</filter-class>
> >> </filter>
> >> <filter-mapping>
> >>         <filter-name>XSLT</filter-name>
> >>         <url-pattern>/html/*.jpf</url-pattern> <!-- This is my guess
> -->
> >> </filter-mapping>
> >>
> >> <servlet>
> >>         <servlet-name>action</servlet-name>
> >>
> >> <servlet-class>org.apache.beehive.netui.pageflow.PageFlowActionServlet
> >> </servlet-class>
> >> </servlet>
> >> <servlet-mapping>
> >>         <servlet-name>action</servlet-name>
> >>         <url-pattern>*.jpf</url-pattern>
> >> </servlet-mapping>
> >>
> >> My controller is "jpf/main/Controller.jpf"
> >>
> >> When I call: http://<server:port/context/html/jpf/main/Controller.jpf,
> I
> >> have org.apache.struts.action.RequestProcessor : Invalid path
> >> /html/jpf/main/Controller was requested in traces.
> >>
> >>
> >>
> >> Regards,
> >> Christophe
> >>
> >> This message contains information that may be privileged or
> confidential
> >> and is the property of the Capgemini Group. It is intended only for the
> >> person to whom it is addressed. If you are not the intended
> recipient,  you
> >> are not authorized to read, print, retain, copy,
> disseminate,  distribute,
> >> or use this message or any part thereof. If you receive this  message
> in
> >> error, please notify the sender immediately and delete all  copies of
> this
> >> message.
> >>
> >>
> >>
> >
> >
> > --
> > Regards,
> > Antony Chien
> >
> >
>
>
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient,  you
> are not authorized to read, print, retain, copy, disseminate,  distribute,
> or use this message or any part thereof. If you receive this  message in
> error, please notify the sender immediately and delete all  copies of this
> message.
>
>

Re: How to use beehive with J2EE filter ?

Posted by Christophe DENEUX <ch...@capgemini.com>.
Antony,

Your suggestion changes anything.

I think that the PageFlowActionServlet use the full path of the URL to 
find the controller or the action to execute.
How can I remove "/html" from the path before PageFlowActionServlet  ?

Christophe

Antony Chien a écrit :
> Chris,
> Please see below:
>
> 2006/3/1, Christophe DENEUX <ch...@capgemini.com>:
>   
>> Hi all,
>>
>> How to use Beehive with J2EE filter ?
>>
>> My JSPs generates XML that is processed by a filter to be transformed in
>> HTML. My web.xml is as:
>>
>> <filter>
>>         <filter-name>XSLT</filter-name>
>>         <filter-class>xxxxxxxxxxxxxxx</filter-class>
>> </filter>
>> <filter-mapping>
>>         <filter-name>XSLT</filter-name>
>>         <url-pattern>/html/*.jpf</url-pattern> <!-- This is my guess -->
>> </filter-mapping>
>>
>> <servlet>
>>         <servlet-name>action</servlet-name>
>>
>> <servlet-class>org.apache.beehive.netui.pageflow.PageFlowActionServlet
>> </servlet-class>
>> </servlet>
>> <servlet-mapping>
>>         <servlet-name>action</servlet-name>
>>         <url-pattern>*.jpf</url-pattern>
>> </servlet-mapping>
>>
>> My controller is "jpf/main/Controller.jpf"
>>
>> When I call: http://<server:port/context/html/jpf/main/Controller.jpf, I
>> have org.apache.struts.action.RequestProcessor : Invalid path
>> /html/jpf/main/Controller was requested in traces.
>>
>>
>>
>> Regards,
>> Christophe
>>
>> This message contains information that may be privileged or confidential
>> and is the property of the Capgemini Group. It is intended only for the
>> person to whom it is addressed. If you are not the intended recipient,  you
>> are not authorized to read, print, retain, copy, disseminate,  distribute,
>> or use this message or any part thereof. If you receive this  message in
>> error, please notify the sender immediately and delete all  copies of this
>> message.
>>
>>
>>     
>
>
> --
> Regards,
> Antony Chien
>
>   


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


Re: How to use beehive with J2EE filter ?

Posted by Antony Chien <an...@gmail.com>.
Chris,
Please see below:

2006/3/1, Christophe DENEUX <ch...@capgemini.com>:
>
>
> Hi all,
>
> How to use Beehive with J2EE filter ?
>
> My JSPs generates XML that is processed by a filter to be transformed in
> HTML. My web.xml is as:
>
> <filter>
>         <filter-name>XSLT</filter-name>
>         <filter-class>xxxxxxxxxxxxxxx</filter-class>
> </filter>
> <filter-mapping>
>         <filter-name>XSLT</filter-name>
>         <url-pattern>/html/*.jpf</url-pattern> <!-- This is my guess -->
> </filter-mapping>
>
> <servlet>
>         <servlet-name>action</servlet-name>
>
> <servlet-class>org.apache.beehive.netui.pageflow.PageFlowActionServlet
> </servlet-class>
> </servlet>
> <servlet-mapping>
>         <servlet-name>action</servlet-name>
>         <url-pattern>*.jpf</url-pattern>
> </servlet-mapping>
>
> My controller is "jpf/main/Controller.jpf"
>
> When I call: http://<server:port/context/html/jpf/main/Controller.jpf, I
> have org.apache.struts.action.RequestProcessor : Invalid path
> /html/jpf/main/Controller was requested in traces.
>
>
>
> Regards,
> Christophe
>
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient,  you
> are not authorized to read, print, retain, copy, disseminate,  distribute,
> or use this message or any part thereof. If you receive this  message in
> error, please notify the sender immediately and delete all  copies of this
> message.
>
>


--
Regards,
Antony Chien