tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: JspRuntimeContext & JspServlet - Using SpringSource's Jasper 5.5.23 implementation in Http Service?
Date Sat, 06 Nov 2010 18:13:55 GMT
Hi Misha,

You won't get far with only osgi httpservice support.  IMO, practically speaking, you need
osgi WAB support that also implements jsp support.    You probably also want many of the osgi
ee specs as implemented e.g. in apache aries.  Geronimo includes all of these.  There may
well be other projects that support WABs, but I don't know what they are, and I don't know
of any that also include so much of the osgi ee support.

There are a bunch of problems in servlet related specs like jsp and jsf that osgi has not
addressed in standards yet such as tld file caches and faces-config.xml discovery that geronimo
has more or less working solutions for.  If you run into these kinds of problems any solution
will be proprietary.

thanks
david jencks

On Nov 6, 2010, at 10:27 AM, Misha Koshelev wrote:

> Hi David and all:
> 
> Thank you for the reference to the Geronimo project.
> http://geronimo.apache.org/
> 
> From what I understand, this is a specific Web server, and we would be
> tie end users to this (or another specific) Web server if we were to
> go this route.
> 
> Our lead developers, however, would very much like to preserve
> _independence_ from the specific Web server on which OpenMRS is
> running, see, e.g.,
> 
> http://tickets.openmrs.org/browse/TRUNK-1596?focusedCommentId=162538&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_162538
> 
> http://tickets.openmrs.org/browse/TRUNK-1596?focusedCommentId=163079&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_163079
> 
> What I mean by "proxying" is a servlet bridge, such as:
> http://www.eclipse.org/equinox/server/http_in_container.php
> http://felix.apache.org/site/apache-felix-http-service.html#ApacheFelixHTTPService-UsingtheServletBridge
> 
> Perhaps my original email was a little too long-winded and the main
> question got lost... so I'll try to be concise:
> could someone possible explain JspRuntimeContext and JspServlet, and,
> specifically, how (or when) those are invoked to lead to proper Jsp
> processing of a servlet?
> 
> Or, more importantly, to my understanding, if you have an HTTP Service
> that does _not_ include Jasper, how does one go about adding
> JspServlet and/or JspRuntimeContext to add this support (I mean in
> theory at least, like "the JspServlet servlet has to be registered to
> handle all *.jsp requests or something like that..." I don't believe
> this is correct but I just mean a general theoretical understanding
> would be quite helpful).
> 
> Thank you!
> 
> Yours
> Misha
> 
> On Sat, Nov 6, 2010 at 2:15 AM, David Jencks <david_jencks@yahoo.com> wrote:
>> I don't understand the diagram you show nor what you mean by bridging, but you might
want to consider looking at geronimo 3.  We have tomcat and jasper running in an osgi environment
and can deploy WABs and also EE wars as osgi bundles.   I believe you can (as of a few days
ago) look up the bundle/bundle context in jndi and get it injected into your ee components.
>> 
>> Whether or not this is something you want to look into I'd suggest you look into
a container that supports WABs.
>> 
>> thanks
>> david jencks
>> 
>> On Nov 5, 2010, at 9:02 PM, Misha Koshelev wrote:
>> 
>>> Dear All:
>>> 
>>> My sincerest apologies if this is the wrong forum for this question. I
>>> was unable to find a better place for Jasper API support/questions.
>>> 
>>> I am working on a ticket to make the OpenMRS medical records system
>>> run in an OSGi environment.
>>> http://tickets.openmrs.org/browse/TRUNK-1596
>>> 
>>> SUMMARY:
>>> My simple question - is there, at the very least, some clear
>>> explanation of JspRuntimeContext and JspServlet (besides
>>> http://tomcat.apache.org/tomcat-5.5-doc/jasper/docs/api/org/apache/jasper/compiler/JspRuntimeContext.html
>>> http://tomcat.apache.org/tomcat-5.5-doc/jasper/docs/api/org/apache/jasper/servlet/JspServlet.html
>>> ) or, more importantly, is there any clear guide or suggestions for
>>> how to use these within a non-JSP aware server to have proper JSP
>>> support, esp. with regard to
>>> taglibs (as, at the very least, the Jsp file seems to be processed and
>>> include directives seem to be occurring - which seems strange if
>>> Jasper is not functioning at all, although this is the case at least
>>> based on the logs).
>>> 
>>> Any help much appreciated
>>> 
>>> DETAILS:
>>> We are able to use Spring Web extender
>>> http://static.springsource.org/osgi/docs/current/reference/html/web.html
>>> to successfully make OpenMRS run within an OSGi environment
>>> http://tickets.openmrs.org/secure/attachment/34857/1596-latest.patch
>>> 
>>> we would like to have a "proxy" setup, i.e.,
>>> 
>>> Tomcat -> WAR -> OSGi -> OSGified OpenMRS
>>>                                           -> module 1
>>>                                           -> module 2
>>>                                           etc.
>>> 
>>> I am currently trying to thus move to using an OSGi HTTP Service
>>> implementation, as this allows bridging as above. I have found Apache
>>> Felix HTTP Service
>>> http://felix.apache.org/site/apache-felix-http-service.html
>>> to be quite nice for this purpose.
>>> 
>>> I am using SpringSource's version of Jasper for my OSGi project:
>>> https://s3browse.springsource.com/browse/maven.springframework.org/osgi/org/springframework/osgi/jasper.osgi/5.5.23-SNAPSHOT/
>>> (I was not able to find the source for these JARs, but based on the
>>> output of jar tvf
>>> http://maven.springframework.org/osgi/org/springframework/osgi/jasper.osgi/5.5.23-SNAPSHOT/jasper.osgi-5.5.23-20080229.204604-1.jar,
>>> the MANIFEST.MF, and the pom.xml from that JAR - all attached; it
>>> seems that this is more or less an unmodified Jasper (I am a Jasper
>>> newbie and so could be _very_ wrong).
>>> 
>>> The latest update that regards Jasper can be found here:
>>> http://tickets.openmrs.org/browse/TRUNK-1596?focusedCommentId=163205&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_163205
>>> 
>>> In brief, in the current version, index.jsp is clearly being
>>> processed, as the mapping to /favicon.ico
>>> DEBUG - InternalResourceView.renderMergedOutputModel(236) |2010-11-05
>>> 19:57:55,239| Forwarding to resource [/WEB-INF/view/index.jsp] in
>>> InternalResourceView 'index'
>>> WARN - DispatcherServlet.noHandlerFound(962) |2010-11-05 19:57:55,277|
>>> No mapping found for HTTP request with URI [/favicon.ico] in
>>> DispatcherServlet with name 'servlet_4'
>>> is clearly coming from our file:
>>> <link rel="icon" type="image/ico"
>>> href="<openmrs:contextPath/><spring:theme code='favicon' />">
>>> webapp/src/main/webapp/WEB-INF/template/headerFull.jsp
>>> which is linked in
>>>               <%@ include file="headerFull.jsp" %>
>>> ./webapp/src/main/webapp/WEB-INF/template/header.jsp
>>> which, in turn, is linked in
>>> <%@ include file="/WEB-INF/template/header.jsp" %>
>>> ./webapp/src/main/webapp/WEB-INF/view/index.jsp
>>> 
>>> (full files, for reference, are:
>>> http://svn.openmrs.org/openmrs/trunk/webapp/src/main/webapp/WEB-INF/view/index.jsp
>>> http://svn.openmrs.org/openmrs/trunk/webapp/src/main/webapp/WEB-INF/template/header.jsp
>>> http://svn.openmrs.org/openmrs/trunk/webapp/src/main/webapp/WEB-INF/template/headerFull.jsp
>>> )
>>> 
>>> However, for one thing, our taglibs are _not_ being processed at all,
>>> as, the class referenced in
>>>       <name>contextPath</name>
>>>       <tag-class>org.openmrs.web.taglib.ContextPathTag</tag-class>
>>> http://svn.openmrs.org/openmrs/trunk/webapp/src/main/webapp/WEB-INF/taglibs/openmrs.tld
>>> for openmrs:contextPath never receives calls in its doStartTag() or
>>> doEndTag() methods (class is here
>>> http://svn.openmrs.org/openmrs/trunk/web/src/main/java/org/openmrs/web/taglib/ContextPathTag.java
>>> ).
>>> 
>>> SpringSource seems to do ClassLoader magic to somehow make Jasper
>>> support work (by chaining a Jasper classloader to the bundle
>>> classloader?), see, e.g.,
>>> https://src.springframework.org/svn/spring-osgi/tags/spring-osgi-1.2.1/web/src/main/java/org/springframework/osgi/web/deployer/jetty/JettyWarDeployer.java
>>> https://src.springframework.org/svn/spring-osgi/tags/spring-osgi-1.2.1/web/src/main/java/org/springframework/osgi/web/deployer/internal/util/
>>> 
>>> Notably, if I turn org.apache.jasper logging to DEBUG, I see:
>>> DEBUG - JspRuntimeContext.<init>(103) |2010-11-05 22:19:01,881| Parent
>>> class loader is: Openmrsorg.openmrs.util.OpenmrsClassLoader@58d67b44
>>> DEBUG - JspRuntimeContext.initClassPath(344) |2010-11-05 22:19:01,889|
>>> Compilation classpath initialized:
>>> /tmp/Jetty_0_0_0_0_8080_jetty-openmrs3074779251420665248.osgi__openmrs__15846m/jsp:null
>>> DEBUG - JspServlet.init(103) |2010-11-05 22:19:01,890| Scratch dir for
>>> the JSP engine is:
>>> /tmp/Jetty_0_0_0_0_8080_jetty-openmrs3074779251420665248.osgi__openmrs__15846m/jsp
>>> DEBUG - JspServlet.init(105) |2010-11-05 22:19:01,890| IMPORTANT: Do
>>> not modify the generated servlets
>>> INFO - AbstractWarDeployer.deploy(94) |2010-11-05 22:19:01,989|
>>> Successfully deployed bundle [openmrs-webapp
>>> (org.openmrs.web.openmrs-webapp)] at [/openmrs] on server Jetty-6.1.x
>>> (AbstractWarDeployer.java is here:
>>> https://src.springframework.org/svn/spring-osgi/tags/spring-osgi-1.2.1/web/src/main/java/org/springframework/osgi/web/deployer/support/AbstractWarDeployer.java
>>> and is subclassed by JettyWarDeployer.java
>>> https://src.springframework.org/svn/spring-osgi/tags/spring-osgi-1.2.1/web/src/main/java/org/springframework/osgi/web/deployer/jetty/JettyWarDeployer.java
>>> which does all the work).
>>> 
>>> Further, when we load index.jsp I see
>>> DEBUG - ContentNegotiatingViewResolver.resolveViewName(386)
>>> |2010-11-05 18:06:37,132| Returning
>>> [org.springframework.web.servlet.view.JstlVi\
>>> ew: name 'index'; URL [/WEB-INF/view/index.jsp]] based on requested
>>> media type 'text/html'
>>> DEBUG - InternalResourceView.renderMergedOutputModel(236) |2010-11-05
>>> 18:06:37,136| Forwarding to resource [/WEB-INF/view/index.jsp] in
>>> Inte\
>>> rnalResourceView 'index'
>>> DEBUG - JspServlet.service(248) |2010-11-05 18:06:37,136| JspEngine
>>> --> /WEB-INF/view/index.jsp
>>> DEBUG - JspServlet.service(249) |2010-11-05 18:06:37,136| ServletPath:
>>> /WEB-INF/view/index.jsp
>>> DEBUG - JspServlet.service(250) |2010-11-05 18:06:37,137| PathInfo: null
>>> DEBUG - JspServlet.service(251) |2010-11-05 18:06:37,137| RealPath:
>>> /tmp/jetty-openmrs3852173793073389964.osgi/WEB-INF/view/in\
>>> dex.jsp
>>> DEBUG - JspServlet.service(252) |2010-11-05 18:06:37,137| RequestURI:
>>> /openmrs/WEB-INF/view/index.jsp
>>> DEBUG - JspServlet.service(253) |2010-11-05 18:06:37,138| QueryString: null
>>> DEBUG - JspServlet.service(254) |2010-11-05 18:06:37,138| Request Params:
>>> 
>>> whereas JspServlet is clearly _not_ involved in the current HTTP
>>> Service implementation.
>>> 
>>> My simple question - is there, at the very least, some clear
>>> explanation of JspRuntimeContext and JspServlet (besides
>>> http://tomcat.apache.org/tomcat-5.5-doc/jasper/docs/api/org/apache/jasper/compiler/JspRuntimeContext.html
>>> http://tomcat.apache.org/tomcat-5.5-doc/jasper/docs/api/org/apache/jasper/servlet/JspServlet.html
>>> ) or, more importantly, is there any clear guide or suggestions for
>>> how to use these within a non-JSP aware server to have proper JSP
>>> support, esp. with regard to
>>> taglibs (as, at the very least, the Jsp file seems to be processed and
>>> include directives seem to be occurring - which seems strange if
>>> Jasper is not functioning at all, although this is the case at least
>>> based on the logs).
>>> 
>>> Any help much appreciated
>>> 
>>> Thank you
>>> 
>>> Yours
>>> Misha
>>> <jar_tvf_org.springframework.osgi.jasper.osgi_5.5.23.SNAPSHOT.txt><pom.xml>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: dev-help@tomcat.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message