Class SimplePageExtension

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<java.lang.String> myCssPaths  
      protected java.util.List<java.lang.String> myJsPaths  
      protected PagePlaces myPagePlaces  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SimplePageExtension addCssFile​(java.lang.String path)
      Add reference to CSS file to the page which includes this extension
      SimplePageExtension addJsFile​(java.lang.String path)
      Add reference to Javascript file to the page which includes this extension
      void fillModel​(java.util.Map<java.lang.String,​java.lang.Object> model, javax.servlet.http.HttpServletRequest request)
      This method is useful for extensions that do not have controllers (such extensions usually return path to JSP as their include URL).
      java.util.List<java.lang.String> getCssPaths()
      Returns list of additional CSS files paths required by this extension
      java.lang.String getIncludeUrl()
      Returns URL by which this page extension is included.
      java.util.List<java.lang.String> getJsPaths()
      Returns list of additional JavaScript files paths required by this extension
      PlaceId getPlaceId()
      Required by spring framework
      java.lang.String getPluginName()
      Returns some identifier unique among all extensions within one extension point.
      boolean isAvailable​(javax.servlet.http.HttpServletRequest request)
      Returns true if this extension is available (should be included on the page) for the specified request.
      protected boolean isGet​(javax.servlet.http.HttpServletRequest request)  
      protected boolean isPost​(javax.servlet.http.HttpServletRequest request)  
      void register()
      Initialization method, makes this extension available.
      void setIncludeUrl​(java.lang.String includeUrl)
      Set included URL, may be either jsp file or reference to other page
      void setPlaceId​(PlaceId placeId)
      Set location for this extension
      void setPluginName​(java.lang.String pluginName)
      Set plugin identifier
      void setPosition​(PositionConstraint positionConstraint)
      Sets extension position constraint
      java.lang.String toString()  
      void unregister()
      Dispose method, makes this extension unavailable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • myPagePlaces

        protected final PagePlaces myPagePlaces
      • myCssPaths

        protected java.util.List<java.lang.String> myCssPaths
      • myJsPaths

        protected java.util.List<java.lang.String> myJsPaths
    • Constructor Detail

      • SimplePageExtension

        @Autowired
        public SimplePageExtension​(PagePlaces pagePlaces)
      • SimplePageExtension

        public SimplePageExtension​(@NotNull
                                   PagePlaces pagePlaces,
                                   @NotNull
                                   PlaceId placeId,
                                   @NotNull @NonNls
                                   java.lang.String id,
                                   @NonNls
                                   java.lang.String includeUrl)
        Creates a simple UI extension. Should be registered via register() method to become active.
        Parameters:
        pagePlaces - can obtained via Spring
        placeId - determines the UI location where the content will be shown
        id - custom id of this extension. Should be unique throughout all the extensions plugged into the same PageId
        includeUrl - absolute path without web application context of the resource, for plugin resources use PluginDescriptor.getPluginResourcesPath(String) to obtain it
        See Also:
        register()
    • Method Detail

      • register

        public void register()
        Initialization method, makes this extension available. Must be called after full initialization of the extension, for instance, via Spring init-method
      • unregister

        public void unregister()
        Dispose method, makes this extension unavailable.
      • getIncludeUrl

        @NotNull
        public java.lang.String getIncludeUrl()
        Description copied from interface: PageExtension
        Returns URL by which this page extension is included. This url may point to a JSP file or to a controller. If URL is absolute it must not include context path. For plugin resources use PluginDescriptor.getPluginResourcesPath(String) to obtain the path.
        Specified by:
        getIncludeUrl in interface PageExtension
        Returns:
        URL of the page extension content
      • getPluginName

        @NotNull
        public java.lang.String getPluginName()
        Description copied from interface: PageExtension

        Returns some identifier unique among all extensions within one extension point. Despite its probably confusing name, the result of this method may not be related to any existing plugin names, its just an arbitrary string used to distinguish extensions within one extension point (PlaceId).

        Before TeamCity 5.1 plugin name used to determine paths to plugin resources, but since 5.1 it only plays a role of identifier.

        Specified by:
        getPluginName in interface PageExtension
        Returns:
        extension identifier.
      • getCssPaths

        @NotNull
        public java.util.List<java.lang.String> getCssPaths()
        Description copied from interface: PageExtension
        Returns list of additional CSS files paths required by this extension
        Specified by:
        getCssPaths in interface PageExtension
        Returns:
        list of CSS paths used by extension, see addCssFile(String)
      • getJsPaths

        @NotNull
        public java.util.List<java.lang.String> getJsPaths()
        Description copied from interface: PageExtension
        Returns list of additional JavaScript files paths required by this extension
        Specified by:
        getJsPaths in interface PageExtension
        Returns:
        list of Javascript paths used by extension, see addJsFile(String)
      • isAvailable

        public boolean isAvailable​(@NotNull
                                   javax.servlet.http.HttpServletRequest request)
        Description copied from interface: PageExtension
        Returns true if this extension is available (should be included on the page) for the specified request. If extension needs to be shown for some pages only, it can obtain original page URL via request attribute called "pageUrl":
        String pageUrl = (String)request.getAttribute("pageUrl");
        Specified by:
        isAvailable in interface PageExtension
        Parameters:
        request - HTTP request
        Returns:
        true if extension should be included in the page place
      • fillModel

        public void fillModel​(@NotNull
                              java.util.Map<java.lang.String,​java.lang.Object> model,
                              @NotNull
                              javax.servlet.http.HttpServletRequest request)
        Description copied from interface: PageExtension
        This method is useful for extensions that do not have controllers (such extensions usually return path to JSP as their include URL). method is called before processing is passed to JSP. It allows page extension to modify model passed to JSP. Note that since main page controller also uses this model for storing its parameters in case of parameter name conflict extension parameter will be removed and warning message will be logged into the server log.
        Specified by:
        fillModel in interface PageExtension
        Parameters:
        model - model to modify
        request - HTTP request
      • setPlaceId

        public void setPlaceId​(@NotNull
                               PlaceId placeId)
        Set location for this extension
        Parameters:
        placeId - location identifier
      • getPlaceId

        @NotNull
        public PlaceId getPlaceId()
        Required by spring framework
        Returns:
        place for this extension
      • setIncludeUrl

        public void setIncludeUrl​(@NotNull
                                  java.lang.String includeUrl)
        Set included URL, may be either jsp file or reference to other page
        Parameters:
        includeUrl - included url specification
      • setPluginName

        public void setPluginName​(@NotNull
                                  java.lang.String pluginName)
        Set plugin identifier
        Parameters:
        pluginName - plugin identifier
      • setPosition

        public void setPosition​(@NotNull
                                PositionConstraint positionConstraint)
        Sets extension position constraint
        Parameters:
        positionConstraint - positionConstraint
      • addCssFile

        @NotNull
        public SimplePageExtension addCssFile​(@NotNull
                                              java.lang.String path)
        Add reference to CSS file to the page which includes this extension
        Parameters:
        path - absolute path without web application context of the CSS file, for plugin resources use PluginDescriptor.getPluginResourcesPath(String) to obtain it
        Returns:
        self
      • addJsFile

        @NotNull
        public SimplePageExtension addJsFile​(@NotNull
                                             java.lang.String path)
        Add reference to Javascript file to the page which includes this extension
        Parameters:
        path - absolute path without web application context of the JS file, for plugin resources use PluginDescriptor.getPluginResourcesPath(String) to obtain it
        Returns:
        self
      • isGet

        protected boolean isGet​(@NotNull
                                javax.servlet.http.HttpServletRequest request)
      • isPost

        protected boolean isPost​(@NotNull
                                 javax.servlet.http.HttpServletRequest request)
      • toString

        @NonNls
        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object