Results 1 to 14 of 14
  1. #1
    erm_term is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Question How to quickly find "Entry Points" to Java, from webapp URLs

    Preface:

    This might seem at first glance like a question for the beginner forum, but I assure you I am beyond the scope of basic Java, but may have skipped some steps to get here. I am interested in learning how to be a better, and faster developer, and this is something that is tripping me up.

    I am working (professionally) on a large application that uses a large technology stack, ultimately resulting in a web-based system. It can be frustratingly time consuming to figure out where a URL maps to... what class? servlet? jsp? etc.

    On to the question:

    Given a URL such as "http://localhost/path1/path2/path3?param1=ASDF&param2=ASDF2&param3=ASDF3"

    Where do you start your search to find the code that runs on this page? For example, if the URL looked like this

    "http://localhost/path1/execute/path3?param1=ASDF&param2=ASDF2&param3=ASDF3"

    You would probably look for a struts-config.xml file in the path1 project, right? But if the URL doesn't include an execute path, it must be handled by some other request handler? How can you efficiently find this "entry point".


    To Provide Some Perspective:

    In a scripting language such as php, "http://localhost/path1/path2/path3.php?param1=ASDF&param2=ASDF2&param3=ASDF3",

    this is easy to trace. within the website root, /path1/path2/path3.php is your "entry point" to the code that runs at that request. I would like to gain a solid understanding of how to quickly trace entry points in Java, so I can reduce this major blocker in my development time. Any help / resources would be GREATLY appreciated.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Is this a "how does my server work" question?
    I don't see how it relates to java programming.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Agree with Norm. Thread moved from Advanced Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    It all depends on what the OP is actually asking.
    If it's a Struts-specific question then it possibly ought to be in the Struts forum.

    Once the OP answers that then we can probably shift it into the correct place.

    Essentially (for erm_term) it all depends on what framework(s) you have written your webapp against.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Quote Originally Posted by Tolls View Post
    It all depends on what the OP is actually asking.
    And until that is known, the lobby is an appropriate place for the thread to sit and wait.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    erm_term is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    It is not simply a question of how does my server work. It is a more broad question about how to be quick/efficient at tracing a request within a large-scale Java application.

    True, some discussion of server processing is probably warranted in the response. Likewise, some discussion of struts is also probably pertinent here. We happen to use Spring as well. It can certainly be less than obvious at times where the request is being mapped to. In other words, where it "ends up" after all the filters and frameworks have done their thing.

    To provide some context that may be help others understand where this question is coming from:

    Imagine you have a URL request such as the following: "http://localhost/path1/path2/path3?param1=ASDF&param2=ASDF2&param3=ASDF3"

    What are the steps you take to quickly find the "landing point" of this request within your application? For example, if the request URL looked as follows:

    "http://localhost/path1/path2/execute/path3"

    You would quickly recognize that the struts framework is handling this request, within the /path1/path2 project. You would find your way to the struts-config.xml file for this project, and take a look at the action-mapping for path3. Wallah, you have your "entry point" into your application.

    What if you don't recognize any part of the URL as a project, or a framework?! What are your steps for quickly tracing the request? Where do you begin?

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    don't recognize any part of the URL as a project, or a framework
    The server must be able to parse the URL, how does it do it?
    If you don't understand my response, don't ignore it, ask a question.

  8. #8
    erm_term is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    One way, for example, would be to pass all requests through a custom filter (which might modify the request based on certain criteria).

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Is that on the server or client?
    If you don't understand my response, don't ignore it, ask a question.

  10. #10
    erm_term is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    I am referring to servlet filters.

    "The Java Servlet specification version 2.3 introduces a new component type, called a filter. A filter dynamically intercepts requests and responses to transform or use the information contained in the requests or responses. Filters typically do not themselves create responses, but instead provide universal functions that can be "attached" to any type of servlet or JSP page."

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Quote Originally Posted by erm_term View Post
    One way, for example, would be to pass all requests through a custom filter (which might modify the request based on certain criteria).
    Anything up to getting to your app is entirely server dependent, and so not a Java question.
    On Tomcat (for example) your entry point is the app in the webapps folder, usually defined in the web.xml.
    So, skipping that part, you now know the application...and anything else under that is entirely framework dependent. A "raw" servlet based app will be a case of looking in the web.xml. One involving struts or spring will be in one of their (often many) xml files.

    So, as I said earlier, it's all down to the framework.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Quote Originally Posted by erm_term View Post
    I am referring to servlet filters.

    "The Java Servlet specification version 2.3 introduces a new component type, called a filter. A filter dynamically intercepts requests and responses to transform or use the information contained in the requests or responses. Filters typically do not themselves create responses, but instead provide universal functions that can be "attached" to any type of servlet or JSP page."
    Filters are implemented in a stack somewhere in the web.xml. They define what gets run (if anything) prior to arriving at the servlet identified by the url. Other frameworks have their own filter stacks as well. Except in the case of a filter erroring they should not redirect the url. So they really don't have anything to do with your initial question.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  13. #13
    erm_term is offline Member
    Join Date
    Aug 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Tolls, thank you for the responses. Both were helpful, and were mostly what I was looking for. However, in the case of my scenario in which the URL does not clearly map to a webapp and does not make use of a framework, then surely a filter defined in web.xml for tomcat must be intercepting the request on "/*" and changing it?


    edit: for the record, I can see how this is less a Java question... more a server/frameworks question.

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default Re: How to quickly find "Entry Points" to Java, from webapp URLs

    Then I would ask whoever set up your system.
    Tomcat does not do that by default.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 11
    Last Post: 08-18-2011, 10:54 PM
  2. Replies: 2
    Last Post: 07-25-2011, 07:22 AM
  3. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  4. Need help with "a simple order entry program"
    By sentica in forum New To Java
    Replies: 6
    Last Post: 10-17-2008, 05:38 AM
  5. ZipOutputStream "duplicate entry"
    By new_2_java in forum New To Java
    Replies: 0
    Last Post: 02-14-2008, 04:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •