[MGNLIMG-176] Depends too much on WebContext Created: 20/Nov/15 Updated: 07/Dec/22 |
|
| Status: | Open |
| Project: | Imaging |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Michiel Meeuwissen | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Template: |
|
||||
| Acceptance criteria: |
Empty
|
||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||
| Date of First Response: | |||||
| Description |
|
I'm trying to determin the URL of images outside of the context of a request. To be exact, we index our pages to elastic search. This will often not happen directly triggered by a request, e.g. because it is running in the background. Much availabe code which exist to find out heavly depends on a WebContext being available. ImagingSupport#createLink will e.g. inevitably call MgnlContext.getContextPath() which will only give an exeption. Besides it will in principle also give the wrong answer, because this code is running on the author mode, and it will of course need to create links to images on the public node, which might have a different contextPath. Actually all code to determin 'public urls' is getting cumbersome, not only in imaging, so perhaps I'm missing something. |
| Comments |
| Comment by Michiel Meeuwissen [ 23/Nov/15 ] |
|
Even things like Asset#getFileName seem to need an actual http request: 1) Error in custom provider, com.google.inject.OutOfScopeException: Cannot access scoped object. MgnlContext does not have a HttpServletRequest set, this is most likely because we are not currently processing a HTTP request. at info.magnolia.objectfactory.guice.GuiceContextAndScopesConfigurer.configure(GuiceContextAndScopesConfigurer.java:72) while locating info.magnolia.cms.core.AggregationState 1 error at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987) at info.magnolia.module.site.provider.SiteProvider.get(SiteProvider.java:64) at info.magnolia.module.site.i18n.SiteI18nContentSupport.getI18nContentSupport(SiteI18nContentSupport.java:69) at info.magnolia.module.site.i18n.SiteI18nContentSupport.hasProperty(SiteI18nContentSupport.java:129) at info.magnolia.module.site.i18n.SiteI18nContentSupport$$EnhancerByCGLIB$$d3b90b8e.hasProperty(<generated>) at info.magnolia.jcr.wrapper.I18nNodeWrapper.hasProperty(I18nNodeWrapper.java:60) at info.magnolia.jcr.wrapper.DelegateNodeWrapper.hasProperty(DelegateNodeWrapper.java:297) at info.magnolia.jcr.util.PropertyUtil.getString(PropertyUtil.java:379) at info.magnolia.dam.jcr.JcrAsset.getFileName(JcrAsset.java:156) |
| Comment by Michiel Meeuwissen [ 30/Mar/17 ] |
|
Nu reaction for over a year. I may have to update this to a support-issue? |
| Comment by Thomas Duffey [ 20/Sep/17 ] |
|
We have issues here as well when, e.g., generating links to images within a scheduled task (Runs w/SystemContext), within a custom syndicator, etc. |
| Comment by Jordie Diepeveen [ 22/Jan/19 ] |
|
Same issues here. No easy way to get imageLinks when indexing pages/items using a command because no WebContext is available. |