The HTTP Bundle with Java Server Pages support provides the same functionality as the HTTP Bundle and additionally supports registration of JSP resources. The bundle together with the JSP Tool implement the Sun Microsystems Java Server Pages 1.1 specification.
Contents:
The JAR file of the HTTP JSP Bundle is httpjsp.jar, and is located in the bundles folder.
The HTTP JSP Bundle imports the same packages as the HTTP Bundle, and two additional packages, necessary for recognizing JSP resources:
|
The HTTP JSP Bundle exports the same package as the HTTP
Bundle - com.prosyst.mbs.services.http.
The HTTP bundle with JSP support allows developers to register JSP resources.
The JSP resources are registered in the JSP container, which is an integral
part of the HTTP JSP Bundle. The container treats JSP resources like servlets,
but instead of passing a servlet instance, it passes an instance of com.prosyst.mbs.services.http.jsp.JspServletBase
which implements javax.servlet.jsp.HttpJspPage. Its buffer size
differs from the specification requirement for 8KB and instead is limited up
to 1KB to optimize the overall behavior of mBS with JSP support.
The ProSyst implementation of the JSP specification deviates from the requirement to the JSP container to translate and compile the JSP resources. Runtime translation and compilation require too much resources and are not suitable for an embedded system. That's why the JSP Tool is provided. To register a JSP in the HTTP JSP Bundle, the JSP developer should first translate the JSP sources using the JSP Tool. The tool generates servlet classes from the JSP elements and then compiles them into CLASS files.
To register the CLASS files into the HTTP JSP server, you have to create a
deployment bundle, which registers them
as servlet resources. The servlet must be registered with an instance of
the HttpJspPage class, which is automatically inherited by all
servlets generated by the JSP Tool through the JspServletBase class.
The deployment bundle must import the packages javax.servlet, javax.servlet.http,
javax.servlet.jsp, if it uses tag libraries - the javax.servlet.jsp.tagtext
package and the com.prosyst.mbs.services.http.jsp package, if it
is generated by the JSP tool and extends JspServletBase class instead
of implementing HttpJspPage one. The package org.osgi.service.http
is also necessary for the deployment bundle, as this package contains the class,
which provides registration of resources into the HTTP server.
If the JSP uses a tag library or a JavaBean, it is recommended that the tag handler or bean packages are exported into the framework by another library bundle and then imported by the JSP deployment bundle.
The JSP Tool has an option to automatically create a bundle activator, which registers all generated servlets with a chosen alias. If you create your own bundle activator, have in mind the following steps:
stop method, unregister the listener
and the resources and unget the service. Note: As translation and compilation are not supported by the JSP container,
precompilation protocol is not implemented. When a request includes a parameter
jsp_precompile, it will receive 501 Not Implemented
response status.
The JSP container is capable of pooling custom tags - it maintains object pools for a certain number of custom tag handler classes. When a new tag handler class is used by a JSP and the limit of object pools has been reached, the JSP container removes the pools of two tags: the one not used since longest time and the one, which had least visitors for the last check period.
Pooling custom tags of a JSP page should be done in its implementation class
through the _jspGetTag and _jspReleaseTag JspServletBase's
methods. You can use the -tagpool option of the JSP Tool to automatically
include tag pooling for a JSP page.
You can use the mbs.http.tag.classes and mbs.http.tag.objects
system properties to configure the number and size of tag-specific object pools.
The HTTP JSP Bundle registers the same services as the HTTP Bundle:
The HTTP JSP Bundle registers two Managed Services. They have the same PIDs as the ones registered by the HTTP bundle and have the same configuration properties as the correspondent services of the HTTP bundle. If you have an HTTP bundle installed, the correspondent PIDs will be already registered with the Config Bundle and they won't be registered again by the HTTP JSP Bundle. All modifications you make to the values of the properties will be valid for both bundles.
User-friendly visual administration on the HTTP JSP Bundle is performed through the mConsole application. Read about configuring HTTP Aliases, HTTP Plain Server Configuration and HTTP Common Configuration in the HTTP Bundle document.
The HTTP JSP Bundle uses the following system properties for pooling custom tag handlers:
|
All of the VM system properties considered by the HTTP Bundle are also significant for the HTTP JSP Bundle.
mBeS offers the JSP Demo for illustration of the HTTP JSP support.