Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions celements-filebase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions celements-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.celements</groupId>
<artifactId>celements-shared-tests</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriComponentsBuilder;
import org.xwiki.model.reference.EntityReference;
import org.xwiki.script.service.ScriptService;

import com.celements.model.context.ModelContext;
import com.celements.url.UrlService;

import jakarta.ws.rs.core.UriBuilder;

@Component("url")
public class UrlScriptService implements ScriptService {

Expand Down Expand Up @@ -84,18 +83,19 @@ public String getExternalURL(@Nullable EntityReference ref, @Nullable String act
}
}

@NotNull
public UriBuilder createURIBuilder() {
@Nullable
public UriComponentsBuilder createURIBuilder() {
return createURIBuilder(null);
}

@NotNull
UriBuilder createURIBuilder(@Nullable EntityReference ref) {
@Nullable
public UriComponentsBuilder createURIBuilder(@Nullable EntityReference ref) {
return createURIBuilder(ref, null);
}

@Nullable
UriBuilder createURIBuilder(@Nullable EntityReference ref, @Nullable String action) {
public UriComponentsBuilder createURIBuilder(@Nullable EntityReference ref,
@Nullable String action) {
try {
return urlService.createURIBuilder(firstNonNull(ref, getCurrentReference()), action);
} catch (Exception iae) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.util.UriComponentsBuilder;
import org.xwiki.model.EntityType;
import org.xwiki.model.reference.EntityReference;

Expand All @@ -26,8 +27,6 @@
import com.xpn.xwiki.web.ViewAction;
import com.xpn.xwiki.web.XWikiURLFactory;

import jakarta.ws.rs.core.UriBuilder;

@Component
public class XWikiUrlService implements UrlService {

Expand Down Expand Up @@ -79,15 +78,15 @@ public String getExternalURL(EntityReference ref, String action, String queryStr
}

@Override
public UriBuilder createURIBuilder(EntityReference ref) {
public UriComponentsBuilder createURIBuilder(EntityReference ref) {
return createURIBuilder(ref, null);
}

@Override
public UriBuilder createURIBuilder(EntityReference ref, String action) {
public UriComponentsBuilder createURIBuilder(EntityReference ref, String action) {
checkArgument(ref != null, "reference may not be null");
try {
return UriBuilder.fromUri(createURLObject(ref, action, null).toURI());
return UriComponentsBuilder.fromUri(createURLObject(ref, action, null).toURI()).encode();
} catch (URISyntaxException exc) {
throw new IllegalArgumentException("illegal reference provided: " + ref, exc);
}
Expand Down Expand Up @@ -124,9 +123,9 @@ private URL createWikiURL(String wikiName, String queryString) {
URL url = context.getXWikiContext().getWiki().getServerURL(wikiName,
context.getXWikiContext());
checkArgument(url != null, "wiki [%s] does not exist", wikiName);
UriBuilder builder = UriBuilder.fromUri(url.toURI());
UriComponentsBuilder builder = UriComponentsBuilder.fromUri(url.toURI());
builder.replaceQuery(queryString);
return builder.build().toURL();
return builder.build().toUri().toURL();
} catch (MalformedURLException | URISyntaxException exc) {
throw new IllegalArgumentException("illegal wiki name provided: " + wikiName, exc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,15 @@ $adminMsg.get("wikimanager.totalnumberofwiki") : $wikiList.size()
<td>#if($firstalias.wikiPrettyName && $firstalias.wikiPrettyName.trim().length() > 0) $firstalias.wikiPrettyName ($wiki.wikiName) #else $wiki.wikiName #end</td>
<td>
<ul>
#set($urlBuilder = $services.url.createURIBuilder())
#set($stfu = $urlBuilder.replacePath('/'))
#set($stfu = $urlBuilder.replaceQuery(''))
#foreach ($wikialias in $wikiAliasList)
#if ($wikialias.server && $wikialias.server.trim().length() > 0)
<li> <a href="$wikialias.homePageUrl">$wikialias.server</a>
#set($stfu = $urlBuilder.host($wikialias.server))
#set($stfu = $urlBuilder.scheme('https'))
#if (!$wikialias.secure) #set($stfu = $urlBuilder.scheme('http')) #end
<li> <a href="$urlBuilder.build()">$wikialias.server</a>
#end
#end
</ul>
Expand All @@ -99,7 +105,11 @@ $adminMsg.get("wikimanager.totalnumberofwiki") : $wikiList.size()
#end
</td>
<td>
#if(($WikiManager.canDeleteWiki()) && ($wiki.WikiName != $context.mainWikiName) && ("$request.confirmwikidel" == '1')) <a href="?action=delete&amp;wikiname=$wiki.WikiName">$adminMsg.get("delete")</a> |#end <a href="$wiki.getURL("view")">$adminMsg.get("wikimanager.action.settings")</a></td>
#if(($WikiManager.canDeleteWiki()) && ($wiki.WikiName != $context.mainWikiName) && ("$request.confirmwikidel" == '1'))
<a href="?action=delete&amp;wikiname=$wiki.WikiName">$adminMsg.get("delete")</a>
#end
<a href="$services.url.getURL($wiki.documentReference)">$adminMsg.get("wikimanager.action.settings")</a>
</td>
</tr>
#end
</table>
Expand Down
6 changes: 0 additions & 6 deletions celements-xwiki-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@
<artifactId>commons-net</artifactId>
</dependency>

<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>

<!--
Make sure we provide a default implementation of slf4j for any test indirectly use it
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
import javax.validation.constraints.NotNull;

import org.xwiki.model.reference.EntityReference;

import jakarta.ws.rs.core.UriBuilder;
import org.springframework.web.util.UriComponentsBuilder;

public interface UrlService {

Expand All @@ -52,10 +51,10 @@ public String getExternalURL(@NotNull EntityReference ref, @Nullable String acti
@Nullable String queryString);

@NotNull
UriBuilder createURIBuilder(@NotNull EntityReference ref);
UriComponentsBuilder createURIBuilder(@NotNull EntityReference ref);

@NotNull
UriBuilder createURIBuilder(@NotNull EntityReference ref, @Nullable String action);
UriComponentsBuilder createURIBuilder(@NotNull EntityReference ref, @Nullable String action);

/**
* CAUTION: incomplete implementation. Not all valid strut-actions are recognized
Expand Down