• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using SpringSource's Jasper within OSGi (moving from Spring Web Extender to HTTP Service)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All:

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.,



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


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

For reference, from http://maven.springframework.org/osgi/org/springframework/osgi/jasper.osgi/5.5.23-SNAPSHOT/jasper.osgi-5.5.23-20080229.204604-1.jar, tar jvf:

MANIFEST.MF:

and pom.xml

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic