Own ResourceHandler to stream images from DB

前端 未结 1 977
-上瘾入骨i
-上瘾入骨i 2020-12-15 11:53

I\'m strugging with my own resource-implementation. The getInputStream-method doesn\'t get called.

My handler:

public class R         


        
相关标签:
1条回答
  • 2020-12-15 12:38

    found the mistake .The getRequestPath of my rescource implementation was faulty. I forgot the faces-mapping (Util.getFacesMapping(context)) to the faces-servlet in the url:

    @Override
        public String getRequestPath() {
            final FacesContext context = FacesContext.getCurrentInstance();
            return context
                    .getApplication()
                    .getViewHandler()
                    .getResourceURL(
                            context,
                            ResourceHandler.RESOURCE_IDENTIFIER + "/" + mediaId + Util.getFacesMapping(context)
                                    + "?ln=" + AppConstants.RESOURCE_MEDIA_LIB);
    

    Everything works now as expected.

    Thanks to BalusC for his help.

    Cheers
    Jonny

    0 讨论(0)
提交回复
热议问题