@Test void getURLWithoutLocale() throws Exception { DocumentReference documentReference = new DocumentReference("wiki", "space", "page"); assertEquals("http: this.generator.getURL(documentReference).toString()); }
@Override public URL getURL(DocumentReference reference) throws XWikiRestException { try { Locale locale = reference.getLocale(); URL url; if (locale != null && !locale.toString().isEmpty()) { url = Utils.createURI(getBaseURI(), PageTranslationResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName(), reference.getLocale()).toURL(); } else { url = Utils.createURI(getBaseURI(), PageResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName()).toURL(); } return url; } catch (MalformedURLException e) { throw new XWikiRestException( String.format("Failed to generate a REST URL for the document [%s].", reference), e); } }
DocumentRestURLGenerator extends AbstractEntityRestURLGenerator<DocumentReference> { @Override public URL getURL(DocumentReference reference) throws XWikiRestException { try { Locale locale = reference.getLocale(); URL url; if (locale != null && !locale.toString().isEmpty()) { url = Utils.createURI(getBaseURI(), PageTranslationResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName(), reference.getLocale()).toURL(); } else { url = Utils.createURI(getBaseURI(), PageResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName()).toURL(); } return url; } catch (MalformedURLException e) { throw new XWikiRestException( String.format("Failed to generate a REST URL for the document [%s].", reference), e); } } }
DocumentRestURLGenerator extends AbstractEntityRestURLGenerator<DocumentReference> { @Override public URL getURL(DocumentReference reference) throws XWikiRestException { try { Locale locale = reference.getLocale(); URL url; if (locale != null && !locale.toString().isEmpty()) { url = Utils.createURI(getBaseURI(), PageTranslationResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName(), reference.getLocale()).toURL(); } else { url = Utils.createURI(getBaseURI(), PageResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName()).toURL(); } return url; } catch (MalformedURLException e) { throw new XWikiRestException( String.format("Failed to generate a REST URL for the document [%s].", reference), e); } }  }
DocumentRestURLGenerator extends AbstractEntityRestURLGenerator<DocumentReference> { @Override public URL getURL(DocumentReference reference) throws XWikiRestException { try { Locale locale = reference.getLocale(); URL url; if (locale != null && !locale.toString().isEmpty()) { url = Utils.createURI(getBaseURI(), PageTranslationResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName(), reference.getLocale()).toURL(); } else { url = Utils.createURI(getBaseURI(), PageResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName()).toURL(); } return url; } catch (MalformedURLException e) { throw new XWikiRestException( String.format("Failed to generate a REST URL for the document [%s].", reference), e); } }  @Override URL getURL(DocumentReference reference); }
DocumentRestURLGenerator extends AbstractEntityRestURLGenerator<DocumentReference> { @Override public URL getURL(DocumentReference reference) throws XWikiRestException { try { Locale locale = reference.getLocale(); URL url; if (locale != null && !locale.toString().isEmpty()) { url = Utils.createURI(getBaseURI(), PageTranslationResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName(), reference.getLocale()).toURL(); } else { url = Utils.createURI(getBaseURI(), PageResource.class, reference.getWikiReference().getName(), getSpaceList(reference.getLastSpaceReference()), reference.getName()).toURL(); } return url; } catch (MalformedURLException e) { throw new XWikiRestException( String.format("Failed to generate a REST URL for the document [%s].", reference), e); } }  @Override URL getURL(DocumentReference reference);  }