Class SimplePageExtension
- java.lang.Object
-
- jetbrains.buildServer.web.openapi.SimplePageExtension
-
- All Implemented Interfaces:
PageExtension
- Direct Known Subclasses:
AdminBeforeContentExtension,AgentAuditLinkExtension,AttachBuildHistoryExtension,AzureDevOpsListRepositoriesPageExtension,BuildInfoFragmentTab,BuildResultsBuildProblemRenderer,ChangeDetailsExtension,CleanSourcesExtension,CloudImageDetailsExtensionBase,CurrentNodeSwitcher,DownloadIdsAction,EditBuildRunnerSettingsExtension,GenerateDslAction,GenerateTokenAction,GraphExtension,HealthStatusItemPageExtension,ListBitBucketRepositoriesPageExtension,ListGitHubRepositoriesPageExtension,ListGitlabRepositoriesPageExtension,ListSpaceRepositoriesPageExtension,ProjectPortlet,ResetFirstRevisionsExtension,ResetPasswordPageExtension,SetupObjectFromResourcePageExtension,SimpleCustomTab,TfsListRepositoriesPageExtension,UsagesReportPageExtension,ViewBuildRunnerSettingsExtension
public class SimplePageExtension extends Object implements PageExtension
Simple bean-like component for page extensions. Initialization method - 'register'. You have to specify properties includeUrl, pluginName, placeId
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>myCssPathsprotected List<String>myJsPathsprotected PagePlacesmyPagePlaces
-
Constructor Summary
Constructors Constructor Description SimplePageExtension(PagePlaces pagePlaces)SimplePageExtension(PagePlaces pagePlaces, PlaceId placeId, String id, String includeUrl)Creates a simple UI extension.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimplePageExtensionaddCssFile(String path)Add reference to CSS file to the page which includes this extensionSimplePageExtensionaddJsFile(String path)Add reference to Javascript file to the page which includes this extensionvoidfillModel(Map<String,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).List<String>getCssPaths()Returns list of additional CSS files paths required by this extensionStringgetIncludeUrl()Returns URL by which this page extension is included.List<String>getJsPaths()Returns list of additional JavaScript files paths required by this extensionPlaceIdgetPlaceId()Required by spring frameworkStringgetPluginName()Returns some identifier unique among all extensions within one extension point.booleanisAvailable(javax.servlet.http.HttpServletRequest request)Returns true if this extension is available (should be included on the page) for the specified request.protected booleanisGet(javax.servlet.http.HttpServletRequest request)protected booleanisPost(javax.servlet.http.HttpServletRequest request)voidregister()Initialization method, makes this extension available.voidsetIncludeUrl(String includeUrl)Set included URL, may be either jsp file or reference to other pagevoidsetPlaceId(PlaceId placeId)Set location for this extensionvoidsetPluginName(String pluginName)Set plugin identifiervoidsetPosition(PositionConstraint positionConstraint)Sets extension position constraintStringtoString()voidunregister()Dispose method, makes this extension unavailable.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.web.openapi.PageExtension
getDisplayName
-
-
-
-
Field Detail
-
myPagePlaces
protected final PagePlaces myPagePlaces
-
-
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 viaregister()method to become active.- Parameters:
pagePlaces- can obtained via SpringplaceId- determines the UI location where the content will be shownid- custom id of this extension. Should be unique throughout all the extensions plugged into the same PageIdincludeUrl- absolute path without web application context of the resource, for plugin resources usePluginDescriptor.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 String getIncludeUrl()
Description copied from interface:PageExtensionReturns 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 usePluginDescriptor.getPluginResourcesPath(String)to obtain the path.- Specified by:
getIncludeUrlin interfacePageExtension- Returns:
- URL of the page extension content
-
getPluginName
@NotNull public String getPluginName()
Description copied from interface:PageExtensionReturns 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:
getPluginNamein interfacePageExtension- Returns:
- extension identifier.
-
getCssPaths
@NotNull public List<String> getCssPaths()
Description copied from interface:PageExtensionReturns list of additional CSS files paths required by this extension- Specified by:
getCssPathsin interfacePageExtension- Returns:
- list of CSS paths used by extension, see
addCssFile(String)
-
getJsPaths
@NotNull public List<String> getJsPaths()
Description copied from interface:PageExtensionReturns list of additional JavaScript files paths required by this extension- Specified by:
getJsPathsin interfacePageExtension- 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:PageExtensionReturns 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:
isAvailablein interfacePageExtension- 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:PageExtensionThis 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:
fillModelin interfacePageExtension- Parameters:
model- model to modifyrequest- 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
-
addCssFile
@NotNull public SimplePageExtension addCssFile(@NotNull 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 usePluginDescriptor.getPluginResourcesPath(String)to obtain it- Returns:
- self
-
addJsFile
@NotNull public SimplePageExtension addJsFile(@NotNull 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 usePluginDescriptor.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)
-
-