private UriStatus getUrlStatus(HttpServletRequest req) { return iframeUriManager.validateRenderingUri(new UriBuilder(req).toUri()); }
gadgetJson.put("iframeUrl", iframeUriManager.makeRenderingUri(gadget).toString()) .put("url",context.getUrl().toString()) .put("moduleId", context.getModuleId())
translateUris(iframeUriManager.makeAllRenderingUris(gadget)) : null; Boolean needsTokenRefresh = isFieldIncluded(fields, "needstokenrefresh") ?
gadgetJson.put("iframeUrl", iframeUriManager.makeRenderingUri(gadget).toString()) .put("url",context.getUrl().toString()) .put("moduleId", context.getModuleId())
private UriStatus getUrlStatus(HttpServletRequest req) { return iframeUriManager.validateRenderingUri(new UriBuilder(req).toUri()); }
gadgetJson.put("iframeUrl", iframeUriManager.makeRenderingUri(gadget).toString()) .put("url",context.getUrl().toString()) .put("moduleId", context.getModuleId())
private UriStatus getUrlStatus(HttpServletRequest req) { return iframeUriManager.validateRenderingUri(new UriBuilder(req).toUri()); }
/** * Get gadget metadata information and iframe url. Support filtering of fields * @param request request parameters * @return gadget metadata nd iframe url * @throws ProcessingException */ public GadgetsHandlerApi.MetadataResponse getMetadata(GadgetsHandlerApi.MetadataRequest request) throws ProcessingException { if (request.getUrl() == null) { throw new ProcessingException("Missing url paramater", HttpResponse.SC_BAD_REQUEST); } if (request.getContainer() == null) { throw new ProcessingException("Missing container paramater", HttpResponse.SC_BAD_REQUEST); } if (request.getFields() == null) { throw new ProcessingException("Missing fields paramater", HttpResponse.SC_BAD_REQUEST); } Set<String> fields = beanFilter.processBeanFields(request.getFields()); GadgetContext context = new MetadataGadgetContext(request); Gadget gadget = processor.process(context); String iframeUrl = (fields.contains("iframeurl") || fields.contains(BeanFilter.ALL_FIELDS)) ? iframeUriManager.makeRenderingUri(gadget).toString() : null; Boolean needsTokenRefresh = (fields.contains("needstokenrefresh") || fields.contains(BeanFilter.ALL_FIELDS)) ? gadget.getAllFeatures().contains("auth-refresh") : null; return createMetadataResponse(context.getUrl(), gadget.getSpec(), iframeUrl, needsTokenRefresh, fields); }
@Before public void setUpUrlGenerator() { expect(iframeUriManager.validateRenderingUri(isA(Uri.class))).andReturn(UriStatus.VALID_UNVERSIONED); expect(request.getRequestURL()).andReturn(new StringBuffer("http://foo.com")); expect(request.getQueryString()).andReturn("?q=a"); servlet.setIframeUriManager(iframeUriManager); }
/** * Get gadget metadata information and iframe url. Support filtering of fields * @param request request parameters * @return gadget metadata nd iframe url * @throws ProcessingException */ public GadgetsHandlerApi.MetadataResponse getMetadata(GadgetsHandlerApi.MetadataRequest request) throws ProcessingException { if (request.getUrl() == null) { throw new ProcessingException("Missing url paramater", HttpResponse.SC_BAD_REQUEST); } if (request.getContainer() == null) { throw new ProcessingException("Missing container paramater", HttpResponse.SC_BAD_REQUEST); } if (request.getFields() == null) { throw new ProcessingException("Missing fields paramater", HttpResponse.SC_BAD_REQUEST); } Set<String> fields = beanFilter.processBeanFields(request.getFields()); GadgetContext context = new MetadataGadgetContext(request); Gadget gadget = processor.process(context); String iframeUrl = (fields.contains("iframeurl") || fields.contains(BeanFilter.ALL_FIELDS)) ? iframeUriManager.makeRenderingUri(gadget).toString() : null; return createMetadataResponse(context.getUrl(), gadget.getSpec(), iframeUrl, fields); }
@Before public void setUpUrlGenerator() { expect(iframeUriManager.validateRenderingUri(isA(Uri.class))).andReturn(UriStatus.VALID_UNVERSIONED); expect(request.getRequestURL()).andReturn(new StringBuffer("http://foo.com")); expect(request.getQueryString()).andReturn("?q=a"); servlet.setIframeUriManager(iframeUriManager); }
@Before public void setUpUrlGenerator() { expect(iframeUriManager.validateRenderingUri(isA(Uri.class))).andReturn(UriStatus.VALID_UNVERSIONED); expect(request.getRequestURL()).andReturn(new StringBuffer("http://foo.com")); expect(request.getQueryString()).andReturn("?q=a"); servlet.setIframeUriManager(iframeUriManager); }