AEM Tutorial #37 | Servlet #2 | Resource Type Sling Servlet in aem

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024
  • This tutorial explain about Resource Type sling servlet in aem. How to write resource type servlet using OSGi R7 annotations. I explain, how to use get and post methods in resource type servlet. How to use resource type servlet to submit form data. How to add methods, selectors and extensions to resource type servlet.
    Demo code repo : github.com/aem...

Комментарии • 53

  • @saurabhsingh1255
    @saurabhsingh1255 3 года назад +2

    your videos are so helpful. Thank you so much. please continue do so. it will help us a lot.

    • @AEMGeeks
      @AEMGeeks  3 года назад

      Thanks! saurabh singh

  • @utkarshsingh7829
    @utkarshsingh7829 2 года назад

    Best tutorial video you can find on sling servlets.

    • @AEMGeeks
      @AEMGeeks  2 года назад +1

      Thanks 🙏 utkarsh singh. Keep learning...

  • @vigneshsekar8313
    @vigneshsekar8313 3 года назад

    Awesome.... I like your clear explanation on each topics... keep going..

    • @AEMGeeks
      @AEMGeeks  3 года назад

      Thanks Vignesh Sekar

  • @amangyawali3303
    @amangyawali3303 6 месяцев назад

    How did you pass those parameters from the UI form to the backend doPost method in the servlet?

    • @AEMGeeks
      @AEMGeeks  5 месяцев назад

      SlingHttpServletRequest contains all form data in Post method. You could required data from this object. I explained this in many explained. Explore servlet related tutorials.

  • @ShivKumar-jz4pm
    @ShivKumar-jz4pm Год назад

    in my aem component there are extra fields dialog box in the component which i override from core components how should i remove those fields from my dialog box

  • @maheshsah2982
    @maheshsah2982 3 года назад +1

    Please show us servlet with ajax call. Also few tutorials on experience fragments n content fragments would be great.

    • @AEMGeeks
      @AEMGeeks  3 года назад +1

      Sure Mahesh Sah.

  • @user-xy1db2om5q
    @user-xy1db2om5q 10 месяцев назад

    how i can view log like your screen at 16:37

  • @KeerthiK-rh7yx
    @KeerthiK-rh7yx Год назад

    why do we need selectors and extensions ?

  • @veenah3687
    @veenah3687 3 года назад

    Hi AemGeeks i tried to create the servlet with code at 5:25 in this video
    I am getting below compilation error
    package org.apache.sling.servlets.annotations does not exist
    canot find symbol symbol: class SlingServletResourceTypes
    i tried to add jar with quick fix but unable to resolve. Can you Please suggest?

    • @AEMGeeks
      @AEMGeeks  3 года назад

      You don't need any additional jar. You might using wrong annotation import. Please check if you are using correct import to use r7 annotation. Please check demo code available in git.

  • @bishnusatpathy6722
    @bishnusatpathy6722 2 года назад

    Hi . Not able to read my request payload from json body of my postman for a post method. Can u please help.

    • @AEMGeeks
      @AEMGeeks  2 года назад

      I did not understand your question completely. If you want to read json in service, you can use any api. Object Mapper you can use. Give me your exact problem statement, will try to answer.

  • @vamsikrishnag2807
    @vamsikrishnag2807 3 года назад

    I understand the process. I want send json file data to jcr by using post method, like upload any extension files at jcr. It means invoking aem author instance data. Can you please help me on this.

    • @AEMGeeks
      @AEMGeeks  3 года назад

      I did not understand your question completely, What I understood is, You want to upload a file and want save data of that file into jcr(file/node).
      You can follow below solution, if your requirement is as above.
      1. Create form with file field. Form I have already explained.
      2. Read file in your code. This is plan java code. You can get from google/internet.
      3. Now create a node of nt:file type where you want to store this file/data.
      4. Add mixin to this node using addMixin method. add value 'mix:referenceable' .
      5. Now add child node to this file node.
      6. Add MIME type(node property) to node you created in step 5 to json. lets say you have json data.
      7. Add data(node property) using jcr:data and value of this property should be, the data you read from original file.

  • @ashekhar2001
    @ashekhar2001 2 года назад

    Hi, I don't see the Registration component and content pages in Git Repo. Please could you commit the code

    • @AEMGeeks
      @AEMGeeks  Год назад

      I guess, I have lost that code. Please try to rewrite.

  • @TheMichaelvino
    @TheMichaelvino 3 года назад

    Thanks for the video. I have one question Using R5 Annotation I can Register the same servlet using Path as well as Resource Type. Is that possible in R7. since we are using different annotations here

    • @AEMGeeks
      @AEMGeeks  3 года назад +1

      Yes you can!, Use both annotations in same servlet. I have explained this somewhere in next tutorials.

    • @TheMichaelvino
      @TheMichaelvino 3 года назад

      @@AEMGeeks Thank you for the quick response. i can take a look.

  • @sanjanagoswami941
    @sanjanagoswami941 2 года назад

    Also I'm unable to submit the values in "View as Published Mode"

    • @AEMGeeks
      @AEMGeeks  2 года назад

      Check for error in your error logs

  • @gandhamindraja7035
    @gandhamindraja7035 2 года назад

    Your tutorial s awesome ...can you please tell me use cases when we go for resourceTypes and when for paths

    • @AEMGeeks
      @AEMGeeks  2 года назад +1

      resourceTypes define for what resource this servlet will trigger.
      Paths define for which path this servlet will trigger.
      Please follow next tutorials, I did explain in detail.

    • @gandhamindraja7035
      @gandhamindraja7035 2 года назад

      @@AEMGeeks thank u so much

  • @gayathrimalagondla8291
    @gayathrimalagondla8291 3 года назад

    I really like your videos. Very informative and understandable. I have a small question. Request parameter is POJO class name right?

    • @AEMGeeks
      @AEMGeeks  3 года назад +1

      Thanks, Gayathri Malagondli, It is API provided call. Yes it is POJO like class. But I never check code.

    • @gayathrimalagondla8291
      @gayathrimalagondla8291 3 года назад

      I have one more question. After double-clicking the jar file to start the instance, it stuck at somepoint since so long. How can i fix it?

    • @AEMGeeks
      @AEMGeeks  3 года назад +1

      Not sure, We have to see logs to find issue. Ideally you should not start by double click. You can find issue when you need proper run mode. AEM will not start with required run mode. You have to update your quickstart file to add proper information. Please see this tutorial about how to install and set run modes.
      ruclips.net/video/uLrSMMPDi8M/видео.html

  • @sudarshanv7029
    @sudarshanv7029 2 года назад

    I'm getting null values in servlet request parameters, if I submit form. But I can read response at path specified.. can you help here sir

    • @AEMGeeks
      @AEMGeeks  2 года назад

      What is error you are getting in logs. Is it CSRF token missing. check for this error. If you found this error, means CSFR token is not generating. You suppose to use a clientlib used to generate token.
      Just check your logs

  • @bmanikanta5
    @bmanikanta5 Год назад

    Can you please rewrite and committee the code for this tutorial

    • @AEMGeeks
      @AEMGeeks  Год назад

      Code is already present in git

  • @shaliniraghuvanshi7282
    @shaliniraghuvanshi7282 3 года назад

    How we call resource type servlet using AJAX call?

    • @AEMGeeks
      @AEMGeeks  3 года назад

      As normal ajax call. you try in two ways.
      1. AJAX call to servlet within AEM.
      2. AJAX call to servlet from outside AEM.
      3. Try both resourcetype and path type. You will understand many concepts. One concept, you will learn which is the favorite interview question 'Difference between resourcetype and path type servlet'
      try once, You can get AJAX syntax from internet. this is not AEM specific.

    • @shaliniraghuvanshi7282
      @shaliniraghuvanshi7282 3 года назад

      @@AEMGeeks sorry bt u didn't understand my question. My question what will be value of Url field of ajax function, if we define the servlet using resource type

    • @AEMGeeks
      @AEMGeeks  3 года назад +1

      @@shaliniraghuvanshi7282 if you are calling from AEM than relative path is enough. If you are calling form outside AEM than complete path(including server ex. localhost:4502). Don't worry, I will give sample code.

  • @sashakabaldin7755
    @sashakabaldin7755 2 года назад

    Hi, can you turn on auto subtitles? Video so helpful, thanks)

    • @AEMGeeks
      @AEMGeeks  2 года назад +1

      I will enable.

  • @sanjanagoswami941
    @sanjanagoswami941 2 года назад

    Can you please post the registration.html file link?

    • @AEMGeeks
      @AEMGeeks  2 года назад

      I have doubt if I have this file. This file was create only for this tutorial. Let me see if I can find or rewrite this.