Tool to reverse map JSP to URL? - eclipse

Is there a tool to automate the task of finding out where a given JSP is used, by URL?
Ultimately, the question I need to answer is, What URL(s) do I need to call, to see the output of this JSP in my browser?
Finding out involves searching for the JSP name, then searching for any JSPs that include it (possibly through several levels), ending up with one or more servlets - then trawling through web.xml to get the mapping of URL to servlet.
Having spent this morning doing exactly that, looking for examples of deprecated tags in our project, it seems to me that a computer would be quicker, if not better, at this than I am. For my purposes, I can live with not getting every URL; I really need to see only one use of the file in question.
So, is there a tool to do this? My IDE is Eclipse, so if Eclipse or some plug-in can do this that would be my preferred option. The application is running on Tomcat 6.
Thanks,

Check the contents of web.xml; it contains this mapping.
[EDIT] If you want to remove a JSP, here is what you need to do:
Check for an entry in web.xml
Search for <jsp:include and <%#include in all *.jsp files
That's all the places where your JSP can be used. You don't have to check for redirects and such since for a redirect to work, the JSP must be listed in web.xml.

Why do you require any eclipse plugin?
How about a simple text search in eclipse, where you can do a file search, that is search a text in all required file patterns - as below
(source: dopefly.com)

Related

Attaching javadoc to libraries

as an example, I'd like to attach the javadoc to org.eclipse.swt
As I've read in similar threads, I went to the build path, expanded the swt library node and tried to enter the url as the javadoc location:
http://help.eclipse.org/indigo/advanced/content.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/index.html
Trying to validate it however tells me that typical root files like package-list or index.html couldn't be found. Obviously pretty weird since the url ends with index.html. Am I doing something wrong?
You can only specify the URL for the javadocs if it has a package-list file. Otherwise you will have to use downloaded javadocs/src for the jar. Then you can do specify the location for those javadocs archives in the same window you tried. You can attached sources if you want to see the source instead of decompiled library classes.
Similar post
Do not include the index.html part at the end. You want a URL to which you can append "package-list" and actually get the right content.

browse file path spring webflow

I am currently working on a spring webflow application. In this project there are certain entities that point to a document that contains more information about that entity. However sometimes this document is not provided. In that case the user must be able to research the file for himself.
I need a simple way to let the user search a file and then save the filepath of the selected file into the database.
For most of our components we use richfaces but I don't really like the richfaces <fileUpload> because it's too big and too complex. I have seen that icefaces and tomahawk provide nice solutions but our application is limited to richfaces.
I thought of just using the normal:
<form:form> <input type="file> </form:form>"
but I don't know how I can get the information from that submitted form into my bean. I hoped that I could trigger an event once the file had been selected and then use a listener in my bean that would read the filename from the event. However I cannot find the syntax to do this (I don't even know if this is possible).
Can anyone help me? I know I can just do it with richfaces but I don't think that the client would like that enormous form to just select a filepath
why don't you use a simple jsp file upload?
http://www.tutorialspoint.com/jsp/jsp_file_uploading.htm

Tomcat java servlet redirecting to wrong URL

I have a login servlet that is supposed to send a redirect to a specified url but instead I seem to be getting sent to an older version. I am using Tomcat 7 in eclipse and thinking it must be somewhere in the meta data that is screwie.
response.sendRedirect("../xyz/home.jsp");
but instead of going to xyz/home.jsp I am going to xyz1/home.jsp.
I had an old project called xyz1 which I then did a refracter to change the name to xyz. Now it seems that the login servlet keeps referring to xyz1/home.jsp. My other links are fine since I am using href and relative paths. I did a search through the meta-data to see if there was any older references to xyz1 and there were so I changed them and I also did a search in the server configuration files which I had also fixed. Not sure what other options there are.
Thanks,
-Tommy
Also the debugger is kind of useless since it goes through .class files that cant be read ...
I renamed xyz to be xyz1 and then just made a blank project called xyz. Only moved my source files and let the metadata fill in itself. I also made a new server just to be safe.

Eclipse Indigo JSP validator not fully supporting JSP based tags in a jar file

If I package my JSP based tag in a jar file Indigo seems to correctly pick up and validate the URI and tag name.
However it doesn't seem to properly recognize any attributes on the tag. The parser gives me a warning and indicates "undefined attribute name".
However if I take the exact same tag and place it inside the same project (in a differently named tag dir) it is properly parsed by the validator -- indicating that the attribute is required.
In both cases the tags deploy and run properly in the container.
Obviously, this works, but the validator support is a nice feature of WTP that I'd hate to lose for a reusable taglib.
I don't think you can add any extra metadata into the TLD file for a JSP based tag.
Any suggestions?
I suppose as a last resort I could write these in Java.
Sounds like it's possibly http://bugs.eclipse.org/353629 . Does SR1 help?

Counting eclipse plugin installations/downloads

I'm currently hosting an Eclipse plugin update site on sourceforge.net . SF.net does not allow access to server logs but I'd still like to know how many downloads the plugin gets.
Is there an alternative way of gathering them?
I'm not going to have any sort of 'call home' feature in the plugin, so please don't suggest that.
I wrote a blog about how to track downloads of an Eclipse plug-in update site. What you can do is specify a url to your server and every time a download is initiated the update site will send an HTTP HEAD request to that url, which you can then use to count the number of times the plug-in was downloaded. If you want to track some information about who is downloading the plug-in you can pass information, like the package name, version, os, and and store it in a database.
http://programmingfortherestofus.blogspot.com/2014/08/tracking-downloads-to-your-eclipse.html
I hope it helps!
It is possible to host the plugin jars in the file release service, and then get your site.xml file to point to them. You need to point at a specific mirror to make it work.
This will tell you how many times people download each file as with a normal file release.
Unfortunately, in practice this is a lot of work to maintain, and tends to be unreliable (I kept getting bug reports saying the update site wasn't working).
You could write a very simple php script which just serves up the relevant file, and logs the download to a file or DB. Make sure it double checks the URL is a valid one to download to the user of course :)
Once that's in place, you can update the site.xml to point to the correct thing, or you could probably use URL rewriting to intercept requests to your jar file and pass them through the script. I've never tried that on the SF servers, but it might work.
EDIT:
Even better, just have a php script which sends a redirect like this:
<?php
$file = $_GET('file');
// Now log the access to file
header('Location: ' . $file);
?>
Just a thought: AFAIK, SourceForge does tell you how much data you served. You know the size of your plugin JARs. Divide the data served by the size of your plugin and you get a rough estimate of how many downloads you had.