You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nikolay Aleksiev <ni...@alexiev.net> on 2011/11/09 17:28:31 UTC

Serving JSPs using redirect on WebLogic

Hi,

I have the following CXF Servlet configuration:

<!-- CXF Servlet -->
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<!-- Redirect all JSP requests to the default jsp servlet -->
<init-param>
<param-name>redirects-list</param-name>
<param-value>.*\.jsp</param-value>
</init-param>
<init-param>
<param-name>redirect-servlet-name</param-name>
<param-value>jsp</param-value>
</init-param>
<!-- Serve static content -->
<init-param>
<param-name>static-resources-list</param-name>
<param-value>.*\.html .*\.htm .*\.js .*\.css</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

As you can see my servlet is matching all requests that's why I must 
handle JSPs and static contact. The above config works like charm on 
Tomcat. Unfortunately I need my application both on Tomcat and Weblogic.
After looking into org.apache.cxf.transport.servlet.AbstractHTTPServlet, 
I found out that with WbLogic servlet context, there's no request 
dispatcher for the name JSP. So I tried adding the following servlet to 
my web.xml:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>weblogic.servlet.JSPServlet</servlet-class>
</servlet>

With this additional config the request is endlessly redirected to the 
same servlet (weblogic.servlet.JSPServlet) and I end with 
StackOverflowError which is catched in AbstractHTTPServlet.

So I can mark the following problems:
     1. I can not serve JSPs with redirect, on WebLogic...

     2. I can't make the application work on both WL and Tomcat. Even If 
I can add some servlet config for weblogic (hopefully issue 1 will be 
solved), then I will need two separate web.xml configs for weblogic and 
tomcat.

I hope someone will have any ideas how can I proceed.

Regards,
Nikolay

Re: Serving JSPs using redirect on WebLogic

Posted by Sergey Beryozkin <sb...@gmail.com>.
By the way, I did not even had to do this trick when restricting the 
CXFServlet pattern for it not to 'cover' the URIs pointing to JSPs

Sergey

