You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Paul Piper (JIRA)" <ji...@apache.org> on 2012/09/18 15:28:07 UTC

[jira] [Created] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Paul Piper created OFBIZ-5037:
---------------------------------

             Summary: ControlServlet - Exception thrown for requests not defined by controller.xml
                 Key: OFBIZ-5037
                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
             Project: OFBiz
          Issue Type: Improvement
          Components: ALL APPLICATIONS
            Reporter: Paul Piper
            Priority: Trivial


The current rendering within OFBiz expects the following setup:

* Request is always submit against /control
* /control will pickup the request and handle by ControlServlet
* ControlServlet will check within controller.xml for an entry

Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 

The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:

{code}
2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
{code}

Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-5037.
----------------------------------

       Resolution: Fixed
    Fix Version/s: SVN trunk

Commited in trunk at revision: 1391037  

                
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>             Fix For: SVN trunk
>
>         Attachments: OFBIZ-5037.patch, OFBIZ-5037.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux reassigned OFBIZ-5037:
--------------------------------------

    Assignee: Jacques Le Roux
    
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458917#comment-13458917 ] 

Jacques Le Roux commented on OFBIZ-5037:
----------------------------------------

Note: the solution is using a specific exception but does not log any errors. Of course for this to work when using throwRequestHandlerExceptionOnMissingLocalRequest=N you need to have the external requests ready to handle the flow. Else you will simply get an error in the browser but nothing in log, since it's supposed to be handled externally. I think I will put a Debug.logInfo with the name of the external request in the RequestHandlerExceptionAllowExternalRequests catch... later...
                
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>         Attachments: OFBIZ-5037.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux updated OFBIZ-5037:
-----------------------------------

    Attachment: OFBIZ-5037.patch

Before committing, here is the solution I came with. It has been tested, but please review. 
                
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>         Attachments: OFBIZ-5037.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Comment Edited] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459382#comment-13459382 ] 

Jacques Le Roux edited comment on OFBIZ-5037 at 9/20/12 5:33 PM:
-----------------------------------------------------------------

== TYPO ==
I don't see which if would be missing, maybe you missed it because I inlined?
{code}
-        // still not found so stop
+        // if no matching request is found in the controller, depending on THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST
+        //  we throw a RequestHandlerException or RequestHandlerExceptionAllowExternalRequests
         if (requestMap == null) {
-            throw new RequestHandlerException(requestMissingErrorMessage);
-        }
+            if (THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST) throw new RequestHandlerException(requestMissingErrorMessage);
+            else throw new RequestHandlerExceptionAllowExternalRequests();
+         }
{code}
Let me explain the solution: THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST value (Boolean) is defined following the throwRequestHandlerExceptionOnMissingLocalRequest properties. THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST is used when requestMap is null which is the case when no request-map is defined (because it's an external request). At this point THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST decides if you want to throw a RequestHandlerException with a requestMissingErrorMessage or if you want to continue with a possible external request. If you go the external request way, you can't use return, else nothing will be rendered, you can't also continue because you have no requestMap (though I tried but then your only solution would be to use ConfigXMLReader.emptyNoneRequestResponse which leads nowhere). So you have to use an exception to let the process continue. You also need to feed an error page for a RequestDispatcher to be created and the default error page to be included (used by RequestDispatcher.include()). Then your external ControlServlet can handle the response just fine. As I said this has beeen tested and works in both cases without side effects.

In the new patch I have just added this line
{code}
Debug.logInfo("Going to external page: " + request.getPathInfo(), module);
{code}

                
      was (Author: jacques.le.roux):
    I don't see which if would be missing, maybe you missed it because I inlined?
{code}
-        // still not found so stop
+        // if no matching request is found in the controller, depending on THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST
+        //  we throw a RequestHandlerException or RequestHandlerExceptionAllowExternalRequests
         if (requestMap == null) {
-            throw new RequestHandlerException(requestMissingErrorMessage);
-        }
+            if (THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST) throw new RequestHandlerException(requestMissingErrorMessage);
+            else throw new RequestHandlerExceptionAllowExternalRequests();
+         }
{code}
Let me explain the solution: THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST value (Boolean) is defined following the throwRequestHandlerExceptionOnMissingLocalRequest properties. THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST is used when requestMap is null which is the case when no request-map is defined (because it's an external request). At this point THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST decides if you want to throw a RequestHandlerException with a requestMissingErrorMessage or if you want to continue with a possible external request. If you go the external request way, you can't use return, else nothing will be rendered, you can't also continue because you have no requestMap (though I tried but then your only solution would be to use ConfigXMLReader.emptyNoneRequestResponse which leads nowhere). So you have to use an exception to let the process continue. You also need to feed an error page for a RequestDispatcher to be created and the default error page to be included (used by RequestDispatcher.include()). Then your external ControlServlet can handle the response just fine. As I said this has beeen tested and works in both cases without side effect ;)

In the new patch I have just added this line
{code}
Debug.logInfo("Going to external page: " + request.getPathInfo(), module);
{code}

                  
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>         Attachments: OFBIZ-5037.patch, OFBIZ-5037.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458484#comment-13458484 ] 

Jacques Le Roux commented on OFBIZ-5037:
----------------------------------------

I suggest to add a throwExceptionOnMissingLocalRequest properties in general.properties which will continue with the current behaviour (throwing exception) if true (by default). If false no exception will be raised and only a warning and return will be used.

Hence no functional changes by default and possiblity to hide when using external requests: best of both worlds :)

