Best practice for @java method

We are migrating pega 7.3 applications to pega cloud infinity 23.

Then found that @java expressions used in the applications that are not supported on infinity 23.

Would you please help to tell me the best practice to re-write the @java expressions of the 2 pattern below?

Pattern 1: @java(“((javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject("pxHTTPServletRequest")).getParameter("uid")”)

Pattern 2:@java(“PRAuthentication.DEFAULT_FAIL_STREAM”)

The @java expressions are used as value of Set-property in activities.

Hi @chend1: Is there a limitation to move these as a function (or) java step?

Thanks.

@chend1 Instead of using the property-set method, you can try using the “Java” method and place your java code their. This would however have an effect on the guardrail. Another approach would be to use a java function and call the function in your activity.

@ArulDevan thank you for your opinion.
there is no limitation to use function or java.
I think create function would be good.

Best regards.

@kammv Thank you for your idea.
As your explanation, I think create function would be proper.