On 30/12/11 18:45, Sergey Beryozkin wrote:
> Hi
>
> This trick,
>
> <servlet>
>  >>> <servlet-name>jsp</servlet-name>
>  >>> <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
>  >>> </servlet>
>
> Did it for me on WebLogic Server 12c (12.1.1),
> with CXFServlet using a wildcard "/*" pattern.
>
> Please try the latest 2.4.x or CXF 2.5.1, I'm testing with CXF
> 2.5.2-SNAPSHOT.
>
> I've deployed the OAuth demo we ship in the Talend distro which has a
> lot of JSP pages, they are located under /forms relative to the root of
> the webapp, all works OK
>
> I'm going to document the tricks one need to be aware of when deploying
> CXF JAX-RS applications into various appservers, so thanks for your tip too
>
> Sergey
>
> On 09/11/11 18:31, Nikolay Aleksiev wrote:
>> Hi,
>>
>> I tried your suggestion, but the results are not good.
>>
>> In both servers I get to StackOverflowError because of endless
>> redirection. I tried setting redirect-servlet-path to both "" and "/".
>>
>> Cheers,
>> Nikolay
>>
>>
>>
>> On 11/09/2011 07:31 PM, Sergey Beryozkin wrote:
>>> Hi
>>>
>>> On 09/11/11 16:28, Nikolay Aleksiev wrote:
>>>> Hi,
>>>>
>>>> I have the following CXF Servlet configuration:
>>>>
>>>> <!-- CXF Servlet -->
>>>> <servlet>
>>>> <servlet-name>CXFServlet</servlet-name>
>>>> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>>>>
>>>>
>>>> <!-- Redirect all JSP requests to the default jsp servlet -->
>>>> <init-param>
>>>> <param-name>redirects-list</param-name>
>>>> <param-value>.*\.jsp</param-value>
>>>> </init-param>
>>>> <init-param>
>>>> <param-name>redirect-servlet-name</param-name>
>>>> <param-value>jsp</param-value>
>>>> </init-param>
>>>> <!-- Serve static content -->
>>>> <init-param>
>>>> <param-name>static-resources-list</param-name>
>>>> <param-value>.*\.html .*\.htm .*\.js .*\.css</param-value>
>>>> </init-param>
>>>> <load-on-startup>1</load-on-startup>
>>>> </servlet>
>>>> <servlet-mapping>
>>>> <servlet-name>CXFServlet</servlet-name>
>>>> <url-pattern>/*</url-pattern>
>>>> </servlet-mapping>
>>>>
>>>> As you can see my servlet is matching all requests that's why I must
>>>> handle JSPs and static contact. The above config works like charm on
>>>> Tomcat. Unfortunately I need my application both on Tomcat and
>>>> Weblogic.
>>>> After looking into
>>>> org.apache.cxf.transport.servlet.AbstractHTTPServlet,
>>>> I found out that with WbLogic servlet context, there's no request
>>>> dispatcher for the name JSP. So I tried adding the following servlet to
>>>> my web.xml:
>>>> <servlet>
>>>> <servlet-name>jsp</servlet-name>
>>>> <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
>>>> </servlet>
>>>>
>>>> With this additional config the request is endlessly redirected to the
>>>> same servlet (weblogic.servlet.JSPServlet) and I end with
>>>> StackOverflowError which is catched in AbstractHTTPServlet.
>>>>
>>>> So I can mark the following problems:
>>>> 1. I can not serve JSPs with redirect, on WebLogic...
>>>>
>>>> 2. I can't make the application work on both WL and Tomcat. Even If I
>>>> can add some servlet config for weblogic (hopefully issue 1 will be
>>>> solved), then I will need two separate web.xml configs for weblogic and
>>>> tomcat.
>>>>
>>>
>>> Can you please try using a "redirect-servlet-path" instead of
>>> redirect-servlet-name property and set to "" ? Looking at the code,
>>> what should happen in this case is that a dispatcher for "" +
>>> "/my.jsp" should be checked instead,
>>>
>>> let me know please if it helps
>>>
>>> Cheers, Sergey
>>>
>>>
>>>> I hope someone will have any ideas how can I proceed.
>>>>
>>>> Regards,
>>>> Nikolay
>>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: Serving JSPs using redirect on WebLogic

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

This trick,

<servlet>
 >>> <servlet-name>jsp</servlet-name>
 >>> <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
 >>> </servlet>

Did it for me on WebLogic Server 12c (12.1.1),
with CXFServlet using a wildcard "/*" pattern.

Please try the latest 2.4.x or CXF 2.5.1, I'm testing with CXF 
2.5.2-SNAPSHOT.

I've deployed the OAuth demo we ship in the Talend distro which has a 
lot of JSP pages, they are located under /forms relative to the root of 
the webapp, all works OK

I'm going to document the tricks one need to be aware of when deploying 
CXF JAX-RS applications into various appservers, so thanks for your tip too

Sergey

On 09/11/11 18:31, Nikolay Aleksiev wrote:
> Hi,
>
> I tried your suggestion, but the results are not good.
>
> In both servers I get to StackOverflowError because of endless
> redirection. I tried setting redirect-servlet-path to both "" and "/".
>
> Cheers,
> Nikolay
>
>
>
> On 11/09/2011 07:31 PM, Sergey Beryozkin wrote:
>> Hi
>>
>> On 09/11/11 16:28, Nikolay Aleksiev wrote:
>>> Hi,
>>>
>>> I have the following CXF Servlet configuration:
>>>
>>> <!-- CXF Servlet -->
>>> <servlet>
>>> <servlet-name>CXFServlet</servlet-name>
>>> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>>>
>>> <!-- Redirect all JSP requests to the default jsp servlet -->
>>> <init-param>
>>> <param-name>redirects-list</param-name>
>>> <param-value>.*\.jsp</param-value>
>>> </init-param>
>>> <init-param>
>>> <param-name>redirect-servlet-name</param-name>
>>> <param-value>jsp</param-value>
>>> </init-param>
>>> <!-- Serve static content -->
>>> <init-param>
>>> <param-name>static-resources-list</param-name>
>>> <param-value>.*\.html .*\.htm .*\.js .*\.css</param-value>
>>> </init-param>
>>> <load-on-startup>1</load-on-startup>
>>> </servlet>
>>> <servlet-mapping>
>>> <servlet-name>CXFServlet</servlet-name>
>>> <url-pattern>/*</url-pattern>
>>> </servlet-mapping>
>>>
>>> As you can see my servlet is matching all requests that's why I must
>>> handle JSPs and static contact. The above config works like charm on
>>> Tomcat. Unfortunately I need my application both on Tomcat and Weblogic.
>>> After looking into org.apache.cxf.transport.servlet.AbstractHTTPServlet,
>>> I found out that with WbLogic servlet context, there's no request
>>> dispatcher for the name JSP. So I tried adding the following servlet to
>>> my web.xml:
>>> <servlet>
>>> <servlet-name>jsp</servlet-name>
>>> <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
>>> </servlet>
>>>
>>> With this additional config the request is endlessly redirected to the
>>> same servlet (weblogic.servlet.JSPServlet) and I end with
>>> StackOverflowError which is catched in AbstractHTTPServlet.
>>>
>>> So I can mark the following problems:
>>> 1. I can not serve JSPs with redirect, on WebLogic...
>>>
>>> 2. I can't make the application work on both WL and Tomcat. Even If I
>>> can add some servlet config for weblogic (hopefully issue 1 will be
>>> solved), then I will need two separate web.xml configs for weblogic and
>>> tomcat.
>>>
>>
>> Can you please try using a "redirect-servlet-path" instead of
>> redirect-servlet-name property and set to "" ? Looking at the code,
>> what should happen in this case is that a dispatcher for "" +
>> "/my.jsp" should be checked instead,
>>
>> let me know please if it helps
>>
>> Cheers, Sergey
>>
>>
>>> I hope someone will have any ideas how can I proceed.
>>>
>>> Regards,
>>> Nikolay
>>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

RE: partial response problem with SOAP 1.1 use of WS-Addressing and SOAPAction

Posted by Jesse Pangburn <Je...@us.lawson.com>.
Issue is created as https://issues.apache.org/jira/browse/CXF-3916

I've run the following build command on 2.4.2 with this patched and it didn't give any errors:
mvn -Pfastinstall,everything install

Not sure if that build command runs the tests you're referring to or not.

Thanks,
Jesse

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Tuesday, November 15, 2011 1:10 PM
To: users@cxf.apache.org
Cc: Jesse Pangburn
Subject: Re: partial response problem with SOAP 1.1 use of WS-Addressing and SOAPAction

On Thursday, November 10, 2011 4:39:22 PM Jesse Pangburn wrote:
> Hi Dan,
> So I've read over this more and now see that the partial response stuff is
> definitely for asynchronous processing, so the check with the WS-Addressing
> relatesTo header makes sense.  The problem (I think) appears in your
> checkin revision 705446 for ClientImpl.java in this section: synchronized
> (message.getExchange()) {
>         if (!isPartialResponse(message) && callback == null) {
>             message.getExchange().put(FINISHED, Boolean.TRUE);
>             message.getExchange().setInMessage(message);
>             message.getExchange().notifyAll();
>         }
>     }
> 
> You added the "&& callback == null" test, but I think what is needed is "||
> callback == null".  The idea here (again, as I'm reading it) is regarding
> these two cases: - it's an asynchronous response which is not a partial
> response
> - there is no callback, meaning it's a synchronous response
> 
> In either of these cases you want to tell the exchange that it's finished
> and the message you just got is the inbound message.  I think this worked
> for a long time without anyone running into this because in the synchronous
> case (callback == null), the only way you get a partialResponse==true is
> when WS-Addressing is engaged AND the server that you're connecting to
> doesn't return the optional (but almost always used) relatesTo header. 
> Probably in the vast majority of cases either WS-Addressing isn't used or
> the relatesTo header is present in a response.
> 
> If you agree, I can create a defect and describe this.  Since the change is
> just && to ||, obviously it won't help to send you a patch file :-)

That SOUNDS likely from the description, but I'd definitely need to run all 
the tests and such again to make sure.   Can you file a JIRA with all this so 
I don't forget about it and to make sure it's tracked?

Thanks!

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com



Re: partial response problem with SOAP 1.1 use of WS-Addressing and SOAPAction

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday, November 10, 2011 4:39:22 PM Jesse Pangburn wrote:
> Hi Dan,
> So I've read over this more and now see that the partial response stuff is
> definitely for asynchronous processing, so the check with the WS-Addressing
> relatesTo header makes sense.  The problem (I think) appears in your
> checkin revision 705446 for ClientImpl.java in this section: synchronized
> (message.getExchange()) {
>         if (!isPartialResponse(message) && callback == null) {
>             message.getExchange().put(FINISHED, Boolean.TRUE);
>             message.getExchange().setInMessage(message);
>             message.getExchange().notifyAll();
>         }
>     }
> 
> You added the "&& callback == null" test, but I think what is needed is "||
> callback == null".  The idea here (again, as I'm reading it) is regarding
> these two cases: - it's an asynchronous response which is not a partial
> response
> - there is no callback, meaning it's a synchronous response
> 
> In either of these cases you want to tell the exchange that it's finished
> and the message you just got is the inbound message.  I think this worked
> for a long time without anyone running into this because in the synchronous
> case (callback == null), the only way you get a partialResponse==true is
> when WS-Addressing is engaged AND the server that you're connecting to
> doesn't return the optional (but almost always used) relatesTo header. 
> Probably in the vast majority of cases either WS-Addressing isn't used or
> the relatesTo header is present in a response.
> 
> If you agree, I can create a defect and describe this.  Since the change is
> just && to ||, obviously it won't help to send you a patch file :-)

That SOUNDS likely from the description, but I'd definitely need to run all 
the tests and such again to make sure.   Can you file a JIRA with all this so 
I don't forget about it and to make sure it's tracked?

Thanks!

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

RE: partial response problem with SOAP 1.1 use of WS-Addressing and SOAPAction

Posted by Jesse Pangburn <Je...@us.lawson.com>.
Hi Dan,
So I've read over this more and now see that the partial response stuff is definitely for asynchronous processing, so the check with the WS-Addressing relatesTo header makes sense.  The problem (I think) appears in your checkin revision 705446 for ClientImpl.java in this section:
    synchronized (message.getExchange()) {
        if (!isPartialResponse(message) && callback == null) {
            message.getExchange().put(FINISHED, Boolean.TRUE);
            message.getExchange().setInMessage(message);
            message.getExchange().notifyAll();                   
        }
    }

You added the "&& callback == null" test, but I think what is needed is "|| callback == null".  The idea here (again, as I'm reading it) is regarding these two cases:
- it's an asynchronous response which is not a partial response
- there is no callback, meaning it's a synchronous response

In either of these cases you want to tell the exchange that it's finished and the message you just got is the inbound message.  I think this worked for a long time without anyone running into this because in the synchronous case (callback == null), the only way you get a partialResponse==true is when WS-Addressing is engaged AND the server that you're connecting to doesn't return the optional (but almost always used) relatesTo header.  Probably in the vast majority of cases either WS-Addressing isn't used or the relatesTo header is present in a response.

If you agree, I can create a defect and describe this.  Since the change is just && to ||, obviously it won't help to send you a patch file :-)

Thanks,
Jesse

-----Original Message-----
From: Jesse Pangburn [mailto:Jesse.Pangburn@us.lawson.com] 
Sent: Wednesday, November 09, 2011 6:37 PM
To: users@cxf.apache.org
Subject: partial response problem with SOAP 1.1 use of WS-Addressing and SOAPAction

Hi,
I invoked a SOAP 1.1 web service using CXF 2.4.2 DispatchImpl and that service immediately returned the following soap header:
	<soap:Header>
		<wsa:MessageID>uuid:A12B3727-0B3D-11E1-983D-DFB5348FF699</wsa:MessageID>
		<wsa:Action>response</wsa:Action>
	</soap:Header>

My client hung for 60 seconds until a timeout was reached, at which point the response was available in the StaxSource.  Tracing the problem into the code revealed that it was waiting because the message response it had received so far was deemed a "partial response" due to the following code which always is called when WS-Addressing is enabled in MAPCodec.java:
    private void markPartialResponse(SoapMessage message, AddressingProperties maps) {
        if (ContextUtils.isRequestor(message) && null != maps
            && (null == maps.getRelatesTo() 
                || (null != maps.getRelatesTo()
                    && Names.WSA_UNSPECIFIED_RELATIONSHIP.equals(maps.getRelatesTo().getValue())))) {
            message.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
        } 
    }

The problem, I think, is this condition "null == maps.getRelatesTo()".  This essentially means that a WS-Addressing RelatesTo header is required to indicate that a message response is complete- even on a synchronous request/response.  I think the source of this problem is that the original WS-Addressing submission to W3C said that "This element MUST be present if the message is a reply" in the description for the RelatesTo header (see http://www.w3.org/Submission/ws-addressing/#_Toc77464323).  This language was struck from the final WS-Addressing 1.0 (see http://www.w3.org/TR/ws-addr-core/#msgaddrpropsinfoset) and means that RelatesTo is not required.

While I think it was sloppy on the part of the service writer to not include the RelatesTo header, it is OPTIONAL according to the spec.  So, especially in the case of a synchronous request, I think this code is incorrect.  A CXF Dispatch client should not hang until timeout is reached because an optional header is not included in the response.

Unfortunately, I'm not really sure what the correct solution is here since I don't understand the case for ever having a partial response message in a synchronous request/response.  Should later code note that the request/response is synchronous and ignore this partial response flag?  I assume the intention of this code is for asynchronous request/response so that the immediate response on the request's socket connection is not treated as the asynchronous response message.

Any clues?
Thanks,
Jesse





partial response problem with SOAP 1.1 use of WS-Addressing and SOAPAction

Posted by Jesse Pangburn <Je...@us.lawson.com>.
Hi,
I invoked a SOAP 1.1 web service using CXF 2.4.2 DispatchImpl and that service immediately returned the following soap header:
	<soap:Header>
		<wsa:MessageID>uuid:A12B3727-0B3D-11E1-983D-DFB5348FF699</wsa:MessageID>
		<wsa:Action>response</wsa:Action>
	</soap:Header>

My client hung for 60 seconds until a timeout was reached, at which point the response was available in the StaxSource.  Tracing the problem into the code revealed that it was waiting because the message response it had received so far was deemed a "partial response" due to the following code which always is called when WS-Addressing is enabled in MAPCodec.java:
    private void markPartialResponse(SoapMessage message, AddressingProperties maps) {
        if (ContextUtils.isRequestor(message) && null != maps
            && (null == maps.getRelatesTo() 
                || (null != maps.getRelatesTo()
                    && Names.WSA_UNSPECIFIED_RELATIONSHIP.equals(maps.getRelatesTo().getValue())))) {
            message.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
        } 
    }

The problem, I think, is this condition "null == maps.getRelatesTo()".  This essentially means that a WS-Addressing RelatesTo header is required to indicate that a message response is complete- even on a synchronous request/response.  I think the source of this problem is that the original WS-Addressing submission to W3C said that "This element MUST be present if the message is a reply" in the description for the RelatesTo header (see http://www.w3.org/Submission/ws-addressing/#_Toc77464323).  This language was struck from the final WS-Addressing 1.0 (see http://www.w3.org/TR/ws-addr-core/#msgaddrpropsinfoset) and means that RelatesTo is not required.

While I think it was sloppy on the part of the service writer to not include the RelatesTo header, it is OPTIONAL according to the spec.  So, especially in the case of a synchronous request, I think this code is incorrect.  A CXF Dispatch client should not hang until timeout is reached because an optional header is not included in the response.

Unfortunately, I'm not really sure what the correct solution is here since I don't understand the case for ever having a partial response message in a synchronous request/response.  Should later code note that the request/response is synchronous and ignore this partial response flag?  I assume the intention of this code is for asynchronous request/response so that the immediate response on the request's socket connection is not treated as the asynchronous response message.

Any clues?
Thanks,
Jesse



Re: Serving JSPs using redirect on WebLogic

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 09/11/11 18:31, Nikolay Aleksiev wrote:
> Hi,
>
> I tried your suggestion, but the results are not good.
>
> In both servers I get to StackOverflowError because of endless
> redirection. I tried setting redirect-servlet-path to both "" and "/".
>

There must be some way to make it work not only on Tomcat and Jetty but 
also on all servlet container, all of them are capable of handling 
redirects, it is something simple, some extra piece of info is missing 
in HttpServletRequestWrapper that CXF creates when redirecting to 
WebLogic dispatcher or some slash is missing, something like that.

Any chance you can create a simple test project with WebLogic ? Or 
experiment a bit more ? I think the stack overflow in the latter case is 
happening because CXFServlet is listening on /*, if it were a more 
restricted pattern which would not match JSP-targeted URIs then it would 
likely work better...However I'm interested what we can do to make it 
work with "/*" - that works OK with Tomcat/Jetty because they properly 
support named dispatchers (jsp, etc), but not with WebLogic...

Cheers, Sergey



> Cheers,
> Nikolay
>
>
>
> On 11/09/2011 07:31 PM, Sergey Beryozkin wrote:
>> Hi
>>
>> On 09/11/11 16:28, Nikolay Aleksiev wrote:
>>> Hi,
>>>
>>> I have the following CXF Servlet configuration:
>>>
>>> <!-- CXF Servlet -->
>>> <servlet>
>>> <servlet-name>CXFServlet</servlet-name>
>>> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
>>>
>>> <!-- Redirect all JSP requests to the default jsp servlet -->
>>> <init-param>
>>> <param-name>redirects-list</param-name>
>>> <param-value>.*\.jsp</param-value>
>>> </init-param>
>>> <init-param>
>>> <param-name>redirect-servlet-name</param-name>
>>> <param-value>jsp</param-value>
>>> </init-param>
>>> <!-- Serve static content -->
>>> <init-param>
>>> <param-name>static-resources-list</param-name>
>>> <param-value>.*\.html .*\.htm .*\.js .*\.css</param-value>
>>> </init-param>
>>> <load-on-startup>1</load-on-startup>
>>> </servlet>
>>> <servlet-mapping>
>>> <servlet-name>CXFServlet</servlet-name>
>>> <url-pattern>/*</url-pattern>
>>> </servlet-mapping>
>>>
>>> As you can see my servlet is matching all requests that's why I must
>>> handle JSPs and static contact. The above config works like charm on
>>> Tomcat. Unfortunately I need my application both on Tomcat and Weblogic.
>>> After looking into org.apache.cxf.transport.servlet.AbstractHTTPServlet,
>>> I found out that with WbLogic servlet context, there's no request
>>> dispatcher for the name JSP. So I tried adding the following servlet to
>>> my web.xml:
>>> <servlet>
>>> <servlet-name>jsp</servlet-name>
>>> <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
>>> </servlet>
>>>
>>> With this additional config the request is endlessly redirected to the
>>> same servlet (weblogic.servlet.JSPServlet) and I end with
>>> StackOverflowError which is catched in AbstractHTTPServlet.
>>>
>>> So I can mark the following problems:
>>> 1. I can not serve JSPs with redirect, on WebLogic...
>>>
>>> 2. I can't make the application work on both WL and Tomcat. Even If I
>>> can add some servlet config for weblogic (hopefully issue 1 will be
>>> solved), then I will need two separate web.xml configs for weblogic and
>>> tomcat.
>>>
>>
>> Can you please try using a "redirect-servlet-path" instead of
>> redirect-servlet-name property and set to "" ? Looking at the code,
>> what should happen in this case is that a dispatcher for "" +
>> "/my.jsp" should be checked instead,
>>
>> let me know please if it helps
>>
>> Cheers, Sergey
>>
>>
>>> I hope someone will have any ideas how can I proceed.
>>>
>>> Regards,
>>> Nikolay
>>


Re: Serving JSPs using redirect on WebLogic

Posted by Woonsan Ko <wo...@yahoo.com>.
Hi Nikolay / Sergey,

I think one workaround is to add a servlet filter which inspects the request path and forwards to a named CXF servlet unless the request is for static resources or jsp.
I also think this can be a better solution because it doesn't depend on the configurable tomcat specific jsp servlet.

Cheers,
Woonsan


----- Original Message -----
> From: Nikolay Aleksiev <ni...@alexiev.net>
> To: users@cxf.apache.org
> Cc: Sergey Beryozkin <sb...@gmail.com>
> Sent: Wednesday, November 9, 2011 1:31 PM
> Subject: Re: Serving JSPs using redirect on WebLogic
> 
> Hi,
> 
> I tried your suggestion, but the results are not good.
> 
> In both servers I get to StackOverflowError because of endless 
> redirection. I tried setting redirect-servlet-path to both "" and 
> "/".
> 
> Cheers,
> Nikolay
> 
> 
> 
> On 11/09/2011 07:31 PM, Sergey Beryozkin wrote:
>>  Hi
>> 
>>  On 09/11/11 16:28, Nikolay Aleksiev wrote:
>>>  Hi,
>>> 
>>>  I have the following CXF Servlet configuration:
>>> 
>>>  <!-- CXF Servlet -->
>>>  <servlet>
>>>  <servlet-name>CXFServlet</servlet-name>
>>> 
> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> 
> 
>>> 
>>>  <!-- Redirect all JSP requests to the default jsp servlet -->
>>>  <init-param>
>>>  <param-name>redirects-list</param-name>
>>>  <param-value>.*\.jsp</param-value>
>>>  </init-param>
>>>  <init-param>
>>>  <param-name>redirect-servlet-name</param-name>
>>>  <param-value>jsp</param-value>
>>>  </init-param>
>>>  <!-- Serve static content -->
>>>  <init-param>
>>>  <param-name>static-resources-list</param-name>
>>>  <param-value>.*\.html .*\.htm .*\.js 
> .*\.css</param-value>
>>>  </init-param>
>>>  <load-on-startup>1</load-on-startup>
>>>  </servlet>
>>>  <servlet-mapping>
>>>  <servlet-name>CXFServlet</servlet-name>
>>>  <url-pattern>/*</url-pattern>
>>>  </servlet-mapping>
>>> 
>>>  As you can see my servlet is matching all requests that's why I 
> must
>>>  handle JSPs and static contact. The above config works like charm on
>>>  Tomcat. Unfortunately I need my application both on Tomcat and 
> Weblogic.
>>>  After looking into 
> org.apache.cxf.transport.servlet.AbstractHTTPServlet,
>>>  I found out that with WbLogic servlet context, there's no request
>>>  dispatcher for the name JSP. So I tried adding the following servlet to
>>>  my web.xml:
>>>  <servlet>
>>>  <servlet-name>jsp</servlet-name>
>>>  <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
>>>  </servlet>
>>> 
>>>  With this additional config the request is endlessly redirected to the
>>>  same servlet (weblogic.servlet.JSPServlet) and I end with
>>>  StackOverflowError which is catched in AbstractHTTPServlet.
>>> 
>>>  So I can mark the following problems:
>>>  1. I can not serve JSPs with redirect, on WebLogic...
>>> 
>>>  2. I can't make the application work on both WL and Tomcat. Even If 
> I
>>>  can add some servlet config for weblogic (hopefully issue 1 will be
>>>  solved), then I will need two separate web.xml configs for weblogic and
>>>  tomcat.
>>> 
>> 
>>  Can you please try using a "redirect-servlet-path" instead of 
>>  redirect-servlet-name property and set to "" ? Looking at the 
> code, 
>>  what should happen in this case is that a dispatcher for "" + 
>>  "/my.jsp" should be checked instead,
>> 
>>  let me know please if it helps
>> 
>>  Cheers, Sergey
>> 
>> 
>>>  I hope someone will have any ideas how can I proceed.
>>> 
>>>  Regards,
>>>  Nikolay
>> 
>

Re: Serving JSPs using redirect on WebLogic

Posted by Nikolay Aleksiev <ni...@alexiev.net>.
Hi,

I tried your suggestion, but the results are not good.

In both servers I get to StackOverflowError because of endless 
redirection. I tried setting redirect-servlet-path to both "" and "/".

Cheers,
Nikolay



On 11/09/2011 07:31 PM, Sergey Beryozkin wrote:
> Hi
>
> On 09/11/11 16:28, Nikolay Aleksiev wrote:
>> Hi,
>>
>> I have the following CXF Servlet configuration:
>>
>> <!-- CXF Servlet -->
>> <servlet>
>> <servlet-name>CXFServlet</servlet-name>
>> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> 
>>
>> <!-- Redirect all JSP requests to the default jsp servlet -->
>> <init-param>
>> <param-name>redirects-list</param-name>
>> <param-value>.*\.jsp</param-value>
>> </init-param>
>> <init-param>
>> <param-name>redirect-servlet-name</param-name>
>> <param-value>jsp</param-value>
>> </init-param>
>> <!-- Serve static content -->
>> <init-param>
>> <param-name>static-resources-list</param-name>
>> <param-value>.*\.html .*\.htm .*\.js .*\.css</param-value>
>> </init-param>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>> <servlet-mapping>
>> <servlet-name>CXFServlet</servlet-name>
>> <url-pattern>/*</url-pattern>
>> </servlet-mapping>
>>
>> As you can see my servlet is matching all requests that's why I must
>> handle JSPs and static contact. The above config works like charm on
>> Tomcat. Unfortunately I need my application both on Tomcat and Weblogic.
>> After looking into org.apache.cxf.transport.servlet.AbstractHTTPServlet,
>> I found out that with WbLogic servlet context, there's no request
>> dispatcher for the name JSP. So I tried adding the following servlet to
>> my web.xml:
>> <servlet>
>> <servlet-name>jsp</servlet-name>
>> <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
>> </servlet>
>>
>> With this additional config the request is endlessly redirected to the
>> same servlet (weblogic.servlet.JSPServlet) and I end with
>> StackOverflowError which is catched in AbstractHTTPServlet.
>>
>> So I can mark the following problems:
>> 1. I can not serve JSPs with redirect, on WebLogic...
>>
>> 2. I can't make the application work on both WL and Tomcat. Even If I
>> can add some servlet config for weblogic (hopefully issue 1 will be
>> solved), then I will need two separate web.xml configs for weblogic and
>> tomcat.
>>
>
> Can you please try using a "redirect-servlet-path" instead of 
> redirect-servlet-name property and set to "" ? Looking at the code, 
> what should happen in this case is that a dispatcher for "" + 
> "/my.jsp" should be checked instead,
>
> let me know please if it helps
>
> Cheers, Sergey
>
>
>> I hope someone will have any ideas how can I proceed.
>>
>> Regards,
>> Nikolay
>

Re: Serving JSPs using redirect on WebLogic

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

On 09/11/11 16:28, Nikolay Aleksiev wrote:
> Hi,
>
> I have the following CXF Servlet configuration:
>
> <!-- CXF Servlet -->
> <servlet>
> <servlet-name>CXFServlet</servlet-name>
> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
> <!-- Redirect all JSP requests to the default jsp servlet -->
> <init-param>
> <param-name>redirects-list</param-name>
> <param-value>.*\.jsp</param-value>
> </init-param>
> <init-param>
> <param-name>redirect-servlet-name</param-name>
> <param-value>jsp</param-value>
> </init-param>
> <!-- Serve static content -->
> <init-param>
> <param-name>static-resources-list</param-name>
> <param-value>.*\.html .*\.htm .*\.js .*\.css</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
>
> As you can see my servlet is matching all requests that's why I must
> handle JSPs and static contact. The above config works like charm on
> Tomcat. Unfortunately I need my application both on Tomcat and Weblogic.
> After looking into org.apache.cxf.transport.servlet.AbstractHTTPServlet,
> I found out that with WbLogic servlet context, there's no request
> dispatcher for the name JSP. So I tried adding the following servlet to
> my web.xml:
> <servlet>
> <servlet-name>jsp</servlet-name>
> <servlet-class>weblogic.servlet.JSPServlet</servlet-class>
> </servlet>
>
> With this additional config the request is endlessly redirected to the
> same servlet (weblogic.servlet.JSPServlet) and I end with
> StackOverflowError which is catched in AbstractHTTPServlet.
>
> So I can mark the following problems:
> 1. I can not serve JSPs with redirect, on WebLogic...
>
> 2. I can't make the application work on both WL and Tomcat. Even If I
> can add some servlet config for weblogic (hopefully issue 1 will be
> solved), then I will need two separate web.xml configs for weblogic and
> tomcat.
>

Can you please try using a "redirect-servlet-path" instead of 
redirect-servlet-name property and set to "" ? Looking at the code, what 
should happen in this case is that a dispatcher for "" + "/my.jsp" 
should be checked instead,

let me know please if it helps

Cheers, Sergey


> I hope someone will have any ideas how can I proceed.
>
> Regards,
> Nikolay