Java Code Examples for javax.servlet.jsp.JspFactory#setDefaultFactory()
The following examples show how to use
javax.servlet.jsp.JspFactory#setDefaultFactory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JasperInitializer.java From piranha with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Initialize Jasper. * * @param classes the classes. * @param servletContext the Servlet context. * @throws ServletException when a Servlet error occurs. */ @Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { LOGGER.fine("Initializing Jasper integration"); if (JspFactory.getDefaultFactory() == null) { JspFactory.setDefaultFactory(new JspFactoryImpl()); } ServletRegistration.Dynamic registration = servletContext.addServlet( "JSP Servlet", "org.apache.jasper.servlet.JspServlet"); registration.addMapping("*.jsp"); String classpath = System.getProperty("java.class.path") + getClassesDirectory(servletContext) + getJarFiles(servletContext); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.log(Level.FINER, "Jasper classpath is: {0}", classpath); } registration.setInitParameter("classpath", classpath); registration.setInitParameter("compilerSourceVM", "1.8"); registration.setInitParameter("compilerTargetVM", "1.8"); WebApplication webApplication = (WebApplication) servletContext; webApplication.setJspManager(new JasperJspManager()); LOGGER.fine("Initialized Jasper integration"); }
Example 2
Source File: ViewerPlugin.java From birt with Eclipse Public License 1.0 | 5 votes |
private void setupJspFactory() { try { if (JspFactory.getDefaultFactory() == null) { // enforce setting the jspfactory instance as we know it here Class clz = Class.forName("org.apache.jasper.runtime.JspFactoryImpl"); //$NON-NLS-1$ if (clz != null) { JspFactory.setDefaultFactory((JspFactory) clz.newInstance()); } } } catch (Exception ex) { } }