Add javadocs to show on a webpage - eclipse

Is there someway that I can show my javadocs that I have generated through eclipse to show them on a webpage in my Spring mvc project? I know I gotta do something with the controller but what?
Thanks in advance!

You could generate the javadocs in some folder within your application (like /WEB-INF/docs/) and instruct Spring to serve them as static resources (which they are):
<mvc:resources mapping="/docs/**" location="/WEB-INF/docs/" />
You then access them with something like http://localhost:8080/yourAppContext/docs/index.html.
Depending on your application URL mappings it might even be possible to generate the files in a publicly available folder (outside of WEB-INF) and let the server itself serve them from there without triggering the Spring dispatcher servlet.

Related

Wicket 6 webapp context resources

Im migrating a wicket 1.4 application which has alot of js,css en images under the webapp context directory :
src/main/webapp
+js
++plugin1.js
++plugin2.js
+app
+css
e.t.c.
In our application we have used
JavaScript.getHeaderContribution("js/plugin1.js");
The new wicket 6 implementation doesn't have this header contribution method.In stead you should use :
JavaHeaderItem.forReference(new JavaScriptResourceReference(Application.class,"js/plugin1.js");
But i dont want to use a scope! it will now search for files in the same package as the Application class. ContextRelativeReference is not valid in this location because it does not extend ResourceReference.
Any ideas about how i should access my webapp files without having to add every single file as a shared resource and reference it in my header contributor?
I have found the solution. It was easier then i expected.
You can simply use JavaScriptHeaderItem.forUrl("js/plugin1.js");
No reference and thus no scope needed.
Regards Niels
And what about mounted resource caching ?? Because when using this method nothing will be cached by browser!

NServicebus MessageHandlers in a different Project don't get hit

My problem:
I have web project which implements NServicebus and should listen to messages.
Trying to keep my solution tidy I set up a different project for all my messagehandlers.
I now find that these messagehandlers do not get "hit" with messages.
To my understanding NServicebus scans all dll's in the debug folder of the web project to find any classes implementing IHandleMessages<>.
I referenced the messagehandlers class library project in my webproject and it appears in my debug folder, however it does not seem to get hit.
What does work
In a console sample project the inclusion of a referenced project which contains messagehandlers works as expected.
In my web app it works when I move my
messaghandlers to the web app project itself.
Reading through the website http://docs.particular.net/nservicebus/hosting/nservicebus-host/ I found that there are overloads for the Configure.With() method.
However:
I do not know if I need them. They text only seem to suggest that
this will limit the places where NServicebus looks for the
implementations of the interface.
these overloads do not exist in the Configure.WithWeb method which I'm using.
I can solve my problem by moving all the messagehandlers to my web project, but this does not seem like the best solution.
Am I missing something here?
When using NServiceBus in a web project, use NServiceBus.Configure.WithWeb() instead of NServiceBus.Configure.With().
Also, in order to load message handlers in a web application, you need to include the .LoadMessageHandlers() line after .UnicastBus() as described in Hosting NServiceBus in your own Process. Otherwise any IHandleMessages<T> implementations are not loaded and your web application operates as a send-only endpoint.

user spcific packages with gwt client side

I am a newbie at GWT and I have the following query.
I have a scenario where I am trying to develop a web interface(using GWT) for an existing application.
In the client side class file I would like to invoke a user specific class file, i understand that this is due to the fact that i am trying to invoke classes other than the ones http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html
I would like to know how this code can be called from the client side of the ui.
Thanks and Regards,
Bhavya
If you have a source code for the class you want to use and it is using only the supported Java classes, you can simply add your specific classes to client packages. If this is a reusable code, you can create a new GWT module and inherit it in your application. You can also simply move those classes to your client packages OR add a new client folder in you .gwt.xml file (add one more <source> tag)
If your class is not compilable by GWT, then I think you need to use it through RPC service.
If the code is translatable into JavaScript, you could for example put your individual class files into a jar and add it to the Build Path - as you would do in a 'regular' Java Project.

JPA Entities for GWT

I have developed one GWT project . I have created one JPA entity called Employee. I want that entity to be persisted to the database. My Employee is
located under com.mygwt.client.bean. Now my question is that are all the entities meant to be located at server side? When I tried to create under
the server side I got the exception saying Forgot to inherit the module for the Employee. Is there any other way for creating the entities in server side instead of creating the entity in client side? Please suggest the way I am doing right or not.
Put in the server side and then add an additional <source path='..'/> to your .gwt.xml to tell GWT where the sources are.
The above answer is right. But you have to be careful what you put in the packages you add using <source path='..' />. The tag <source path='...' /> in your project gwt.xml file tells the GWT compiler where to look for client side-code to convert to JavaScript. So you can only put classes in there that can be converted to JavaScript. You can not just add the server-side package which contains your remote servlets, that is wrong and won't work.
I suggest the following structure:
com.mycompany.client
com.mycompany.shared
com.mycompany.server
Basically client code is in the client directory, and in shared you keep classes (transfer objects, models, validators...) which are used client-side and server-side. Then put these lines into the project gwt.xml file:
<source path='com.mycompany.client' />
<source path='com.mycompany.shared' />
You'll have to be careful to access the server library jars only from the com.mycompany.server tree.
Also, not try to send an object from the server libraries over the wire to the client. If you need to send server library objects over the wire you'll have to have the source to the library -- it's a mess. It is easier to create a DTO class in com.mycompany.shared that is created my the sevrlet of your application from the server side information.
Stuart

Grails + GWT - using the same Date Format

I am developing an app using Grails and GWT for a client side.
I want to use the same date format both on the client side and on the server side (preferably defined in one file).
So far i've understood that Grails got it's own mechanism for internationalization (grails-app/i18n). I know i can access these messages from any server code using app context.
I can also access any resource file inside web-app directory.
For the client side, i can use ConstantsWithLookup interface and GWT.Create(...) to get an instance of it.
But, i still haven't found good solution to integrate these two together, so i have date format defined in one place. Any ideas or tips?
Thanks,
Sergey
After digging into Grails more, i came to a solution.
I've put constant into .properties file under grails-app/i18n.
Then, i hook to eventCompileEnd and i copy resources from grails-app/i18n to specific package in target\generated-sources.
After this step is completed, i generate google I18N interfaces using copied property files.
I've put this functionality to separate plugin.
_Events.groovy:
includeTargets << new File("${myPluginDir}/scripts/_MyInternal.groovy")
eventCompileEnd = {
internalCopyMessageResources();
}
eventCopyMessageResourcesEnd = {
generateI18NInterface();
}
Now it is possible to access localized data from server side and from client side.