Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement v2 TPS ActivityService without vlv #4770

Merged
merged 4 commits into from
Jun 7, 2024

Conversation

fmarco76
Copy link
Member

@fmarco76 fmarco76 commented Jun 6, 2024

To implement the service the base servlet already implemented for the CA has been modified together with other small changes in the LDAP classes.

@fmarco76 fmarco76 changed the title Implement v2 TPM ActivityService without vlv Implement v2 TPS ActivityService without vlv Jun 6, 2024
@fmarco76 fmarco76 requested a review from edewata June 6, 2024 11:17
Sorkey array control generation get error when it is null.

ActivityServlet reports wrong message when resource is not found
Copy link

sonarcloud bot commented Jun 6, 2024

Copy link
Contributor

@edewata edewata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some minor comments but the code seems to be consistent with the original one. Feel free to update/merge.

@@ -60,29 +58,37 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
PrintWriter out = response.getWriter();
out.print(re.getData().toJSON());
} catch(Exception ex) {
logger.error("CAServlet: error setting error response {}", ex.getMessage());
logger.error(ERROR_RESPONSE, ex.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest that we attach the exception object as well so we can see the stack trace to help troublehooting. Same thing for the other logging statements below.

Comment on lines 116 to 122
String activityID = activityRecord.getId();
try {
URLEncoder.encode(activityID, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new PKIException(e.getMessage());
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this. The activity ID had to be encoded to generate a valid URL in REST response but we don't have that anymore.

Comment on lines +39 to +40
ServletContext servletContext = getServletContext();
TPSEngine engine = (TPSEngine) servletContext.getAttribute("engine");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also call getTPSEngine().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it was using getTPSEngine() in the original service but in the CA it is retrieved from the context. I decide to have the same approach in all cases. If there is a reason we can switch to retrieve the engine using the static method. For the moment I am leaving as it is.

Additionally, remove the url encoder test for the TPS activity id
@fmarco76
Copy link
Member Author

fmarco76 commented Jun 7, 2024

@edewata Thanks!
I have just updated following the comments. There is a problem with CMake build but I will fix in future PR where I plan to move some classes.

@fmarco76 fmarco76 merged commit c444512 into dogtagpki:master Jun 7, 2024
145 of 151 checks passed
@fmarco76 fmarco76 deleted the ActivityServiceFreeVLV branch June 7, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants