0

I would like to know if there is a way to access http request parameters like (RemoteHost,LocalPort,...etc) or FacesContext in business layer for example (ejb or interceptor) but for distributed system .

so the scenario is I have an interceptor that works when jsf talk to controller (managedBean) then to ejb method , inside Interceptor when I tried to get

FacesContext.getCurrentInstance() 

for distributed system I got null .

Thanks

randa.as
  • 3
  • 2

1 Answers1

1

You're in the service layer not supposed to be interested in view layer specific APIs. It violates the Law of Demeter and makes the service layer unreusable on other view layers (e.g. JAX-RS, Servlets/JSP, etc).

Instead, let the view pass the information of interest as plain method arguments.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thank you for your answer , but even at client side using InitialContext I couldn pass contextual data and use it in Interceptor InvocationContext.getContextData() ? I dont want to go over all system and send parameters that I need in interceptor when calling ejb method . – randa.as Aug 07 '16 at 20:07