gae-java-mini-profiler icon indicating copy to clipboard operation
gae-java-mini-profiler copied to clipboard

make it work with non-jsp pages

Open antonytrupe opened this issue 11 years ago • 12 comments

This may already be possible(I don't think so though), so documentation is definitely needed to make this easier.

antonytrupe avatar Mar 17 '13 19:03 antonytrupe

Is there something in specific that's not working? mini_profile_includes is just a request attribute, so it should work with any templating system. I've used it in an app that uses FreeMarker templates with no issues.

jriecken avatar Mar 17 '13 20:03 jriecken

I meant static pages, that are served from the static content servers and don't get (pre)processed by the web server.

antonytrupe avatar Mar 17 '13 21:03 antonytrupe

I'm not sure what there would be to profile for static files (especially ones on another server). If there's no processing, then all it is is the browser downloading a file. The dev tools in most browsers can give you information about how long it's taking all of the static assets on the page to load.

Is there a specific use case you're thinking of?

jriecken avatar Mar 18 '13 03:03 jriecken

ajax calls, and their resulting processing on the server.

My goal in creating it is to let others(you) know is is (about to be) worked on, and to get input; I intend to own this issue.

antonytrupe avatar Mar 18 '13 03:03 antonytrupe

Cool.

jriecken avatar Mar 18 '13 15:03 jriecken

Having said that, feel free to assign it to me.

antonytrupe avatar Mar 23 '13 03:03 antonytrupe

It looks like I am going to change the packaging to war, move/copy the static resources to the webapp folder(preserving the rest of the folder structure).

I may eventually try to package it as both a jar and a war; I've never attempted that before.

I am having problems getting the mprid into static pages initially. I guess I'll have to do an ajax call to the serer right away to get things moving.

Any thoughts?

antonytrupe avatar Mar 25 '13 18:03 antonytrupe

Hm, I would rather this not have to be a separate web application (does that even work with GAE?)

The profiler right now does keep track of Ajax requests that happen after the page has loaded (ones that make it through the MiniProfilerFilter filter).

Can you give an example of the type of page you're trying to get profiling information on? It might help with figuring out how to implement it.

jriecken avatar Mar 25 '13 18:03 jriecken

/stuff.html, where there are user actions that cause requests to be made but do not cause a full page (re)load. Unless I am missing something, there is not a simple way to enable the profiling on static pages like this for the ajax calls, though I could be missing something.

It wouldn't be a "separate web application"; making it a war dependency allows maven dependency management to copy "resource" files from the dependency to the target project.

antonytrupe avatar Mar 25 '13 19:03 antonytrupe

Ah, yeah I see what your issue is now. I'm not sure that it's going to be easy (or possible) to inject the profile viewer into your static HTML page as you're not going to be able to change the contents to add the js/css/etc (especially if you want to restrict it so that not everyone viewing the page can see it)

If you don't have a lot of pages like this, you could consider making your page a JSP (or whatever template library you want to use) where the only dynamic part is the ${mini_profile_includes} variable in the <head>.

jriecken avatar Mar 25 '13 21:03 jriecken

I am working on making the css, js, and the all the bits in ${mini_profile_includes} able to be simply injected and/or copy/pasted into the static files. I may or may not end up with something useful.

Turning static pages into .jsp is an option I am keeping on the list. It has the downside of needing to go to the app server before serving anything instead of going to the cdn servers. The upside is that I could put all the data in the original response instead of doing an ajax call as soon as the static page loads.

antonytrupe avatar Mar 25 '13 21:03 antonytrupe

I've made some radical changes, including creating a pair of modules and moving all the original code to one, and a copy/edit of the resource files to a second. The first module, which is identical to the original project, is still packaged as a jar. The second module, which has modified versions of the resouce files(jquery.tmpl.min.js, mini_profiler.js, mini_profiler.html, and mini_profiler.css) is packaged as a war. The pom that contains those two modules is obviously packaged as a pom.

You can look at the changes @ https://github.com/antonytrupe/gae-java-mini-profiler/tree/war-ify, and let me know if you have any opinions, or interest is picking/choosing bits and pieces.

I also updated the readme to indicate how to include the necessary files in static pages.

By no means is this done. It is still possible I may abandon this after thinking about it some more.

antonytrupe avatar Mar 26 '13 20:03 antonytrupe