I will commit something in trunk later
                
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Paul Piper (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459032#comment-13459032 ] 

Paul Piper commented on OFBIZ-5037:
-----------------------------------

I think you are missing an if statement. You are adding a replacementexception just fine (though I am not certain it is required here). Apart from that, you also load the properties but don't seem to do anything with it, or am I missing something?
                
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>         Attachments: OFBIZ-5037.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux updated OFBIZ-5037:
-----------------------------------

    Attachment: OFBIZ-5037.patch

I don't see which if would be missing, maybe you missed it because I inlined?
{code}
-        // still not found so stop
+        // if no matching request is found in the controller, depending on THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST
+        //  we throw a RequestHandlerException or RequestHandlerExceptionAllowExternalRequests
         if (requestMap == null) {
-            throw new RequestHandlerException(requestMissingErrorMessage);
-        }
+            if (THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST) throw new RequestHandlerException(requestMissingErrorMessage);
+            else throw new RequestHandlerExceptionAllowExternalRequests();
+         }
{code}
Let me explain the solution: THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST value (Boolean) is defined following the throwRequestHandlerExceptionOnMissingLocalRequest properties. THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST is used when requestMap is null which is the case when no request-map is defined (because it's an external request). At this point THROW_REQUEST_HANDLER_EXCEPTION_ON_MISSING_LOCAL_REQUEST decides if you want to throw a RequestHandlerException with a requestMissingErrorMessage or if you want to continue with a possible external request. If you go the external request way, you can't use return, else nothing will be rendered, you can't also continue because you have no requestMap (though I tried but then your only solution would be to use ConfigXMLReader.emptyNoneRequestResponse which leads nowhere). So you have to use an exception to let the process continue. You also need to feed an error page for a RequestDispatcher to be created and the default error page to be included (used by RequestDispatcher.include()). Then your external ControlServlet can handle the response just fine. As I said this has beeen tested and works in both cases without side effect ;)

In the new patch I have just added this line
{code}
Debug.logInfo("Going to external page: " + request.getPathInfo(), module);
{code}

                
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>         Attachments: OFBIZ-5037.patch, OFBIZ-5037.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OFBIZ-5037) ControlServlet - Exception thrown for requests not defined by controller.xml

Posted by "Paul Piper (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-5037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459399#comment-13459399 ] 

Paul Piper commented on OFBIZ-5037:
-----------------------------------

Ah, yes, I think that one slipped my eye. Looks good! :)
                
> ControlServlet - Exception thrown for requests not defined by controller.xml
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-5037
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5037
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>            Reporter: Paul Piper
>            Assignee: Jacques Le Roux
>            Priority: Trivial
>              Labels: ControlServlet, exception, log
>         Attachments: OFBIZ-5037.patch, OFBIZ-5037.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> The current rendering within OFBiz expects the following setup:
> * Request is always submit against /control
> * /control will pickup the request and handle by ControlServlet
> * ControlServlet will check within controller.xml for an entry
> Because of it, the ControlServlet will intercept any request coming towards the application, except for requests that are mapped against similar servlets (/cms or alike). ControlServlet will throw an exception if no request is found and try to redirect towards an error page. 
> The underlying assumption here is that ControlServlet is always in the lead for rendering pages, unless the internal CMS is used. This does not have to be the case, however, since in practice it is also possible for users to implement a replacing cms or other means for rendering the pages. In those cases ControlServlet will still throw an error, albeit the request may already have been handled by a wrapping system:
> {code}
> 2012-09-18 09:54:22,869 (http-0.0.0.0-8080-13) [ ControlServlet.java:141:INFO ] [[[fm1] Request Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]]
> 2012-09-18 09:54:22,870 (http-0.0.0.0-8080-13) [ ControlServlet.java:227:ERROR] ---- exception report ---------------------------------------------------------- Error in request handler: Exception: org.ofbiz.webapp.control.RequestHandlerException Message: Unknown request [fm1]; this request does not exist or cannot be called directly. ---- stack trace --------------------------------------------------------------- org.ofbiz.webapp.control.RequestHandlerException: Unknown request [fm1]; this request does not exist or cannot be called directly. org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:146) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:224) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
> {code}
> Since this is a minor issue, I propose to remove the underlying exception and rather throw a warning instead. This would allow the users to extend the Servlet by their own means and yet allow the purpose to remain unchanged (clearly a logged message is wanted here). I will attach a patch to fix the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira