Portlet development FAQ

When developers starts to develop portlets for SiteVision there commonly are some questions that arise early in the development phase. You will find the answers to some of these questions below.
  • Why does the SiteVision server run in a Java 'Client VM'?

    It doesn't! SiteVision always starts Java with the init parameter '-server'. Hence the JVM SiteVision runs in are always a Server VM, never a Client VM.

    Though, if you manually try to check the VM (i.e. execute 'java -version') of the JVM that SiteVision runs in you get different results ('Server VM' or 'Client VM') depending on the hardware of the machine. This is due to a feature introduced in Java 5.0 called Ergonomics.



  • Can I use the portlet caching mechanism i SiteVision on a customized portlet?

    Yes you can. The caching mechanism implemented in SiteVision caches the render response of a portlet and works regardless of the portlet is an internal SiteVision portlet or if it is a customized portlet deployed in custom/deploy.

    More information about how to enable portlet caching can be found here.

    Note that caching is not used when you are editing (offline mode or editing mode). The cache is filled on the first request in the online mode (visitor mode).



  • Encoding problem using JSP in a portlet

    You might experience problems with the encoding when developing JSP based portlets (this applies to both external portlets and the sitevision internal JSP portlet). The problem is that the tomcat JSP compiler jasper assumes that the portlet is ISO-8859-1. If you are using other encoding like UTF-8, make sure that you specify the contentTyping using the JSP page directive.

    <%@ page contentType="text/html;charset=UTF-8"%>

    Note that any internal JSP portlet uses UTF-8 and must have this attribute set.

    If your JSP portlet includes other resources like HTML jasper might behave strangely (sometimes assuming UTF-8 and sometimes ISO-8859-1) with resulting encoding problems. To solve this issue alter the extention of your HTML file to jsp and add the page directive specified above.

    The java files generated by jasper are located in the working directory of sitevision.

    .../data/temp/work/...



  • Can I access the SiteVision Public API in my portlet?

    Yes, you can. The Public API is accessible via request attributes at all times (i.e. even in custom portlets). When you compile/build your portlet you'll need to add the SiteVision Public API jar file to your classpath.

    More information is available on the Public API page.



  • Which IDE should I use?

    Use the Java IDE of your choice.The preferred IDE for SiteVision portlet developers is the free IntelliJ IDEA community Edition from Jetbrains or the open sourced Eclipse.

  • What MVC framework should I use?

    SiteVision portlet developers has used Struts2 as MVC framework in custom portlets.

  • What logging framework should I use?

    SiteVision currently uses Log4j. Any logging framework can be used by a portlet application. Using log4j as logging frameworkThere are some considerations when using log4j since a portlet application is using another class loader than the ROOT application (i.e. SiteVision).
    1. Your portlet application must contain the log4j.jar.
    2. A valid log4j configuration must be provided.
    3. The log4j framework must be aware of the configuration.


  • What Web Services framework should I use?

    Use the Web Services framework of your choice.

    (SiteVision uses Axis for the XML import Web Service, but the Axis JAR can not be accessed/loaded from within a custom portlet.)



  • Can JSF be used when implementing portlets?

    No portlet developer at SiteVision has tried this out but there are a JSF Portlet Bridge project you can check out.

Denna sida publicerades: 2016-11-15

Skriv ut PDF-avsnitt

Hjälpte informationen på den här sidan dig?

Missa inga nya rön, tips och tricks! Prenumerera på insite!

Find us!

SiteVision AB (Headquarter)
Vasagatan 10
702 10 Orebro
Sweden

Info: +46 19-17 30 30
Support: +46 19-17 30 39

Latest Tweets