You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2003/07/12 15:30:02 UTC
cvs commit: cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp JSPEngineImplNamedDispatcherInclude.java JSPEngineImpl.java
joerg 2003/07/12 06:30:02
Modified: src/blocks/jsp/java/org/apache/cocoon/generation
JspGenerator.java
. status.xml
src/blocks/jsp/java/org/apache/cocoon/components/jsp
JSPEngineImplNamedDispatcherInclude.java
JSPEngineImpl.java
Log:
bugfix 4934 applied: made JSPs working in Resin that don't end on .jsp (thanks to Ryder Rishel)
avoid NPE in JSPEngineImplNamedDispatcherInclude when no RequestDispatcher is found
Revision Changes Path
1.4 +1 -3 cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/generation/JspGenerator.java
Index: JspGenerator.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/generation/JspGenerator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JspGenerator.java 10 Jul 2003 23:38:04 -0000 1.3
+++ JspGenerator.java 12 Jul 2003 13:30:02 -0000 1.4
@@ -131,8 +131,6 @@
throw new ProcessingException("SAXException JspGenerator.generate()",e.getException());
} catch (IOException e) {
throw new ProcessingException("IOException JspGenerator.generate()",e);
- } catch (ProcessingException e) {
- throw e;
} catch (Exception e) {
throw new ProcessingException("Exception JspGenerator.generate()",e);
} finally {
1.89 +4 -1 cocoon-2.1/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/status.xml,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- status.xml 11 Jul 2003 18:32:25 -0000 1.88
+++ status.xml 12 Jul 2003 13:30:02 -0000 1.89
@@ -184,6 +184,9 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="JH" type="fix" fixes-bug="4934" due-to="Ryder Rishel" due-to-email=" ryderblue@yahoo.com">
+ Made JSPs working in Resin that don't end on *.jsp.
+ </action>
<action dev="JH" type="update">
All Reader accessing Avalon components now extend the ServiceableReader
instead of deprecated ComposerReader. It pertains the JSPReader, the
1.4 +12 -7 cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImplNamedDispatcherInclude.java
Index: JSPEngineImplNamedDispatcherInclude.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImplNamedDispatcherInclude.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JSPEngineImplNamedDispatcherInclude.java 10 Jul 2003 23:38:04 -0000 1.3
+++ JSPEngineImplNamedDispatcherInclude.java 12 Jul 2003 13:30:02 -0000 1.4
@@ -79,8 +79,10 @@
public class JSPEngineImplNamedDispatcherInclude extends AbstractLogEnabled
implements JSPEngine, Parameterizable, ThreadSafe {
- /** The Servlet Include Path */
+ /** The servlet include path. */
public static final String INC_SERVLET_PATH = "javax.servlet.include.servlet_path";
+ /** The servlet request uri, needed for Resin. */
+ public static final String INC_REQUEST_URI = "javax.servlet.include.request_uri";
/** config-parameter name for specifying the jsp servlet-name.
ie. servlet-name
@@ -123,11 +125,13 @@
// start JSPServlet.
javax.servlet.RequestDispatcher rd = context.getNamedDispatcher( servletName );
if (rd != null) {
- rd.include( request, response );
- response.flushBuffer();
- bytes = response.toByteArray();
+ rd.include( request, response );
+ response.flushBuffer();
+ bytes = response.toByteArray();
} else {
- getLogger().error( "Specify a correct " + CONFIG_SERVLET_NAME + " " + servletName );
+ // FIXME: I guess it's better to throw a more specific exception.
+ throw new Exception("No RequestDispatcher found. Specify a correct '"
+ + CONFIG_SERVLET_NAME + "': " + servletName);
}
return bytes;
}
@@ -170,8 +174,9 @@
/** @deprecated use isRequestedSessionIdFromURL instead. */
public boolean isRequestedSessionIdFromUrl(){ return request.isRequestedSessionIdFromUrl(); }
public Object getAttribute(String s){
- if(s != null && s.equals(INC_SERVLET_PATH))
+ if (s != null && (s.equals(INC_SERVLET_PATH) || s.equals(INC_REQUEST_URI))) {
return jspFile;
+ }
return request.getAttribute(s);
}
public Enumeration getAttributeNames(){ return request.getAttributeNames(); }
1.7 +6 -3 cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImpl.java
Index: JSPEngineImpl.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JSPEngineImpl.java 10 Jul 2003 23:38:04 -0000 1.6
+++ JSPEngineImpl.java 12 Jul 2003 13:30:02 -0000 1.7
@@ -80,8 +80,10 @@
public class JSPEngineImpl extends AbstractLogEnabled
implements JSPEngine, Parameterizable, ThreadSafe {
- /** The Servlet Include Path */
+ /** The servlet include path. */
public static final String INC_SERVLET_PATH = "javax.servlet.include.servlet_path";
+ /** The servlet request uri, needed for Resin. */
+ public static final String INC_REQUEST_URI = "javax.servlet.include.request_uri";
/** The Default Servlet Class Name for Tomcat 3.X and 4.X*/
public static final String DEFAULT_SERVLET_CLASS = "org.apache.jasper.servlet.JspServlet";
@@ -179,8 +181,9 @@
/** @deprecated use isRequestedSessionIdFromURL instead. */
public boolean isRequestedSessionIdFromUrl(){ return request.isRequestedSessionIdFromUrl(); }
public Object getAttribute(String s){
- if(s != null && s.equals(INC_SERVLET_PATH))
+ if (s != null && (s.equals(INC_SERVLET_PATH) || s.equals(INC_REQUEST_URI))) {
return jspFile;
+ }
return request.getAttribute(s);
}
public Enumeration getAttributeNames(){ return request.getAttributeNames(); }
Re: cvs commit: cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp
JSPEngineImplNamedDispatcherInclude.java JSPEngineImpl.java
Posted by Joerg Heinicke <jo...@gmx.de>.
Vadim Gritsenko wrote:
> joerg@apache.org wrote:
>
>> throw new ProcessingException("SAXException
>> JspGenerator.generate()",e.getException());
>> } catch (IOException e) {
>> throw new ProcessingException("IOException
>> JspGenerator.generate()",e);
>> - } catch (ProcessingException e) {
>> - throw e;
>>
>>
>
> This code avoids unnecessary wrapping of ProcessingException into one
> more ProcessingException. What was the reason to remove it? It took some
> time to add all those small pieces to avoid excessive exception wrapping...
>
> Vadim
Sorry, have been too fast here. I only saw the re-throw, which could be
removed in general, but not if Exception is caught afterwards.
Joerg
Re: cvs commit: cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp
JSPEngineImplNamedDispatcherInclude.java JSPEngineImpl.java
Posted by Vadim Gritsenko <va...@verizon.net>.
joerg@apache.org wrote:
>joerg 2003/07/12 06:30:02
>
> --- JspGenerator.java 10 Jul 2003 23:38:04 -0000 1.3
> +++ JspGenerator.java 12 Jul 2003 13:30:02 -0000 1.4
> @@ -131,8 +131,6 @@
> throw new ProcessingException("SAXException JspGenerator.generate()",e.getException());
> } catch (IOException e) {
> throw new ProcessingException("IOException JspGenerator.generate()",e);
> - } catch (ProcessingException e) {
> - throw e;
>
>
This code avoids unnecessary wrapping of ProcessingException into one
more ProcessingException. What was the reason to remove it? It took some
time to add all those small pieces to avoid excessive exception wrapping...
Vadim