Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 7

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!

1 Accepted Solution

Avatar

Correct answer by
Employee

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

Does that work for you?

View solution in original post

3 Replies

Avatar

Level 10

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.

Avatar

Correct answer by
Employee

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

Does that work for you?

Avatar

Level 7

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