Is it posible to access the HTTP request object from inside a helper class? If yes, how? | Community
Skip to main content
jayv25585659
Level 8
January 30, 2018
Solved

Is it posible to access the HTTP request object from inside a helper class? If yes, how?

  • January 30, 2018
  • 3 replies
  • 1986 views

so I have a custom class located in /bluegrass/core/src/main/java/com/bluegrass/core/imp/view/components/MyCustomerHelper.java

I'm wondering if it's possible to access the HTTP request object from this section? If yes, how?

Here's a snippet of the class declaration.

public class CourseListHelper extends BaseWCMPojo {

  public void activate() throws Exception {

    //more code here

  }

}

I understand it can be done via servlet but I have the impression that to access the servlet, I need to access it via HTTP (like an AJAX request).

I'm wondering if a servlet can  be access like this:

<sly data-sly-use.grasses="com.bluegrass.core.impl.view.components.MyCustomHelper">

Thanks a lot!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by rmahendra

You can get the request in the Pojo using WCMUsePojo ("The CQ5 Quickstart and Web Application.")

Does that work for you?

3 replies

edubey
Level 10
January 30, 2018

No , With Ajax you will send request to an endpoint(like exposed path from servlet) not to a class.

Share your use case, community may suggest something better to achieve it.

rmahendra
Adobe Employee
rmahendraAdobe EmployeeAccepted solution
Adobe Employee
January 30, 2018

You can get the request in the Pojo using WCMUsePojo ("The CQ5 Quickstart and Web Application.")

Does that work for you?

jayv25585659
Level 8
January 31, 2018

thank you so much. I can see the request on my helper class if I extend this class!