sling

How can I find out what is causing a certain URL to be resolved to a synthetic resources?

浪尽此生 提交于 2019-12-24 07:07:08
问题 On my Adobe CQ 5 (CQ 5.6) installation, for some reason, there's a URL ( http://localhost:4503/services ) that is getting resolved to a synthetic resource: This is causing CQ to show the following page, rather than a 404 Page Not Found page: What is causing this behavior? 回答1: You get Forbidden error not because of the strange type of the /services , but because you didn't add any extension (you'll get the same result requesting /content/geometrixx ). Let's try to add some extension: .html

org.apache.sling.api.resource,version=[2.3,3) — Cannot be resolved

风格不统一 提交于 2019-12-24 03:07:15
问题 Hi I am not able to access content of my project, I have uploaded all the packages which are required to access content from CQ. Only thing I can see is org.apache.sling.api.resource,version=[2.3,3) -- Cannot be resolved Can this be the reason for exception and if yes please let me know how to resolve it. CQ version 5.6 回答1: The error message means that the OSGi framework is unable to supply a version >= 2.3 and < 3 of the org.apache.sling.api.resource Java package for a bundle B that wants

What is the lifecycle of a jsp PageContext object - is it threadsafe?

狂风中的少年 提交于 2019-12-23 12:23:14
问题 Are jsp PageContext objects created and destroyed as part of the http request-response cycle or are they cached and reused between requests. PageContext has life-cycle methods that suggest reuse between requests. ie initialize(), release(). If they are reused this could pose serious concurrency problems: if two http requests arrive, requesting the same jsp page, and each request is processed by its own thread, but sets attributes on a shared PageContext object, they will render each others'

Sling model unit tests: mock currentPage in SlingHttpServletRequest

冷暖自知 提交于 2019-12-23 03:57:12
问题 I am having some trouble testing a Sling model: the currentPage is not getting injected for some reason. My Sling model looks like this: @Model( adaptables = { SlingHttpServletRequest.class, Resource.class }, resourceType = MyModel.RESOURCE_TYPE) public class MyModel { public static final String RESOURCE_TYPE = "myproject/components/renderer"; @Inject private Page currentPage; // Model methods, etc. } I writing some JUnit tests for it, like so: @RunWith(MockitoJUnitRunner.class) public class

How can I create an instance of WCMUsePojo in a servlet for a specific page?

我与影子孤独终老i 提交于 2019-12-23 03:26:20
问题 I am trying to create an instance of WCMUsePojo in a servlet. The implementing class is already used in sightly templates. I have tried code below and could not get it to work. Any ideas? Thanks. @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException { try { Resource resource = request.getResource().getResourceResolver().getResource ("/content/mynewsite/homepage"); WCMUsePojo template = resource.adaptTo(BaseTemplate.class);

Including a JSP into a sling servlet

天大地大妈咪最大 提交于 2019-12-21 20:54:15
问题 I'm currently working on a small project, trying to help someone figure out how to wire up a component. Ideally we'd like to do 2 things: have a jsp that renders the template have all our business login in a SlingAllMethodServlet Gist of servlet definition: package definition... import statements... @SuppressWarnings("serial") @SlingServlet( resourceTypes="path/to/my/component", methods="GET", extentions="HTML") @Properties({ @Property(name="service.pid", value="<my service class>",

CQ5 - Dynamically populating options in selection xtype

风流意气都作罢 提交于 2019-12-21 05:35:16
问题 I've been banging my head for hours on this now. I'm trying to dynamically populate options in a selection xtype and can't get it to work. Here is my dialog.xml <resourceType jcr:primaryType="cq:Panel" title="Header Type"> <items jcr:primaryType="cq:WidgetCollection"> <headerType jcr:primaryType="cq:Widget" fieldLabel="Header Type" name="./headerType" type="select" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <categories jcr:primaryType="cq:Widget" path="/content/admin

CQ5 QueryBuilder Reference in Sling Servlet

强颜欢笑 提交于 2019-12-20 07:29:08
问题 I am declaring a sling servlet like so @Component(metatype = false) @Service(Servlet.class) @Properties({ @Property(name = "sling.servlet.paths", value = "/bin/foo/bar"), @Property(name = "sling.servlet.methods", value = "POST") }) public class FooBarServlet extends SlingAllMethodsServlet { ... } I override doPost like so @Override protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException { ... } And I am able to post from a client. Great! I

What am I missing for this CQ5/AEM URL rewriting scenario?

北城余情 提交于 2019-12-20 04:41:09
问题 I basically want short URLs to get resolved and HTML pages to be generated with short URLs for a CQ5 website. So far short URLs are getting mapped to long URLs as expected, but links in the generated HTML pages are not getting shortened. For example, I am expecting the src attribute of the following <script> tag: <script type="text/javascript" src="/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/style/clientlibs.1395978029951.js"></script> To be shortened to: <script type="text

Should I close the session before closing the resource resolver

拥有回忆 提交于 2019-12-20 02:59:20
问题 I have simple service, lets use resourceResolver and session for some logic: @Component(immediate = true) @Service(value = ServiceInterface.class) public class ServiceInterfaceImpl implements ServiceInterface { //Some fields @Reference private ResourceResolverFactory resolverFactory; private void someMethod() { ResourceResolver resourceResolver = null; try { resourceResolver = resolverFactory.getServiceResourceResolver(null); Session session = resourceResolver.adaptTo(Session.class)