com.polarion.example.administration using servlet class

Description
jcordeiro
Posts: 3
Joined: Tue Mar 27, 2018 3:34 pm

com.polarion.example.administration using servlet class

Postby jcordeiro » Wed Mar 28, 2018 10:18 am

Good gay to you all.

I have been looking at the com.polarion.example.administration example. And i found that the class AdministrationServlet is never called on the example. Mainly because hivemodule.xml calls administration.jsp directly instead of registering AdministrationServlet as a contribution:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<module id="com.polarion.ImprovedGitConnector" version="1.0.0">
   <contribution configuration-id="com.polarion.xray.webui.administrationPageExtenders">
      <extender name="Page" parentNodeName="ImprovedGitConnector" parentNodeIconUrl="/polarion/icons/default/topicIcons/Tools_157-wrench.png" iconUrl="/polarion/icons/default/topicIconsSmall/Tools_158-wrench-2.png" pageUrl="/polarion/ImprovedGitConnector/administration.jsp?scope=$scope$" projectScope="true" projectGroupScope="true" repositoryScope="true"/>
   </contribution>
</module>


Note the:

Code: Select all

pageUrl="/polarion/ImprovedGitConnector/administration.jsp?scope=$scope$"


Does any one know how do i register AdministrationServlet as a start point of that module on the com.polarion.xray.webui.administrationPageExtenders using hivemodule.xml?
If not, can any one tell me how do i get the user role on the jsp to make sure that user is a admin and can edit my configuration?

ALMighty
Posts: 71
Joined: Wed Apr 27, 2016 10:34 am
Location: Austria

Re: com.polarion.example.administration using servlet class

Postby ALMighty » Wed Mar 28, 2018 2:26 pm

jcordeiro wrote:If not, can any one tell me how do i get the user role on the jsp to make sure that user is a admin and can edit my configuration?


Have a look on my answer in the thread "Re: After login the polarion , i want to get the list of projects available for the user logged in."

It shows the example of a Java App using the SOAP API but probably it helps too. I am not so familiar with creating Servlets but I think when creating Servlets you use differnt libraries an classes (the ones with "I" at the beginning like the ones used in Wikipages) as far as I can tell based on this post.

Therefore you need the Servlet/Wikipage equivalents to the ProjectWebService, the Project and the User class, here they are:
IProjectService: https://almdemo.polarion.com/polarion/s ... rvice.html
IProject: https://almdemo.polarion.com/polarion/s ... oject.html
IUser: https://almdemo.polarion.com/polarion/s ... IUser.html

Furthermore, you could have a look on the checkPermission method of the ISecurityService class, maybe this one solves your problem in a shorter time. :wink:
---------------------------------------------------------------------------------------------------
Playing a good game is never lame. :D
Image

jcordeiro
Posts: 3
Joined: Tue Mar 27, 2018 3:34 pm

Re: com.polarion.example.administration using servlet class

Postby jcordeiro » Mon Apr 02, 2018 2:18 pm

The problem i have is that i cant pass the environment classes that i have to the jsp runtime.
Sure i can instantiate new classes. but i cant connect them to polarion and use polarion services.

For example:

Code: Select all

IProjectService projectService = (IProjectService) PlatformContext.getPlatform().lookupService(IProjectService.class);

This does not work because the JSP runtime does not have any PlatformContext instantiated class.

So my question is how do i get IProjectService(and others) to work inside the JSP on com.polarion.example.administration.


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 2 guests