Class DataSourceLoader

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.isomorphic.servlet.BaseServlet
com.isomorphic.servlet.DataSourceLoader
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class DataSourceLoader extends BaseServlet
This servlet returns the Javascript representation of a list of DataSources or SimpleTypes passed as parameter "dataSource". It serves exactly the same purpose as the <loadDS> JSP tag, but works in environments (like SmartGWT) when JSP tags can't be used. Example usage:
   <script src="../isomorphic/DataSourceLoader?dataSource=animals,worldDS,employees"></script>
 
You can specify $systemSchema as a special DataSource ID in order to include the DataSources which the <loadSystemSchema> JSP tag would output.

NOTE: This servlet is configured to automatically set character encoding on requests and responses to UTF-8. If you wish to force a different encoding, you can do so by specifying an init-param in your web.xml file, like so:

 <servlet>
   <servlet-name>DataSourceLoader</servlet-name>
   <servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>
   <init-param>
     <param-name>encoding</param-name>
     <param-value>some-other-encoding</param-value>
   </init-param>
 </servlet>
 
If you wish to switch off explicit encoding altogether, use the init-param to set a value of "none".

Please see the client-side documentation on Internationalization for a discussion of why this procedure is necessary.

By default, DataSourceLoader outputs some stub code at the front of its response, which will cause a message box to appear if you have called DataSourceLoader without (or before) loading the actual SmartClient runtime. If you wish to switch this off for some reason, you can do so by setting init-param outputSCDetectionCode to false in the servlet's config block in your web.xml file, as described above.

DataSources can be loaded in mockMode (see DataSource.mockMode for details) by adding the request parameter mockMode=true.

See Also:
  • Field Details

    • enablePrettyPrinting

      public boolean enablePrettyPrinting
      Enables/disables pretty printing (formatting) of the output. Default value is false.