Instead of
Users.action?login=foo
I want to have
/users/foo/
In spring mvc they have "URI templates" for it, but they are only annotation-based.
Is it possible to do such url-s in Struts with xml from-the-box?
The only one thing I found was external tool: http://www.progbear.com/voice/2010/struts-2-create-friendly-url-with-urlrewritefilter
wildcards in struts do not work with "/" and cannot pass parameters to action.
Sure I can get this info from request but I believe Struts should support it.
Yes, you can do this out-of-the-box with Struts2. Check out the NamedVariablePatternMatcher, which I described here.
In your case, you would need to enable the options in the answer that I linked to above and then map your action as:
<action name="users/{login}" class="...">
...
</action>
You could also look into the rest plug-in.
Related
We have a GWT app that exposes an API using Google Cloud Endpoints. As we use objectify we can not expose the Key tag to the API. For that we use the ApiResourceProperty in order to make the API ignore the field, but if we do that the GWT compilation fails.
I have tried everything, from using the exclude from source in the gwt.xml to using the #gwtincompatible
So... is there a way to ignore the ApiResourceProperty.class in the GWT compilation?
Any other idea? If not I would have to duplicate my entities for the API
Thanks in advance
The only option I had was to create custom DTOs for the API.
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.
I'm trying to extend Share DocumentLibrary with a new action that provide a link to some url based on the nodeRef Id (through share-config-custom.xml)
<action id="blabla" type="link" label="label">
<param name="page">../../alfresco/wcs/myPlugin/editor/{node.nodeRef.id}/param>
<param name="target">_blank</param>
</action>
But Share does not interpret {node.nodeRef.id}
It does interpret {node.nodeRef} correctly but I don't need the full URI
Like: workspace://SpacesStore/158f0ed4-a575-40c2-a6ef-7e7ed386ba94
I just want the node ref id : 158f0ed4-a575-40c2-a6ef-7e7ed386ba94
Anyone can explain me the logic behind this and suggest a solution? Thanks
First of all I assume you are asking for Alfresco 4.0. The way how actions can be extended is completely new in 4.0 and most of us haven't used that yet.
The logic that creates the place holders is probably in Java code in the Share webapp (haven't found the exact location). The node.nodeRef is a String so you can not call nodeRef.id. In my opinion you have two options:
You can keep type="link" and node.nodeRef but you link to a custom repository side webscript which then generates the correct URL and forwards (HTTP Status 301) to the correct destination.
You change the type to type="javascript" and implement a callback function in Javascript. This will be called when the link is clicked and can build the correct Url. To include custom javascript you can use the dependencies in the Share config:
As far as I know the only documentation available for extending the new actions is:
http://blogs.alfresco.com/wp/mikeh/tag/4-0/
http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/concepts/doclib-web-tier.html
Just use node.id as seen at the Javascript API Wiki
I am trying to figure out how to configure a ASP.NET MVC2 config file to have absolutely no caching. My current config file has this xml node...
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="ZeroCacheProfile" duration="0" varyByParam="*" location="None" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
That would indicate to me, that no caching is going on with with this application. Am I missing something? Will continue to browse the internet searching for the most succinct answer. Thank you.
Defining a cache profile in web.config per se doesn't do anything useful other than defining a cache profile. There must be something using this cache profile otherwise it stays a simple definition. So that's half of the job.
The second half is to decorate all your controllers or actions that you would like to disable caching for with the [OutputCache] attribute:
[OutputCache(CacheProfile = "ZeroCacheProfile")]
or if you want to do this for all controllers of your site define a base controller that all your controllers derive from and then decorate this base controller with the aforementioned attribute.
I have a custom ResourceBundle class org.example.web.UILabels.java which works well in running code but the JSF editor in Eclipse is not finding it, I assume the editor/validator is only looking for properties files by the name. This also means I no longer get type ahead find on the resources which was very nice to have.
Any ideas how this could be rectified?
<f:loadBundle basename="org.example.web.UILabels" var="uiLabels"/>
...
<h:outputText value="#{uiLabels.someTextValue}" />
...
I am getting the error message (in the problems error list)
Resource bundle org.example.web.UILabels cannot be found on classpath
Type=JSF Problem
Eclipse3.4.0 with WebStandardTools Versions
Version:1.4.0.v200802280619-13-7w311917141518
Version:1.5.1.v200802280619-1407w311917141519
Version:3.0.0.v200806092130-7A-8Y8QqN2lf4VSWrI2ek5Pf4k7s
For more about why I am using a ResourceBundle class instead of just a properties file see Question 653682 how-to-override-some-resources-from-a-propertyresourcebundle
Thanks for your time, David Waters
The resource-bundle element is more efficient than the f:loadBundle action since the bundle can be created once for teh entire application. However its a JSF 1.2 feature and if u want to be compatible with JSF 1.1 you must use JSF 1.1. Heres an example if your using JSF 1.2:
Define it in your faces-config.xml like this:
<application>
<resource-bundle>
<base-name>org.example.web.UILabels</basename>
<var>uiLabels</var>
</resource-bundle>
</application>
Sorry for not answering your question, but I dont have first hand experience with Eclipse. I also misunderstood your question first, therefor Ive edited my original answer.
I had the same problem, I finally find this sollution :
Eclipse search only the default properties, your project has to have a properties with no locale, for example, with :
<f:loadBundle basename="i18n.messages" var="msg" />
Eclipse will only search "i18n/messages.properties".