Download content from an external source

What is the best approach to download content from an external source? Only approach what I could come up with is to load this data into the component and then update the hippo bean (see the example below). But is there a better way? Is there any “hippo bean mail processor” or “external source provider”?



    public class MyComponent extends BaseHstComponent {
        @Overrideenter code here
        public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {
            SalesDocument doc = (SalesDocument)request.getRequestContext().getContentBean();

            ExternalData externalData = externalDataSource.getExternalData(doc.getId());
            doc.setValue(externalData.getValue());

            if (doc == null) {
                response.setStatus(404);
                return;
            }

            request.setAttribute("document",doc);
        }

    }


+4
source share
1 answer

There is currently no HippoBean mail processor or external source. I think in your case you want to get some of the data from a remote system, and you want to combine these two types of data so that you can use them as one element in your template.

, , , . JSP/Freemarker , .

, , .

+2

Source: https://habr.com/ru/post/1546510/


All Articles