Class SimplePageExtension

    • Constructor Detail

      • SimplePageExtension

        @Autowired
        public SimplePageExtension​(PagePlaces pagePlaces)
      • SimplePageExtension

        public SimplePageExtension​(@NotNull
                                   PagePlaces pagePlaces,
                                   @NotNull
                                   PlaceId placeId,
                                   @NotNull @NonNls
                                   String id,
                                   @NonNls
                                   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.
      • getPluginName

        @NotNull
        public 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.
      • 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
                              Map<String,​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
                                  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
                                  String pluginName)
        Set plugin identifier
        Parameters:
        pluginName - plugin identifier
      • setPosition

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

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

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