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
Jan 30, 2018 3:59 AM UTC
Solved

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

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.
rmahendra
rmahendraAccepted solution
Employee
Jan 30, 2018 5:38 AM UTC

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

Does that work for you?

3 replies

jayv25585659
Level 8
Jan 31, 2018 11:39 PM UTC

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

Translate
rmahendra
rmahendraAccepted solution
Employee
Jan 30, 2018 5:38 AM UTC

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

Does that work for you?

Translate
edubey
Level 10
Jan 30, 2018 4:18 AM UTC

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.

Translate