We should just fill in a dummy/safe value for "url" in this case. "url" is used in several places throughout the code (such as to verify locked domain) so you don't want someone to be able to spoof where contents purportedly came from.
Suggestion: http://<hash of rawxml>.doesnotexist/ I'd be happy to review a CL for this. --j On Wed, Mar 9, 2011 at 2:46 PM, Dennis Ju <[email protected]> wrote: > Thanks! That's exactly what I was looking for. > > Quick question though: when rendering a gadget with the "rawxml" param, do > you still need the "url" param? As far as I can tell, the "url" param isn't > needed, but Processor.process(GadgetContext context) will error out if it's > missing due to the following code: > > public Gadget process(GadgetContext context) throws ProcessingException { > Uri url = context.getUrl(); > > if (url == null) { > throw new ProcessingException("Missing or malformed url parameter", > HttpServletResponse.SC_BAD_REQUEST); > } > ... > > I can set the url to a dummy value like "http://asdf" to avoid the error, > but perhaps an if clause should be added to bypass url validation if the > rawxml parameter is present? > > Thoughts? > > Thanks, > Dennis > > > On Tue, Mar 8, 2011 at 11:26 AM, John Hjelmstad <[email protected]> wrote: > >> This is actually possible - you just POST to the rendering URL with param >> &rawxml=<gadget spec>. >> >> Code location isn't intuitive. It works if you're using a >> GadgetSpecFactory that extends (or is) DefaultGadgetSpecFactory: >> >> >> http://codesearch.google.com/codesearch/p?hl=en#oS3Kom0H2nk/trunk/shindig/shindig_735392/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java&q=RAW_GADGETSPEC%20file:shindig&l=66 >> >> --j >> >> >> >> On Tue, Mar 8, 2011 at 11:04 AM, Dennis Ju <[email protected]> wrote: >> >>> Hello, >>> >>> I was wondering if there was a way to render a gadget by passing a >>> gadget's >>> XML content instead of passing a URL. Looking through the >>> GadgetRenderingServlet class, it looks like this isn't doable. >>> >>> Use case for rendering via the content would be to get a quick preview of >>> the gadget. >>> >>> Any thoughts on adding such a feature? Or is this already possible and >>> am I >>> just missing it? >>> >>> Thanks, >>> Dennis >>> >> >> > > > -- > East Coast Symposium, May 10-11, 2011 > > Register today: www.liferay.com/ECS2011 > *New! *Attend Portal Administrator Training Express on May 9 at the same > location as ECS! Reserve your > seat<https://www.regonline.com/builder/site/?eventid=918957> > today. > >
