Struts2 Rest Plugin + crossdomain.xml

2010-01-21 Thread Brian Ferris
I've been using struts2 + the rest plugin successfully to create a simple
rest api web service.  I'd like to make that service accessible to Flash and
Silverlight clients, which means I need to add a crossdomain.xml access file
at the root of my webapp.  Normally I would just copy a crossdomain.xml file
into the root of my webapp and serve it as a static file.

However, this doesn't seem to work with the rest plugin, as it attempt to
map the request for /crossdomain.xml to an action named CrossdomainAction
action (its index() method specifically).  Ok, so I create a
CrossdomainAction class which just has an index() method that returns
success.  Except now, the request returns the action object serialized as
xml, which isn't what I want either.

Is there an easier way to do this that I'm missing?

The solution I've finally ended up with is to define a custom result with a
name of success-xml, since the rest interceptor will check for a result
with that name.  Of course, if I attempt to set my result location to
crossdomain.xml, it throws an exception on startup because the Convention
plugin doesn't know how to handle results with an extension of xml.  So I
ended up renaming my crossdomain.xml file to crossdomain.html and
writing a custom Result that sets the contentType to text/xml and includes
the crossdomain file.  Pretty convoluted... surely there is something
better?

I'm using struts-2.1.18.1

Thanks,
Brian


Struts Taglib + JSP: Best Practices For Complex HTML Attribute Construction

2008-07-25 Thread Brian Ferris
I'm not sure what that Struts Taglib way to do the following task  
would look like:


I've got a bean on the ValueStack with a boolean isActive() getter.   
When active, I'd like to construct html like:


div class=baseStyle active!-- complex html in here --/div

And when in-active, I'd like to construct:

div class=baseStyle!-- complex html in here --/div

The only real difference is the class attribute, which always has a  
baseStyle class, but should also have an active class when the  
bean is active.


Using struts taglibs inside a JSP, what's the easiest way to make that  
construction?  I have some ideas... but they all seem kind of akward.


Thanks,
Brian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]