Commit 0cb325a0 authored by 佳 邓's avatar 佳 邓
Browse files

change javax to jakarta

parent c81635c4
......@@ -4,8 +4,8 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.AccessLevel;
import org.gitlab4j.api.models.AllowedTo;
......
......@@ -4,7 +4,7 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.Release;
import org.gitlab4j.api.models.ReleaseParams;
......
......@@ -10,11 +10,11 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.Branch;
......
......@@ -9,9 +9,9 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.Blame;
......@@ -515,4 +515,4 @@ public class RepositoryFileApi extends AbstractApi {
public Stream<Blame> getBlameStream(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException {
return (getBlame(projectIdOrPath, filePath, ref, getDefaultPerPage()).stream());
}
}
\ No newline at end of file
}
......@@ -4,7 +4,7 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.LabelEvent;
......
......@@ -3,8 +3,8 @@ package org.gitlab4j.api;
import java.util.List;
import java.util.stream.Stream;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.Job;
import org.gitlab4j.api.models.JobStatus;
......
......@@ -10,8 +10,8 @@ import org.gitlab4j.api.services.JiraService;
import org.gitlab4j.api.services.MattermostService;
import org.gitlab4j.api.services.SlackService;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.Response;
/**
* Access for the services API. Currently only the gitlab-ci, HipChatService, Slack, and JIRA service are supported.
......
......@@ -4,8 +4,8 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.Snippet;
import org.gitlab4j.api.models.Visibility;
......
......@@ -3,8 +3,8 @@ package org.gitlab4j.api;
import java.util.List;
import java.util.stream.Stream;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.SystemHook;
......
......@@ -6,9 +6,9 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.AccessLevel;
......
......@@ -3,7 +3,7 @@ package org.gitlab4j.api;
import java.util.List;
import java.util.stream.Stream;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.Todo;
......
......@@ -7,9 +7,9 @@ import java.util.Objects;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.CustomAttribute;
......
......@@ -30,8 +30,8 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.WikiAttachment;
import org.gitlab4j.api.models.WikiPage;
......@@ -131,7 +131,7 @@ public class WikisApi extends AbstractApi {
*/
public Pager<WikiPage> getPages(Object projectIdOrPath, boolean withContent, int itemsPerPage) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("with_content", (withContent ? 1 : 0));
return (new Pager<WikiPage>(this, WikiPage.class, itemsPerPage, formData.asMap(),
return (new Pager<WikiPage>(this, WikiPage.class, itemsPerPage, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "wikis"));
}
......
......@@ -7,7 +7,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.gitlab4j.api.GitLabApiException;
import org.gitlab4j.api.HookManager;
......@@ -181,7 +181,7 @@ public class SystemHookManager implements HookManager {
/**
* Verifies the provided Event and fires it off to the registered listeners.
*
*
* @param event the Event instance to handle
* @throws GitLabApiException if the event is not supported
*/
......@@ -217,7 +217,7 @@ public class SystemHookManager implements HookManager {
/**
* Fire the event to the registered listeners.
*
*
* @param event the SystemHookEvent instance to fire to the registered event listeners
* @throws GitLabApiException if the event is not supported
*/
......
......@@ -8,7 +8,7 @@ import java.nio.file.Files;
import java.util.Base64;
import java.util.Scanner;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.Constants.Encoding;
......@@ -21,7 +21,7 @@ public class FileUtils {
* Creates a File that is unique in the specified directory. If the specified
* filename exists in the directory, "-#" will be appended to the filename until
* a unique filename can be created.
*
*
* @param directory the directory to create the file in
* @param filename the base filename with extension
* @return a File that is unique in the specified directory
......@@ -53,7 +53,7 @@ public class FileUtils {
/**
* Get the filename from the "Content-Disposition" header of a JAX-RS response.
*
*
* @param response the JAX-RS Response instance to get the "Content-Disposition" header filename from
* @return the filename from the "Content-Disposition" header of a JAX-RS response, or null
* if the "Content-Disposition" header is not present in the response
......@@ -66,10 +66,10 @@ public class FileUtils {
return (disposition.replaceFirst("(?i)^.*filename=\"([^\"]+)\".*$", "$1"));
}
/**
* Reads the contents of a File to a String.
*
*
* @param file the File instance to read the contents from
* @return the contents of file as a String
* @throws IOException if any errors occur while opening or reading the file
......@@ -79,7 +79,7 @@ public class FileUtils {
try (Scanner in = new Scanner(file)) {
in.useDelimiter("\\Z");
return (in.next());
}
}
}
/**
......
......@@ -5,14 +5,14 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Enumeration;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
public class HttpRequestUtils {
/**
* Build a String containing a very short multi-line dump of an HTTP request.
*
*
* @param fromMethod the method that this method was called from
* @param request the HTTP request build the request dump from
* @return a String containing a very short multi-line dump of the HTTP request
......@@ -23,7 +23,7 @@ public class HttpRequestUtils {
/**
* Build a String containing a short multi-line dump of an HTTP request.
*
*
* @param fromMethod the method that this method was called from
* @param request the HTTP request build the request dump from
* @param includeHeaders if true will include the HTTP headers in the dump
......@@ -58,7 +58,7 @@ public class HttpRequestUtils {
/**
* Build a String containing a multi-line dump of an HTTP request.
*
*
* @param fromMethod the method that this method was called from
* @param request the HTTP request build the request dump from
* @param includePostData if true will include the POST data in the dump
......@@ -114,7 +114,7 @@ public class HttpRequestUtils {
/**
* Reads the POST data from a request into a String and returns it.
*
*
* @param request the HTTP request containing the POST data
* @return the POST data as a String instance
* @throws IOException if any error occurs while reading the POST data
......@@ -128,7 +128,7 @@ public class HttpRequestUtils {
/**
* Reads the content of a Reader instance and returns it as a String.
*
*
* @param reader the Reader instance to read the data from
* @return the content of a Reader instance as a String
* @throws IOException if any error occurs while reading the POST data
......@@ -147,7 +147,7 @@ public class HttpRequestUtils {
/**
* Masks the PRIVATE-TOKEN header value with "********".
*
*
* @param s a String containing HTTP request info, usually logging info
* @return a String with the PRIVATE-TOKEN header value masked with asterisks
*/
......@@ -159,4 +159,4 @@ public class HttpRequestUtils {
return (s.replaceAll("PRIVATE\\-TOKEN\\: [\\S]*", "PRIVATE-TOKEN: ********"));
}
}
\ No newline at end of file
}
......@@ -11,9 +11,9 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.ContextResolver;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.ext.ContextResolver;
import org.gitlab4j.api.models.User;
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider;
......@@ -81,7 +81,7 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
/**
* Gets the ObjectMapper contained by this instance.
*
*
* @return the ObjectMapper contained by this instance
*/
public ObjectMapper getObjectMapper() {
......@@ -230,7 +230,7 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
/**
* Marshals the supplied object out as a formatted JSON string.
*
*
* @param <T> the generics type for the provided object
* @param object the object to output as a JSON string
* @return a String containing the JSON for the specified object
......
......@@ -19,16 +19,16 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Priority;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.client.ClientResponseContext;
import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
import jakarta.annotation.Priority;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.client.ClientRequestContext;
import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.client.ClientResponseContext;
import jakarta.ws.rs.client.ClientResponseFilter;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.ext.WriterInterceptor;
import jakarta.ws.rs.ext.WriterInterceptorContext;
import org.glassfish.jersey.message.MessageUtils;
......@@ -46,21 +46,21 @@ public class MaskingLoggingFilter implements ClientRequestFilter, ClientResponse
/**
* Default list of header names that should be masked.
*/
public static final List<String> DEFAULT_MASKED_HEADER_NAMES =
public static final List<String> DEFAULT_MASKED_HEADER_NAMES =
Collections.unmodifiableList(Arrays.asList("PRIVATE-TOKEN", "Authorization", "Proxy-Authorization"));
/**
* Prefix for request log entries.
*/
protected static final String REQUEST_PREFIX = "> ";
/**
* Prefix for response log entries.
*/
protected static final String RESPONSE_PREFIX = "< ";
/**
* Prefix that marks the beginning of a request or response section.
* Prefix that marks the beginning of a request or response section.
*/
protected static final String SECTION_PREFIX = "- ";
......@@ -202,7 +202,7 @@ public class MaskingLoggingFilter implements ClientRequestFilter, ClientResponse
/**
* Logs each of the HTTP headers, masking the value of the header if the header key is
* in the list of masked header names.
*
*
* @param sb the StringBuilder to build up the logging info in
* @param id the ID for the logging line
* @param prefix the logging line prefix character
......@@ -212,7 +212,7 @@ public class MaskingLoggingFilter implements ClientRequestFilter, ClientResponse
final long id,
final String prefix,
final MultivaluedMap<String, String> headers) {
getSortedHeaders(headers.entrySet()).forEach(h -> {
final List<?> values = h.getValue();
......@@ -223,7 +223,7 @@ public class MaskingLoggingFilter implements ClientRequestFilter, ClientResponse
String value = (isMaskedHeader ? "********" : values.get(0).toString());
appendId(sb, id).append(prefix).append(header).append(": ").append(value).append('\n');
} else {
final StringBuilder headerBuf = new StringBuilder();
for (final Object value : values) {
if (headerBuf.length() == 0) {
......@@ -232,12 +232,12 @@ public class MaskingLoggingFilter implements ClientRequestFilter, ClientResponse
headerBuf.append(isMaskedHeader ? "********" : value.toString());
}
appendId(sb, id).append(prefix).append(header).append(": ").append(headerBuf.toString()).append('\n');
}
});
}
protected void buildEntityLogString(StringBuilder sb, byte[] entity, int entitySize, Charset charset) {
sb.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
......@@ -302,9 +302,9 @@ public class MaskingLoggingFilter implements ClientRequestFilter, ClientResponse
final StringBuilder sb = new StringBuilder();
printResponseLine(sb, "Received server response", id, responseContext.getStatus());
printHeaders(sb, id, RESPONSE_PREFIX, responseContext.getHeaders());
if (responseContext.hasEntity() && maxEntitySize > 0) {
responseContext.setEntityStream(logResponseEntity(sb, responseContext.getEntityStream(),
responseContext.setEntityStream(logResponseEntity(sb, responseContext.getEntityStream(),
MessageUtils.getCharset(responseContext.getMediaType())));
}
......@@ -319,7 +319,7 @@ public class MaskingLoggingFilter implements ClientRequestFilter, ClientResponse
if (stream == null) {
return;
}
MediaType mediaType = context.getMediaType();
if (mediaType.isCompatible(MediaType.APPLICATION_JSON_TYPE) ||
mediaType.isCompatible(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) {
......
package org.gitlab4j.api.utils;
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.StreamingOutput;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
......@@ -7,9 +10,6 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;
/**
* This StreamingOutput implementation is utilized to send a OAuth2 token request
* in a secure manner. The password is never copied to a String, instead it is
......@@ -75,4 +75,4 @@ public class Oauth2LoginStreamingOutput implements StreamingOutput, AutoCloseabl
clearPassword();
super.finalize();
}
}
\ No newline at end of file
}
......@@ -7,7 +7,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.gitlab4j.api.GitLabApiException;
import org.gitlab4j.api.HookManager;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment