This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new f39fac4 Remove deprecated code.
f39fac4 is described below
commit f39fac4b0e9a78dd435c989e35fadf8fcf66b559
Author: JamesBognar <[email protected]>
AuthorDate: Tue Oct 13 13:10:08 2020 -0400
Remove deprecated code.
---
.../org/apache/juneau/internal/JuneauLogger.java | 326 -----
.../apache/juneau/rest/RestMethod_Params_Test.java | 6 -
.../org/apache/juneau/rest/BasicRestLogger.java | 230 ----
.../org/apache/juneau/rest/NoOpRestLogger.java | 57 -
.../java/org/apache/juneau/rest/RestContext.java | 24 -
.../org/apache/juneau/rest/RestContextBuilder.java | 52 -
.../java/org/apache/juneau/rest/RestLogger.java | 128 --
.../org/apache/juneau/rest/RestParamDefaults.java | 14 -
.../java/org/apache/juneau/rest/RestRequest.java | 6 -
.../juneau/rest/annotation/RestResource.java | 12 -
.../rest/annotation/RestResourceConfigApply.java | 3 -
.../apache/juneau/rest/mock/MockHttpSession.java | 117 --
.../java/org/apache/juneau/rest/mock/MockRest.java | 190 ---
.../juneau/rest/mock/MockServletRequest.java | 1367 --------------------
.../juneau/rest/mock/MockServletResponse.java | 417 ------
.../org/apache/juneau/rest/mock/package-info.java | 18 -
16 files changed, 2967 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/JuneauLogger.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/JuneauLogger.java
deleted file mode 100644
index c86a7c9..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/JuneauLogger.java
+++ /dev/null
@@ -1,326 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.internal;
-
-import static java.util.logging.Level.*;
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.text.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.logging.*;
-
-import org.apache.juneau.json.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * Wraps and extends the {@link java.util.logging.Logger} class to provide
some additional convenience methods.
- *
- * @deprecated Methods introduced in Java 8 Logging API renders this class
obsolete.
- */
-@Deprecated
-public class JuneauLogger extends java.util.logging.Logger {
-
- private static final WriterSerializer serializer =
JsonSerializer.create().ssq().build();
-
- private static final ConcurrentHashMap<Class<?>,String> rbMap = new
ConcurrentHashMap<>();
-
- private final ResourceBundle rb;
- private final java.util.logging.Logger innerLogger;
-
- /**
- * Get logger for specified class.
- *
- * @param forClass The class to create a logger for.
- * @return A new <l>BasicLogger</l>.
- */
- public static JuneauLogger getLogger(Class<?> forClass) {
- return getLogger(forClass.getName());
- }
-
- /**
- * Get logger for specified class.
- *
- * @param loggerName The logger name.
- * @return A new <l>BasicLogger</l>.
- */
- public static JuneauLogger getLogger(String loggerName) {
- return new
JuneauLogger(java.util.logging.Logger.getLogger(loggerName));
- }
-
- /**
- * Get logger for specified class using the specified resource bundle
name.
- *
- * @param forClass The class to create a logger for.
- * @param resourceBundleName
- * The name of the resource bundle.
- * Can be any of the following formats:
- * <ol>
- * <li>An absolute path. E.g.
<js>"com/foo/nls/Messages"</js>.
- * <li>A path relative to the package of the class. E.g.
<js>"nls/Messages"</js>.
- * </ol>
- * Both <js>'.'</js> and <js>'/'</js> can be used as path
delimiters.
- * @return A new <l>BasicLogger</l>.
- */
- public static JuneauLogger getLogger(Class<?> forClass, String
resourceBundleName) {
- return new
JuneauLogger(java.util.logging.Logger.getLogger(forClass.getName(),
resolveResourceBundleName(forClass, resourceBundleName)));
- }
-
- /**
- * Get logger with specified name using the specified resource bundle
name.
- *
- * @param name The name of the logger to use.
- * @param resourceBundleName
- * The name of the resource bundle.
- * Can be any of the following formats:
- * <ol>
- * <li>An absolute path. E.g.
<js>"com/foo/nls/Messages"</js>.
- * <li>A path relative to the package of the class. E.g.
<js>"nls/Messages"</js>.
- * </ol>
- * Both <js>'.'</js> and <js>'/'</js> can be used as path
delimiters.
- * @return A new <l>BasicLogger</l>.
- */
- public static synchronized JuneauLogger getLogger(String name, String
resourceBundleName) {
- return new
JuneauLogger(java.util.logging.Logger.getLogger(name, resourceBundleName));
- }
-
- /**
- * Wrap the specified logger
- *
- * @param logger The java logger to use for logging.
- * @return A new <l>BasicLogger</l>.
- */
- public static synchronized JuneauLogger
getLogger(java.util.logging.Logger logger) {
- return new JuneauLogger(logger);
- }
-
- /**
- * Constructor.
- *
- * @param innerLogger The wrapped logger.
- */
- public JuneauLogger(java.util.logging.Logger innerLogger) {
- super(innerLogger.getName(),
innerLogger.getResourceBundleName());
- this.innerLogger = innerLogger;
- this.rb = getResourceBundle();
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#SEVERE} level.
- *
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void severe(String msg, Object...args) {
- if (isLoggable(SEVERE))
- log(SEVERE, msg, args);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#WARNING} level.
- *
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void warning(String msg, Object...args) {
- if (isLoggable(WARNING))
- log(WARNING, msg, args);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#INFO} level.
- *
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void info(String msg, Object...args) {
- if (isLoggable(INFO))
- log(INFO, msg, args);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#CONFIG} level.
- *
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void config(String msg, Object...args) {
- if (isLoggable(CONFIG))
- log(CONFIG, msg, args);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#FINE} level.
- *
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void fine(String msg, Object...args) {
- if (isLoggable(FINE))
- log(FINE, msg, args);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#FINER} level.
- *
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void finer(String msg, Object...args) {
- if (isLoggable(FINER))
- log(FINER, msg, args);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#FINEST} level.
- *
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void finest(String msg, Object...args) {
- if (isLoggable(FINEST))
- log(FINEST, msg, args);
- }
-
- /**
- * Logs an exception as {@link Level#SEVERE} level.
- *
- * @param t The Throwable object to log.
- */
- public void severe(Throwable t) {
- if (isLoggable(SEVERE))
- log(SEVERE, t.getLocalizedMessage(), t);
- }
-
- /**
- * Logs an exception as {@link Level#WARNING} level.
- *
- * @param t The Throwable object to log.
- */
- public void warning(Throwable t) {
- if (isLoggable(WARNING))
- log(WARNING, t.getLocalizedMessage(), t);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#SEVERE} level.
- *
- * @param t The Throwable object associated with the event that needs
to be logged.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void severe(Throwable t, String msg, Object...args) {
- if (isLoggable(SEVERE))
- log(SEVERE, getMessage(msg, args), t);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#WARNING} level.
- *
- * @param t The Throwable object associated with the event that needs
to be logged.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void warning(Throwable t, String msg, Object...args) {
- if (isLoggable(WARNING))
- log(WARNING, getMessage(msg, args), t);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at {@link Level#INFO} level.
- *
- * @param t The Throwable object associated with the event that needs
to be logged.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void info(Throwable t, String msg, Object...args) {
- if (isLoggable(INFO))
- log(INFO, getMessage(msg, args), t);
- }
-
- @Override /* Logger */
- public void log(LogRecord record) {
- innerLogger.log(record);
- }
-
- /**
- * Logs a message with the specified {@link MessageFormat}-style
arguments at the specified level.
- *
- * @param level The log level.
- * @param cause The Throwable object associated with the event that
needs to be logged.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void log(Level level, Throwable cause, String msg,
Object...args) {
- if (isLoggable(level))
- log(level, getMessage(msg, args), cause);
- }
-
- @Override /* Logger */
- public boolean isLoggable(Level level) {
- return innerLogger.isLoggable(level);
- }
-
- /**
- * Similar to {@link #log(Level, String, Object[])}, except arguments
are converted to objects
- * that are serialized using the {@link
JsonSerializer#toStringObject(Object)} method.
- *
- * <p>
- * This allows arbitrary POJOs to be serialized as message parameters.
- *
- * @param level The level of the given message.
- * @param msg The message to log.
- * @param args The POJO arguments.
- */
- public void logObjects(Level level, String msg, Object...args) {
- if (isLoggable(level)) {
- for (int i = 0; i < args.length; i++)
- args[i] = serializer.toStringObject(args[i]);
- log(level, msg, args);
- }
- }
-
- private String getMessage(String msg, Object...args) {
- if (args.length == 0)
- return msg;
- if (rb != null && rb.containsKey(msg))
- msg = rb.getString(msg);
- return format(msg, args);
- }
-
- private static String resolveResourceBundleName(Class<?> forClass,
String path) {
- if (isEmpty(path))
- return null;
- String rb = rbMap.get(forClass);
- if (rb == null) {
- path = path.replace('/', '.');
- if (path.startsWith("."))
- path = path.substring(1);
- ClassLoader cl = forClass.getClassLoader();
- try {
- ResourceBundle.getBundle(path,
Locale.getDefault(), cl);
- rbMap.putIfAbsent(forClass, path);
- } catch (MissingResourceException e) {
- try {
- path = forClass.getPackage().getName()
+ '.' + path;
- ResourceBundle.getBundle(path,
Locale.getDefault(), cl);
- rbMap.putIfAbsent(forClass, path);
- } catch (MissingResourceException e2) {
- rbMap.putIfAbsent(forClass, "");
- }
- }
- rb = rbMap.get(forClass);
- }
- return ("".equals(rb) ? null : rb);
- }
-}
diff --git
a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java
b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java
index 99cbd37..201b621 100644
---
a/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java
+++
b/juneau-rest/juneau-rest-server-utest/src/test/java/org/apache/juneau/rest/RestMethod_Params_Test.java
@@ -94,11 +94,6 @@ public class RestMethod_Params_Test {
public String l(@Method String t) {
return t;
}
- @SuppressWarnings("deprecation")
- @RestMethod
- public boolean m(RestLogger t) {
- return t != null;
- }
@RestMethod
public boolean n(RestContext t) {
return t != null;
@@ -146,7 +141,6 @@ public class RestMethod_Params_Test {
a.get("/j").run().assertBody().is("true");
a.get("/k").run().assertBody().is("true");
a.get("/l").run().assertBody().is("GET");
- a.get("/m").run().assertBody().is("true");
a.get("/n").run().assertBody().is("true");
a.get("/o").contentType("application/json").run().assertBody().is("org.apache.juneau.json.JsonParser");
a.get("/p").acceptLanguage("en-US").run().assertBody().is("en_US");
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestLogger.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestLogger.java
deleted file mode 100644
index 381462b..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestLogger.java
+++ /dev/null
@@ -1,230 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest;
-
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.text.*;
-import java.util.logging.*;
-
-import javax.servlet.http.*;
-
-import org.apache.juneau.internal.*;
-import org.apache.juneau.json.*;
-
-/**
- * Logging utility class.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use {@link BasicRestCallLogger}
- * </div>
- *
- * <p>
- * Subclasses can override these methods to tailor logging of HTTP requests.
- * <br>Subclasses MUST implement a no-arg public constructor.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc RestLoggingAndDebugging}
- * </ul>
- */
-@Deprecated
-public class BasicRestLogger implements RestLogger {
-
- private final JuneauLogger logger;
- private final RestContext context;
-
-
- /**
- * Constructor.
- *
- * @param context The context of the resource object.
- */
- public BasicRestLogger(RestContext context) {
- this.context = context;
- this.logger = JuneauLogger.getLogger(getLoggerName());
- }
-
- /**
- * Returns the logger name.
- *
- * <p>
- * By default returns the class name of the servlet class passed in to
the context.
- *
- * <p>
- * Subclasses can override this to provide their own customized logger
names.
- *
- * @return The logger name.
- */
- protected String getLoggerName() {
- return context == null ? getClass().getName() :
context.getResource().getClass().getName();
- }
-
- /**
- * Returns the Java logger used for logging.
- *
- * <p>
- * Subclasses can provide their own logger.
- * The default implementation returns the logger created using
<c>Logger.getLogger(getClass())</c>.
- *
- * @return The logger used for logging.
- */
- protected Logger getLogger() {
- return logger;
- }
-
- @Override /* RestLogger */
- public void setLevel(Level level) {
- getLogger().setLevel(level);
- }
-
- /**
- * Log a message to the logger.
- *
- * <p>
- * Subclasses can override this method if they wish to log messages
using a library other than Java Logging
- * (e.g. Apache Commons Logging).
- *
- * @param level The log level.
- * @param cause The cause.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- @Override /* RestLogger */
- public void log(Level level, Throwable cause, String msg,
Object...args) {
- msg = format(msg, args);
- getLogger().log(level, msg, cause);
- }
-
- /**
- * Log a message.
- *
- * <p>
- * Equivalent to calling <code>log(level, <jk>null</jk>, msg,
args);</code>
- *
- * @param level The log level.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- @Override /* RestLogger */
- public void log(Level level, String msg, Object...args) {
- log(level, null, msg, args);
- }
-
- /**
- * Same as {@link #log(Level, String, Object...)} excepts runs the
arguments through {@link JsonSerializer#DEFAULT_READABLE}.
- *
- * <p>
- * Serialization of arguments do not occur if message is not logged, so
it's safe to use this method from within
- * debug log statements.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode w800'>
- * logObjects(<jsf>DEBUG</jsf>, <js>"Pojo contents:\n{0}"</js>,
myPojo);
- * </p>
- *
- * @param level The log level.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- @Override /* RestLogger */
- public void logObjects(Level level, String msg, Object...args) {
- for (int i = 0; i < args.length; i++)
- args[i] =
SimpleJsonSerializer.DEFAULT_READABLE.toStringObject(args[i]);
- log(level, null, msg, args);
- }
-
- /**
- * Callback method for logging errors during HTTP requests.
- *
- * <p>
- * Typically, subclasses will override this method and log errors
themselves.
- *
- * <p>
- * The default implementation simply logs errors to the
<c>RestServlet</c> logger.
- *
- * <p>
- * Here's a typical implementation showing how stack trace hashing can
be used to reduce log file sizes...
- * <p class='bcode w800'>
- * <jk>protected void</jk> onError(HttpServletRequest req,
HttpServletResponse res, RestException e, <jk>boolean</jk> noTrace) {
- * String qs = req.getQueryString();
- * String msg = <js>"HTTP "</js> + req.getMethod() + <js>"
"</js> + e.getStatus() + <js>" "</js> + req.getRequestURI() + (qs ==
<jk>null</jk> ? <js>""</js> : <js>"?"</js> + qs);
- * <jk>int</jk> c = e.getOccurrence();
- *
- * <jc>// REST_useStackTraceHashes is disabled, so we have
to log the exception every time.</jc>
- * <jk>if</jk> (c == 0)
- * myLogger.log(Level.<jsf>WARNING</jsf>,
<jsm>format</jsm>(<js>"[%s] %s"</js>, e.getStatus(), msg), e);
- *
- * <jc>// This is the first time we've countered this
error, so log a stack trace
- * // unless ?noTrace was passed in as a URL
parameter.</jc>
- * <jk>else if</jk> (c == 1 && ! noTrace)
- * myLogger.log(Level.<jsf>WARNING</jsf>,
<jsm>format</jsm>(<js>"[%h.%s.%s] %s"</js>, e.hashCode(), e.getStatus(), c,
msg), e);
- *
- * <jc>// This error occurred before.
- * // Only log the message, not the stack trace.</jc>
- * <jk>else</jk>
- * myLogger.log(Level.<jsf>WARNING</jsf>,
<jsm>format</jsm>(<js>"[%h.%s.%s] %s, %s"</js>, e.hashCode(), e.getStatus(), c,
msg, e.getLocalizedMessage()));
- * }
- * </p>
- *
- * @param req The servlet request object.
- * @param res The servlet response object.
- * @param e Exception indicating what error occurred.
- */
- @Override /* RestLogger */
- public void onError(HttpServletRequest req, HttpServletResponse res,
RestException e) {
- // No-op
- }
-
- /**
- * Returns <jk>true</jk> if the specified exception should be logged.
- *
- * <p>
- * Subclasses can override this method to provide their own logic for
determining when exceptions are logged.
- *
- * <p>
- * The default implementation will return <jk>false</jk> if
<js>"noTrace=true"</js> is passed in the query string
- * or <c>No-Trace: true</c> is specified in the header.
- *
- * @param req The HTTP request.
- * @param res The HTTP response.
- * @param e The exception.
- * @return <jk>true</jk> if exception should be logged.
- */
- protected boolean shouldLog(HttpServletRequest req, HttpServletResponse
res, RestException e) {
- return false;
- }
-
- /**
- * Returns <jk>true</jk> if a stack trace should be logged for this
exception.
- *
- * <p>
- * Subclasses can override this method to provide their own logic for
determining when stack traces are logged.
- *
- * <p>
- * The default implementation will only log a stack trace if {@link
RestException#getOccurrence()} returns
- * <c>1</c> and the exception is not one of the following:
- * <ul>
- * <li>{@link HttpServletResponse#SC_UNAUTHORIZED}
- * <li>{@link HttpServletResponse#SC_FORBIDDEN}
- * <li>{@link HttpServletResponse#SC_NOT_FOUND}
- * </ul>
- *
- * @param req The HTTP request.
- * @param res The HTTP response.
- * @param e The exception.
- * @return <jk>true</jk> if stack trace should be logged.
- */
- protected boolean shouldLogStackTrace(HttpServletRequest req,
HttpServletResponse res, RestException e) {
- return false;
- }
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/NoOpRestLogger.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/NoOpRestLogger.java
deleted file mode 100644
index 792aae5..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/NoOpRestLogger.java
+++ /dev/null
@@ -1,57 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest;
-
-
-import java.text.*;
-import java.util.logging.*;
-
-/**
- * Logging utility class.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use {@link RestCallLogger}
- * </div>
- *
- * <p>
- * Disables logging entirely.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc RestLoggingAndDebugging}
- * </ul>
- */
-@Deprecated
-public class NoOpRestLogger extends BasicRestLogger {
-
- /**
- * Constructor.
- */
- public NoOpRestLogger() {
- super(null);
- }
-
- /**
- * Log a message to the logger.
- *
- * <p>
- * Subclasses can override this method if they wish to log messages
using a library other than Java Logging
- * (e.g. Apache Commons Logging).
- *
- * @param level The log level.
- * @param cause The cause.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- @Override /* RestLogger */
- public void log(Level level, Throwable cause, String msg,
Object...args) {}
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
index cff1567..ab69106 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContext.java
@@ -3601,7 +3601,6 @@ public class RestContext extends BeanContext {
private final Map<String,List<RestMethodContext>> methodMap;
private final List<RestMethodContext> methods;
private final Map<String,RestContext> childResources;
- @SuppressWarnings("deprecation") private final RestLogger logger;
private final RestCallLogger callLogger;
private final RestCallLoggerConfig callLoggerConfig;
private final StackTraceDatabase stackTraceDb;
@@ -3776,8 +3775,6 @@ public class RestContext extends BeanContext {
resHeaders = getMapProperty(REST_resHeaders,
Object.class);
staticFileResponseHeaders =
getMapProperty(REST_staticFileResponseHeaders, Object.class);
- logger = getInstanceProperty(REST_logger, resource,
RestLogger.class, NoOpRestLogger.class, resourceResolver, this);
-
Object clc = getProperty(REST_callLoggerConfig);
if (this.debug == TRUE)
this.callLoggerConfig =
RestCallLoggerConfig.DEFAULT_DEBUG;
@@ -4408,26 +4405,6 @@ public class RestContext extends BeanContext {
}
/**
- * Returns the logger to use for this resource.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use {@link #getCallLogger()}
- * </div>
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link #REST_logger}
- * </ul>
- *
- * @return
- * The logger to use for this resource.
- * <br>Never <jk>null</jk>.
- */
- @Deprecated
- public RestLogger getLogger() {
- return logger;
- }
-
- /**
* Returns the call logger to use for this resource.
*
* <ul class='seealso'>
@@ -5682,7 +5659,6 @@ public class RestContext extends BeanContext {
.a("clientVersionHeader", clientVersionHeader)
.a("consumes", consumes)
.a("infoProvider", infoProvider)
- .a("logger", logger)
.a("paramResolvers", paramResolvers)
.a("parsers", parsers)
.a("partParser", partParser)
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
index 0bba656..61e7b4e 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
@@ -120,7 +120,6 @@ public class RestContextBuilder extends BeanContextBuilder
implements ServletCon
ClassInfo rci = ClassInfo.of(resourceClass);
// Default values.
- logger(BasicRestLogger.class);
partSerializer(OpenApiSerializer.class);
partParser(OpenApiParser.class);
staticFileResponseHeader("Cache-Control", "max-age=86400,
public");
@@ -1175,57 +1174,6 @@ public class RestContextBuilder extends
BeanContextBuilder implements ServletCon
return set(REST_infoProvider, value);
}
- /**
- * <i><l>RestContext</l> configuration property: </i> REST logger.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use {@link #callLogger(Class)}
- * </div>
- *
- * <p>
- * Specifies the logger to use for logging.
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link RestContext#REST_logger}
- * </ul>
- *
- * @param value
- * The new value for this setting.
- * <br>The default is {@link BasicRestCallLogger}.
- * <br>Can be <jk>null</jk> to disable logging.
- * @return This object (for method chaining).
- */
- @Deprecated
- @FluentSetter
- public RestContextBuilder logger(Class<? extends RestLogger> value) {
- return set(REST_logger, value);
- }
-
- /**
- * <i><l>RestContext</l> configuration property: </i> REST logger.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use {@link #callLogger(RestCallLogger)}
- * </div>
- *
- * <p>
- * Same as {@link #logger(Class)} except input is a pre-constructed
instance.
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link RestContext#REST_logger}
- * </ul>
- *
- * @param value
- * The new value for this setting.
- * <br>The default is {@link BasicRestLogger}.
- * <br>Can be <jk>null</jk> to disable logging.
- * @return This object (for method chaining).
- */
- @Deprecated
- @FluentSetter
- public RestContextBuilder logger(RestLogger value) {
- return set(REST_logger, value);
- }
/**
* <i><l>RestContext</l> configuration property: </i> The maximum
allowed input size (in bytes) on HTTP requests.
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestLogger.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestLogger.java
deleted file mode 100644
index 68faa44..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestLogger.java
+++ /dev/null
@@ -1,128 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest;
-
-import java.text.*;
-import java.util.logging.*;
-
-import javax.servlet.http.*;
-
-import org.apache.juneau.json.*;
-
-/**
- * Logging utility class.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use {@link RestCallLogger}
- * </div>
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link RestContext#REST_logger}
- * <li class='link'>{@doc RestLoggingAndDebugging}
- * </ul>
- */
-@Deprecated
-public interface RestLogger {
-
- /**
- * Represents no RestLogger.
- *
- * <p>
- * Used on annotation to indicate that the value should be inherited
from the parent class, and
- * ultimately {@link BasicRestLogger} if not specified at any level.
- */
- public interface Null extends RestLogger {}
-
- /**
- * Sets the logging level for this logger.
- *
- * @param level The new level.
- */
- public void setLevel(Level level);
-
- /**
- * Log a message to the logger.
- *
- * @param level The log level.
- * @param cause The cause.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void log(Level level, Throwable cause, String msg,
Object...args);
-
- /**
- * Log a message.
- *
- * @param level The log level.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void log(Level level, String msg, Object...args);
-
- /**
- * Same as {@link #log(Level, String, Object...)} excepts runs the
arguments through {@link SimpleJsonSerializer#DEFAULT_READABLE}.
- *
- * <p>
- * Serialization of arguments do not occur if message is not logged, so
it's safe to use this method from within
- * debug log statements.
- *
- * <h5 class='section'>Example:</h5>
- * <p class='bcode w800'>
- * logObjects(<jsf>DEBUG</jsf>, <js>"Pojo contents:\n{0}"</js>,
myPojo);
- * </p>
- *
- * @param level The log level.
- * @param msg The message to log.
- * @param args Optional {@link MessageFormat}-style arguments.
- */
- public void logObjects(Level level, String msg, Object...args);
-
- /**
- * Callback method for logging errors during HTTP requests.
- *
- * <p>
- * Typically, subclasses will override this method and log errors
themselves.
- *
- * <p>
- * The default implementation simply logs errors to the
<c>RestServlet</c> logger.
- *
- * <p>
- * Here's a typical implementation showing how stack trace hashing can
be used to reduce log file sizes...
- * <p class='bcode w800'>
- * <jk>protected void</jk> onError(HttpServletRequest req,
HttpServletResponse res, RestException e, <jk>boolean</jk> noTrace) {
- * String qs = req.getQueryString();
- * String msg = <js>"HTTP "</js> + req.getMethod() + <js>"
"</js> + e.getStatus() + <js>" "</js> + req.getRequestURI() + (qs ==
<jk>null</jk> ? <js>""</js> : <js>"?"</js> + qs);
- * <jk>int</jk> c = e.getOccurrence();
- *
- * <jc>// REST_useStackTraceHashes is disabled, so we have
to log the exception every time.</jc>
- * <jk>if</jk> (c == 0)
- * myLogger.log(Level.<jsf>WARNING</jsf>,
<jsm>format</jsm>(<js>"[%s] %s"</js>, e.getStatus(), msg), e);
- *
- * <jc>// This is the first time we've countered this
error, so log a stack trace
- * // unless ?noTrace was passed in as a URL
parameter.</jc>
- * <jk>else if</jk> (c == 1 && ! noTrace)
- * myLogger.log(Level.<jsf>WARNING</jsf>,
<jsm>format</jsm>(<js>"[%h.%s.%s] %s"</js>, e.hashCode(), e.getStatus(), c,
msg), e);
- *
- * <jc>// This error occurred before.
- * // Only log the message, not the stack trace.</jc>
- * <jk>else</jk>
- * myLogger.log(Level.<jsf>WARNING</jsf>,
<jsm>format</jsm>(<js>"[%h.%s.%s] %s, %s"</js>, e.hashCode(), e.getStatus(), c,
msg, e.getLocalizedMessage()));
- * }
- * </p>
- *
- * @param req The servlet request object.
- * @param res The servlet response object.
- * @param e Exception indicating what error occurred.
- */
- public void onError(HttpServletRequest req, HttpServletResponse res,
RestException e);
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
index 84e118a..a57ac52 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestParamDefaults.java
@@ -90,7 +90,6 @@ class RestParamDefaults {
RequestAttributesObject.class,
RequestQueryObject.class,
RequestFormDataObject.class,
- RestLoggerObject.class,
RestContextObject.class,
ParserObject.class,
ReaderParserObject.class,
@@ -718,19 +717,6 @@ class RestParamDefaults {
}
}
- @SuppressWarnings("deprecation")
- static final class RestLoggerObject extends RestMethodParam {
-
- protected RestLoggerObject() {
- super(OTHER, RestLogger.class);
- }
-
- @Override /* RestMethodParam */
- public RestLogger resolve(RestRequest req, RestResponse res)
throws Exception {
- return req.getContext().getLogger();
- }
- }
-
static final class RestContextObject extends RestMethodParam {
protected RestContextObject() {
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
index 8603a08..e0e94e2 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestRequest.java
@@ -1754,14 +1754,8 @@ public final class RestRequest extends
HttpServletRequestWrapper {
* }
* </p>
*
- * <ul class='notes'>
- * <li>
- * The {@link RestLogger} object can also be passed as a
parameter on the method.
- * </ul>
- *
* <ul class='seealso'>
* <li class='jf'>{@link
org.apache.juneau.rest.RestContext#REST_logger}
- * <li class='jac'>{@link org.apache.juneau.rest.RestLogger}
* <li class='jm'>{@link
org.apache.juneau.rest.RestServlet#log(Level, String, Object...)}
* <li class='link'>{@doc RestLoggingAndDebugging}
* </ul>
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
index 5c9ae01..c4a560c 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResource.java
@@ -507,18 +507,6 @@ public @interface RestResource {
Class<? extends RestInfoProvider> infoProvider() default
RestInfoProvider.Null.class;
/**
- * REST logger.
- *
- * <p>
- * Specifies the logger to use for logging.
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link RestContext#REST_logger}
- * </ul>
- */
- Class<? extends RestLogger> logger() default RestLogger.Null.class;
-
- /**
* Specifies the logger to use for logging of HTTP requests and
responses.
*
* <ul class='seealso'>
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResourceConfigApply.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResourceConfigApply.java
index e66908f..fea325e 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResourceConfigApply.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/RestResourceConfigApply.java
@@ -198,9 +198,6 @@ public class RestResourceConfigApply extends
ConfigApply<RestResource> {
if (a.resourceResolver() != RestResourceResolver.Null.class)
psb.set(REST_resourceResolver, a.resourceResolver());
- if (a.logger() != RestLogger.Null.class)
- psb.set(REST_logger, a.logger());
-
if (a.callLogger() != RestCallLogger.Null.class)
psb.set(REST_callLogger, a.callLogger());
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockHttpSession.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockHttpSession.java
deleted file mode 100644
index 57566b6..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockHttpSession.java
+++ /dev/null
@@ -1,117 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.mock;
-
-import java.util.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-/**
- * An implementation of {@link HttpSession} for mocking purposes.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use <c>org.apache.juneau.restmock2</c>
- * </div>
- */
-@Deprecated
-public class MockHttpSession implements HttpSession {
-
- /**
- * Creates a new HTTP session.
- *
- * @return A new HTTP session.
- */
- public static MockHttpSession create() {
- return new MockHttpSession();
- }
-
- @Override /* HttpSession */
- public long getCreationTime() {
- return 0;
- }
-
- @Override /* HttpSession */
- public String getId() {
- return null;
- }
-
- @Override /* HttpSession */
- public long getLastAccessedTime() {
- return 0;
- }
-
- @Override /* HttpSession */
- public ServletContext getServletContext() {
- return null;
- }
-
- @Override /* HttpSession */
- public void setMaxInactiveInterval(int interval) {
- }
-
- @Override /* HttpSession */
- public int getMaxInactiveInterval() {
- return 0;
- }
-
- @Override /* HttpSession */
- public HttpSessionContext getSessionContext() {
- return null;
- }
-
- @Override /* HttpSession */
- public Object getAttribute(String name) {
- return null;
- }
-
- @Override /* HttpSession */
- public Object getValue(String name) {
- return null;
- }
-
- @Override /* HttpSession */
- public Enumeration<String> getAttributeNames() {
- return null;
- }
-
- @Override /* HttpSession */
- public String[] getValueNames() {
- return null;
- }
-
- @Override /* HttpSession */
- public void setAttribute(String name, Object value) {
- }
-
- @Override /* HttpSession */
- public void putValue(String name, Object value) {
- }
-
- @Override /* HttpSession */
- public void removeAttribute(String name) {
- }
-
- @Override /* HttpSession */
- public void removeValue(String name) {
- }
-
- @Override /* HttpSession */
- public void invalidate() {
- }
-
- @Override /* HttpSession */
- public boolean isNew() {
- return false;
- }
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockRest.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockRest.java
deleted file mode 100644
index 78f5b2e..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockRest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.mock;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-import org.apache.juneau.rest.*;
-import org.apache.juneau.utils.*;
-
-/**
- * Creates a mocked interface against a REST resource class.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use <c>org.apache.juneau.restmock2</c>
- * </div>
- *
- * <p>
- * Allows you to test your REST resource classes without a running servlet
container.
- *
- * <h5 class='figure'>Example:</h5>
- * <p class='bcode w800'>
- * <jk>public class</jk> MockTest {
- *
- * <jc>// Our REST resource to test.</jc>
- * <ja>@Rest</ja>(serializers=JsonSerializer.Simple.<jk>class</jk>,
parsers=JsonParser.<jk>class</jk>)
- * <jk>public static class</jk> MyRest {
- *
- * <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>,
path=<js>"/String"</js>)
- * <jk>public</jk> String echo(<ja>@Body</ja> String b) {
- * <jk>return</jk> b;
- * }
- * }
- *
- * <ja>@Test</ja>
- * <jk>public void</jk> testEcho() <jk>throws</jk> Exception {
- * MockRest
- * .<jsm>create</jsm>(MyRest.<jk>class</jk>)
- * .put(<js>"/String"</js>, <js>"'foo'"</js>)
- * .execute()
- * .assertStatus(200)
- * .assertBody(<js>"'foo'"</js>);
- * }
- * </p>
- */
-@Deprecated
-public class MockRest implements MockHttpConnection {
- private static Map<Class<?>,RestContext> CONTEXTS = new
ConcurrentHashMap<>();
-
- private final RestContext rc;
-
- private MockRest(Class<?> c, boolean debug) throws Exception {
- if (! CONTEXTS.containsKey(c)) {
- Object r = c.newInstance();
- RestContext rc = RestContext.create(r).logger(debug ?
BasicRestLogger.class : NoOpRestLogger.class).build();
- if (r instanceof RestServlet) {
- ((RestServlet)r).setContext(rc);
- } else {
- rc.postInit();
- }
- rc.postInitChildFirst();
- CONTEXTS.put(c, rc);
- }
- rc = CONTEXTS.get(c);
- }
-
- /**
- * Create a new mock REST interface
- *
- * @param c The REST class.
- * @return A new mock interface.
- * @throws RuntimeException
- * For testing conveniences, this method wraps all exceptions in a
RuntimeException so that you can easily define mocks as reusable fields.
- */
- public static MockRest create(Class<?> c) throws RuntimeException {
- return create(c, false);
- }
-
- /**
- * Create a new mock REST interface
- *
- * @param c The REST class.
- * @param debug
- * If <jk>true</jk>, the REST interface will use the {@link
BasicRestLogger} for logging.
- * <br>Otherwise, uses {@link NoOpRestLogger}.
- * @return A new mock interface.
- * @throws RuntimeException
- * For testing conveniences, this method wraps all exceptions in a
RuntimeException so that you can easily define mocks as reusable fields.
- */
- public static MockRest create(Class<?> c, boolean debug) throws
RuntimeException {
- try {
- return new MockRest(c, debug);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Performs a REST request against the REST interface.
- *
- * @param method The HTTP method
- * @param path The URI path.
- * @param body The body of the request.
- * @return A new servlet request.
- * @throws Exception Error occurred.
- */
- @Override /* MockHttpConnection */
- public MockServletRequest request(String method, String path, Object
body) throws Exception {
- return MockServletRequest.create(method,
path).body(body).restContext(rc);
- }
-
- /**
- * Performs a REST request against the REST interface.
- *
- * @param method The HTTP method
- * @param path The URI path.
- * @return A new servlet request.
- * @throws Exception Error occurred.
- */
- public MockServletRequest request(String method, String path) throws
Exception {
- return request(method, path, null);
- }
-
- /**
- * Perform a GET request.
- *
- * @param path The URI path.
- * @return A new servlet request.
- * @throws Exception Error occurred.
- */
- public MockServletRequest get(String path) throws Exception {
- return request("GET", path, null);
- }
-
- /**
- * Perform a PUT request.
- *
- * @param path The URI path.
- * @param body The body of the request.
- * @return A new servlet request.
- * @throws Exception Error occurred.
- */
- public MockServletRequest put(String path, Object body) throws
Exception {
- return request("PUT", path, body);
- }
-
- /**
- * Perform a POST request.
- *
- * @param path The URI path.
- * @param body The body of the request.
- * @return A new servlet request.
- * @throws Exception Error occurred.
- */
- public MockServletRequest post(String path, Object body) throws
Exception {
- return request("POST", path, body);
- }
-
- /**
- * Perform a DELETE request.
- *
- * @param path The URI path.
- * @return A new servlet request.
- * @throws Exception Error occurred.
- */
- public MockServletRequest delete(String path) throws Exception {
- return request("DELETE", path, null);
- }
-
- /**
- * Perform an OPTIONS request.
- *
- * @param path The URI path.
- * @return A new servlet request.
- * @throws Exception Error occurred.
- */
- public MockServletRequest options(String path) throws Exception {
- return request("OPTIONS", path, null);
- }
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletRequest.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletRequest.java
deleted file mode 100644
index bf7e8ac..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletRequest.java
+++ /dev/null
@@ -1,1367 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.mock;
-
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.io.*;
-import java.security.*;
-import java.util.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import org.apache.juneau.collections.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.util.*;
-import org.apache.juneau.rest.util.RestUtils;
-import org.apache.juneau.urlencoding.*;
-import org.apache.juneau.utils.*;
-
-/**
- * An implementation of {@link HttpServletRequest} for mocking purposes.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use <c>org.apache.juneau.restmock2</c>
- * </div>
- */
-@Deprecated
-public class MockServletRequest implements HttpServletRequest, MockHttpRequest
{
-
- private String method = "GET";
- private Map<String,String[]> queryData;
- private Map<String,String[]> formDataMap;
- private Map<String,String[]> headerMap = new LinkedHashMap<>();
- private Map<String,Object> attributeMap = new LinkedHashMap<>();
- private String characterEncoding = "UTF-8";
- private byte[] body = new byte[0];
- private String protocol = "HTTP/1.1";
- private String scheme = "http";
- private String serverName = "localhost";
- private int serverPort = 8080;
- private String remoteAddr = "";
- private String remoteHost = "";
- private Locale locale = Locale.ENGLISH;
- private String realPath;
- private int remotePort;
- private String localName;
- private String localAddr;
- private int localPort;
- private RequestDispatcher requestDispatcher;
- private ServletContext servletContext;
- private DispatcherType dispatcherType;
- private String authType;
- private Cookie[] cookies;
- private String pathInfo;
- private String pathTranslated;
- private String contextPath = "";
- private String queryString;
- private String remoteUser;
- private Principal userPrincipal;
- private String requestedSessionId;
- private String requestURI;
- private String servletPath = "";
- private HttpSession httpSession = MockHttpSession.create();
- private RestContext restContext;
- private String uri = "";
- private boolean debug = false;
-
- /**
- * Creates a new servlet request.
- *
- * Initialized with the following:
- * <ul>
- * <li><c>"Accept: text/json+simple"</c>
- * <li><c>"Content-Type: text/json"</c>
- * </ul>
- *
- * @return A new request.
- */
- public static MockServletRequest create() {
- MockServletRequest r = new MockServletRequest();
- return r;
- }
-
- /**
- * Creates a new servlet request with the specified method name and
request path.
- *
- * Initialized with the following:
- * <ul>
- * <li><c>"Accept: text/json+simple"</c>
- * <li><c>"Content-Type: text/json"</c>
- * </ul>
- *
- * @param method The HTTP method name.
- * @param path The request path.
- * @param pathArgs Optional path arguments.
- *
- * @return A new request.
- */
- public static MockServletRequest create(String method, String path,
Object...pathArgs) {
- return create()
- .method(method)
- .uri(StringUtils.format(path, pathArgs));
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"application/json"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest json() {
- return header("Accept",
"application/json").header("Content-Type", "application/json");
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"text/xml"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest xml() {
- return header("Accept", "text/xml").header("Content-Type",
"text/xml");
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"text/html"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest html() {
- return header("Accept", "text/html").header("Content-Type",
"text/html");
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"text/plain"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest plainText() {
- return header("Accept", "text/plain").header("Content-Type",
"text/plain");
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"octal/msgpack"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest msgpack() {
- return header("Accept", "octal/msgpack").header("Content-Type",
"octal/msgpack");
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"text/uon"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest uon() {
- return header("Accept", "text/uon").header("Content-Type",
"text/uon");
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"application/x-www-form-urlencoded"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest urlEnc() {
- return header("Accept",
"application/x-www-form-urlencoded").header("Content-Type",
"application/x-www-form-urlencoded");
- }
-
- /**
- * Convenience method for setting <c>Accept</c> and <c>Content-Type</c>
headers to <js>"text/yaml"</js>.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest yaml() {
- return header("Accept", "text/yaml").header("Content-Type",
"text/yaml");
- }
-
- /**
- * Fluent setter.
- *
- * @param uri The URI of the request.
- * @return This object (for method chaining).
- */
- @Override /* MockHttpRequest */
- public MockServletRequest uri(String uri) {
- this.uri = emptyIfNull(uri);
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param restContext The rest context.
- * @return This object (for method chaining).
- */
- public MockServletRequest restContext(RestContext restContext) {
- this.restContext = restContext;
- return this;
- }
-
- /**
- * Executes this request and returns the response object.
- *
- * @return The response object.
- * @throws Exception Error occurred.
- */
- @Override /* MockHttpRequest */
- public MockServletResponse execute() throws Exception {
- MockServletResponse res = MockServletResponse.create();
- restContext.execute(this, res);
-
- // If the status isn't set, something's broken.
- if (res.getStatus() == 0)
- throw new RuntimeException("Response status was 0.");
-
- if (debug)
- log(this, res);
-
- return res;
- }
-
- private void log(MockServletRequest req, MockServletResponse res) {
- StringBuilder sb = new StringBuilder();
- sb.append("\n=== HTTP Call
=================================================================");
-
- sb.append("\n=== REQUEST ===");
- sb.append("\nTODO");
- sb.append("\n=== RESPONSE ===");
- sb.append("\nStatus: ").append(res.getStatus());
- sb.append("\n---response headers---");
- for (Map.Entry<String,String[]> h : res.getHeaders().entrySet())
- for (String h2 : h.getValue())
- sb.append("\n").append(h.getKey()).append(":
").append(h2);
- sb.append("\n---response content---\n");
- sb.append(res.getBodyAsString());
- sb.append("\n=== END
========================================================================");
-
- System.err.println(sb); // NOT DEBUG
- }
-
- /**
- * Fluent setter.
- *
- * @param value The method name for this request.
- * @return This object (for method chaining).
- */
- @Override /* MockHttpRequest */
- public MockServletRequest method(String value) {
- this.method = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The character encoding.
- * @return This object (for method chaining).
- */
- public MockServletRequest characterEncoding(String value) {
- this.characterEncoding = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The protocol.
- * @return This object (for method chaining).
- */
- public MockServletRequest protocol(String value) {
- this.protocol = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The scheme.
- * @return This object (for method chaining).
- */
- public MockServletRequest scheme(String value) {
- this.scheme = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The server name.
- * @return This object (for method chaining).
- */
- public MockServletRequest serverName(String value) {
- this.serverName = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The server port.
- * @return This object (for method chaining).
- */
- public MockServletRequest serverPort(int value) {
- this.serverPort = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The remote address.
- * @return This object (for method chaining).
- */
- public MockServletRequest remoteAddr(String value) {
- this.remoteAddr = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The remote port.
- * @return This object (for method chaining).
- */
- public MockServletRequest remoteHost(String value) {
- this.remoteHost = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The locale.
- * @return This object (for method chaining).
- */
- public MockServletRequest locale(Locale value) {
- this.locale = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The real path.
- * @return This object (for method chaining).
- */
- public MockServletRequest realPath(String value) {
- this.realPath = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The remote port.
- * @return This object (for method chaining).
- */
- public MockServletRequest remotePort(int value) {
- this.remotePort = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The local name.
- * @return This object (for method chaining).
- */
- public MockServletRequest localName(String value) {
- this.localName = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The local address.
- * @return This object (for method chaining).
- */
- public MockServletRequest localAddr(String value) {
- this.localAddr = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The local port.
- * @return This object (for method chaining).
- */
- public MockServletRequest localPort(int value) {
- this.localPort = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The request dispatcher.
- * @return This object (for method chaining).
- */
- public MockServletRequest requestDispatcher(RequestDispatcher value) {
- this.requestDispatcher = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The servlet context.
- * @return This object (for method chaining).
- */
- public MockServletRequest servletContext(ServletContext value) {
- this.servletContext = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The dispatcher type.
- * @return This object (for method chaining).
- */
- public MockServletRequest dispatcherType(DispatcherType value) {
- this.dispatcherType = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The auth type.
- * @return This object (for method chaining).
- */
- public MockServletRequest authType(String value) {
- this.authType = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The cookies.
- * @return This object (for method chaining).
- */
- public MockServletRequest cookies(Cookie[] value) {
- this.cookies = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The path info.
- * @return This object (for method chaining).
- */
- public MockServletRequest pathInfo(String value) {
- this.pathInfo = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The path translated.
- * @return This object (for method chaining).
- */
- public MockServletRequest pathTranslated(String value) {
- this.pathTranslated = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The context path.
- * @return This object (for method chaining).
- */
- public MockServletRequest contextPath(String value) {
- this.contextPath = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The query string.
- * @return This object (for method chaining).
- */
- public MockServletRequest queryString(String value) {
- this.queryString = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The remote user.
- * @return This object (for method chaining).
- */
- public MockServletRequest remoteUser(String value) {
- this.remoteUser = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The user principal.
- * @return This object (for method chaining).
- */
- public MockServletRequest userPrincipal(Principal value) {
- this.userPrincipal = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The requested session ID.
- * @return This object (for method chaining).
- */
- public MockServletRequest requestedSessionId(String value) {
- this.requestedSessionId = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The request URI.
- * @return This object (for method chaining).
- */
- public MockServletRequest requestURI(String value) {
- this.requestURI = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The servlet path.
- * @return This object (for method chaining).
- */
- public MockServletRequest servletPath(String value) {
- this.servletPath = value;
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value The HTTP session.
- * @return This object (for method chaining).
- */
- public MockServletRequest httpSession(HttpSession value) {
- this.httpSession = value;
- return this;
- }
-
- @Override /* HttpServletRequest */
- public Object getAttribute(String name) {
- return attributeMap.get(name);
- }
-
- @Override /* HttpServletRequest */
- public Enumeration<String> getAttributeNames() {
- return Collections.enumeration(attributeMap.keySet());
- }
-
- @Override /* HttpServletRequest */
- public String getCharacterEncoding() {
- return characterEncoding;
- }
-
- @Override /* HttpServletRequest */
- public void setCharacterEncoding(String characterEncoding) throws
UnsupportedEncodingException {
- this.characterEncoding = characterEncoding;
- }
-
- @Override /* HttpServletRequest */
- public int getContentLength() {
- return body == null ? 0 : body.length;
- }
-
- @Override /* HttpServletRequest */
- public long getContentLengthLong() {
- return body == null ? 0 : body.length;
- }
-
- @Override /* HttpServletRequest */
- public String getContentType() {
- return getHeader("Content-Type");
- }
-
- @Override /* HttpServletRequest */
- public ServletInputStream getInputStream() throws IOException {
- if (formDataMap != null)
- body =
UrlEncodingSerializer.DEFAULT.toString(formDataMap).getBytes();
- return new BoundedServletInputStream(new
ByteArrayInputStream(body), Integer.MAX_VALUE);
- }
-
- @Override /* HttpServletRequest */
- public String getParameter(String name) {
- String[] s = getParameterMap().get(name);
- return s == null || s.length == 0 ? null : s[0];
- }
-
- @Override /* HttpServletRequest */
- public Enumeration<String> getParameterNames() {
- return Collections.enumeration(new
ArrayList<>(getParameterMap().keySet()));
- }
-
- @Override /* HttpServletRequest */
- public String[] getParameterValues(String name) {
- return getParameterMap().get(name);
- }
-
- @Override /* HttpServletRequest */
- public Map<String,String[]> getParameterMap() {
- if (queryData == null) {
- try {
- if ("POST".equalsIgnoreCase(method)) {
- if (formDataMap != null)
- queryData = formDataMap;
- else
- queryData =
RestUtils.parseQuery(IOUtils.read(body));
- } else {
- queryData =
RestUtils.parseQuery(getQueryString());
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- return queryData;
- }
-
- @Override /* HttpServletRequest */
- public String getProtocol() {
- return protocol;
- }
-
- @Override /* HttpServletRequest */
- public String getScheme() {
- return scheme;
- }
-
- @Override /* HttpServletRequest */
- public String getServerName() {
- return serverName;
- }
-
- @Override /* HttpServletRequest */
- public int getServerPort() {
- return serverPort;
- }
-
- @Override /* HttpServletRequest */
- public BufferedReader getReader() throws IOException {
- return new BufferedReader(new
InputStreamReader(getInputStream(), characterEncoding));
- }
-
- @Override /* HttpServletRequest */
- public String getRemoteAddr() {
- return remoteAddr;
- }
-
- @Override /* HttpServletRequest */
- public String getRemoteHost() {
- return remoteHost;
- }
-
- @Override /* HttpServletRequest */
- public void setAttribute(String name, Object o) {
- this.attributeMap.put(name, o);
- }
-
- @Override /* HttpServletRequest */
- public void removeAttribute(String name) {
- this.attributeMap.remove(name);
- }
-
- @Override /* HttpServletRequest */
- public Locale getLocale() {
- return locale;
- }
-
- @Override /* HttpServletRequest */
- public Enumeration<Locale> getLocales() {
- return Collections.enumeration(Arrays.asList(locale));
- }
-
- @Override /* HttpServletRequest */
- public boolean isSecure() {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public RequestDispatcher getRequestDispatcher(String path) {
- return requestDispatcher;
- }
-
- @Override /* HttpServletRequest */
- public String getRealPath(String path) {
- return realPath;
- }
-
- @Override /* HttpServletRequest */
- public int getRemotePort() {
- return remotePort;
- }
-
- @Override /* HttpServletRequest */
- public String getLocalName() {
- return localName;
- }
-
- @Override /* HttpServletRequest */
- public String getLocalAddr() {
- return localAddr;
- }
-
- @Override /* HttpServletRequest */
- public int getLocalPort() {
- return localPort;
- }
-
- @Override /* HttpServletRequest */
- public ServletContext getServletContext() {
- return servletContext;
- }
-
- @Override /* HttpServletRequest */
- public AsyncContext startAsync() throws IllegalStateException {
- return null;
- }
-
- @Override /* HttpServletRequest */
- public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse) throws IllegalStateException {
- return null;
- }
-
- @Override /* HttpServletRequest */
- public boolean isAsyncStarted() {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public boolean isAsyncSupported() {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public AsyncContext getAsyncContext() {
- return null;
- }
-
- @Override /* HttpServletRequest */
- public DispatcherType getDispatcherType() {
- return dispatcherType;
- }
-
- @Override /* HttpServletRequest */
- public String getAuthType() {
- return authType;
- }
-
- @Override /* HttpServletRequest */
- public Cookie[] getCookies() {
- return cookies;
- }
-
- @Override /* HttpServletRequest */
- public long getDateHeader(String name) {
- String s = getHeader(name);
- return s == null ? 0 :
org.apache.juneau.http.header.Date.of(s).asZonedDateTime().toInstant().toEpochMilli();
- }
-
- @Override /* HttpServletRequest */
- public String getHeader(String name) {
- String[] s = headerMap.get(name);
- return s == null || s.length == 0 ? null : s[0];
- }
-
- @Override /* HttpServletRequest */
- public Enumeration<String> getHeaders(String name) {
- String[] s = headerMap.get(name);
- return Collections.enumeration(Arrays.asList(s == null ? new
String[0] : s));
- }
-
- @Override /* HttpServletRequest */
- public Enumeration<String> getHeaderNames() {
- return Collections.enumeration(headerMap.keySet());
- }
-
- @Override /* HttpServletRequest */
- public int getIntHeader(String name) {
- String s = getHeader(name);
- return s == null || s.isEmpty() ? 0 : Integer.parseInt(s);
- }
-
- @Override /* HttpServletRequest */
- public String getMethod() {
- return method;
- }
-
- @Override /* HttpServletRequest */
- public String getPathInfo() {
- if (pathInfo == null) {
- pathInfo = getRequestURI();
- if (isNotEmpty(contextPath))
- pathInfo =
pathInfo.substring(contextPath.length());
- if (isNotEmpty(servletPath))
- pathInfo =
pathInfo.substring(servletPath.length());
- }
- return nullIfEmpty(urlDecode(pathInfo));
- }
-
- @Override /* HttpServletRequest */
- public String getPathTranslated() {
- if (pathTranslated == null)
- pathTranslated = "/mock-path" + getPathInfo();
- return pathTranslated;
- }
-
- @Override /* HttpServletRequest */
- public String getContextPath() {
- return contextPath;
- }
-
- @Override /* HttpServletRequest */
- public String getQueryString() {
- if (queryString == null) {
- queryString = "";
- if (uri.indexOf('?') != -1) {
- queryString = uri.substring(uri.indexOf('?') +
1);
- if (queryString.indexOf('#') != -1)
- queryString = queryString.substring(0,
queryString.indexOf('#'));
- }
- }
- return isEmpty(queryString) ? null : queryString;
- }
-
- @Override /* HttpServletRequest */
- public String getRemoteUser() {
- return remoteUser;
- }
-
- @Override /* HttpServletRequest */
- public boolean isUserInRole(String role) {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public Principal getUserPrincipal() {
- return userPrincipal;
- }
-
- @Override /* HttpServletRequest */
- public String getRequestedSessionId() {
- return requestedSessionId;
- }
-
- @Override /* HttpServletRequest */
- public String getRequestURI() {
- if (requestURI == null) {
- requestURI = uri;
- requestURI =
requestURI.replaceAll("^\\w+\\:\\/\\/[^\\/]+", "").replaceAll("\\?.*$", "");
- }
- return requestURI;
- }
-
- @Override /* HttpServletRequest */
- public StringBuffer getRequestURL() {
- return new StringBuffer(uri.replaceAll("\\?.*$", ""));
- }
-
- @Override /* HttpServletRequest */
- public String getServletPath() {
- return servletPath;
- }
-
- @Override /* HttpServletRequest */
- public HttpSession getSession(boolean create) {
- return httpSession;
- }
-
- @Override /* HttpServletRequest */
- public HttpSession getSession() {
- return httpSession;
- }
-
- @Override /* HttpServletRequest */
- public String changeSessionId() {
- return null;
- }
-
- @Override /* HttpServletRequest */
- public boolean isRequestedSessionIdValid() {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public boolean isRequestedSessionIdFromCookie() {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public boolean isRequestedSessionIdFromURL() {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public boolean isRequestedSessionIdFromUrl() {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public boolean authenticate(HttpServletResponse response) throws
IOException, ServletException {
- return false;
- }
-
- @Override /* HttpServletRequest */
- public void login(String username, String password) throws
ServletException {
- }
-
- @Override /* HttpServletRequest */
- public void logout() throws ServletException {
- }
-
- @Override /* HttpServletRequest */
- public Collection<Part> getParts() throws IOException, ServletException
{
- return null;
- }
-
- @Override /* HttpServletRequest */
- public Part getPart(String name) throws IOException, ServletException {
- return null;
- }
-
- @Override /* HttpServletRequest */
- public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass)
throws IOException, ServletException {
- return null;
- }
-
-
//=================================================================================================================
- // Convenience methods
-
//=================================================================================================================
-
- /**
- * Fluent setter.
- *
- * @param name Header name.
- * @param value
- * Header value.
- * <br>The value is converted to a simple string using {@link
Object#toString()}.
- * @return This object (for method chaining).
- */
- @Override /* MockHttpRequest */
- public MockServletRequest header(String name, Object value) {
- this.headerMap.put(name, new String[] {stringify(value)});
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param name Request attribute name.
- * @param value Request attribute value.
- * @return This object (for method chaining).
- */
- public MockServletRequest attribute(String name, Object value) {
- this.attributeMap.put(name, value);
- return this;
- }
-
- /**
- * Fluent setter.
- *
- * @param value
- * The body of the request.
- * <br>Can be any of the following data types:
- * <ul>
- * <li><code><jk>byte</jk>[]</code>
- * <li>{@link Reader}
- * <li>{@link InputStream}
- * <li>{@link CharSequence}
- * </ul>
- * @return This object (for method chaining).
- */
- @Override /* MockHttpRequest */
- public MockServletRequest body(Object value) {
- try {
- if (value instanceof byte[])
- this.body = (byte[])value;
- if (value instanceof Reader)
- this.body =
IOUtils.read((Reader)value).getBytes();
- if (value instanceof InputStream)
- this.body =
IOUtils.readBytes((InputStream)value, 1024);
- if (value instanceof CharSequence)
- this.body =
((CharSequence)value).toString().getBytes();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- return this;
- }
-
- /**
- * Adds a form data entry to this request.
- *
- * @param key The form data key.
- * @param value The form data value.
- * <br>The value is converted to a simple string using {@link
Object#toString()}.
- * @return This object (for method chaining).
- */
- public MockServletRequest formData(String key, Object value) {
- if (formDataMap == null)
- formDataMap = new LinkedHashMap<>();
- String s = stringify(value);
- String[] existing = formDataMap.get(key);
- if (existing == null)
- existing = new String[]{s};
- else
- existing =
AList.of(existing).a(s).asArrayOf(String.class);
- formDataMap.put(key, existing);
- return this;
- }
-
- /**
- * Adds a query data entry to this request.
- *
- * @param key The query key.
- * @param value The query value.
- * <br>The value is converted to a simple string using {@link
Object#toString()}.
- * @return This object (for method chaining).
- */
- public MockServletRequest query(String key, Object value) {
- if (queryData == null)
- queryData = new LinkedHashMap<>();
- String s = stringify(value);
- String[] existing = queryData.get(key);
- if (existing == null)
- existing = new String[]{s};
- else
- existing =
AList.of(existing).a(s).asArrayOf(String.class);
- queryData.put(key, existing);
- return this;
- }
-
-
//=================================================================================================================
- // Convenience methods - headers
-
//=================================================================================================================
-
- /**
- * Specifies the <c>Accept</c> header value on the request.
- *
- * @param value The new value.
- * @return This object (for method chaining).
- */
- public MockServletRequest accept(Object value) {
- return header("Accept", value);
- }
-
- /**
- * Specifies the <c>Accept-Charset</c> header value on the request.
- *
- * @param value The new value.
- * @return This object (for method chaining).
- */
- public MockServletRequest acceptCharset(Object value) {
- return header("Accept-Charset", value);
- }
-
- /**
- * Specifies the <c>Accept-Encoding</c> header value on the request.
- *
- * @param value The new value.
- * @return This object (for method chaining).
- */
- public MockServletRequest acceptEncoding(Object value) {
- return header("Accept-Encoding", value);
- }
-
- /**
- * Specifies the <c>Accept-Language</c> header value on the request.
- *
- * @param value The new value.
- * @return This object (for method chaining).
- */
- public MockServletRequest acceptLanguage(Object value) {
- return header("Accept-Language", value);
- }
-
- /**
- * Specifies the <c>Authorization</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest authorization(Object value) {
- return header("Authorization", value);
- }
-
- /**
- * Specifies the <c>Cache-Control</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest cacheControl(Object value) {
- return header("Cache-Control", value);
- }
-
- /**
- * Specifies the <c>X-Client-Version</c> header value on the request.
- *
- * @param value The new value.
- * @return This object (for method chaining).
- */
- public MockServletRequest clientVersion(Object value) {
- return header("X-Client-Version", value);
- }
-
- /**
- * Specifies the <c>Connection</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest connection(Object value) {
- return header("Connection", value);
- }
-
- /**
- * Specifies the <c>Content-Encoding</c> header value on the request.
- *
- * @param value The new value.
- * @return This object (for method chaining).
- */
- public MockServletRequest contentEncoding(Object value) {
- return header("Content-Encoding", value);
- }
-
- /**
- * Specifies the <c>Content-Length</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest contentLength(Object value) {
- return header("Content-Length", value);
- }
-
- /**
- * Specifies the <c>Content-Type</c> header value on the request.
- *
- * @param value The new value.
- * @return This object (for method chaining).
- */
- public MockServletRequest contentType(Object value) {
- return header("Content-Type", value);
- }
-
- /**
- * Specifies the <c>Date</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest date(Object value) {
- return header("Date", value);
- }
-
- /**
- * Specifies the <c>Expect</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest expect(Object value) {
- return header("Expect", value);
- }
-
- /**
- * Specifies the <c>From</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest from(Object value) {
- return header("From", value);
- }
-
- /**
- * Specifies the <c>Host</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest host(Object value) {
- return header("Host", value);
- }
-
- /**
- * Specifies the <c>If-Match</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest ifMatch(Object value) {
- return header("If-Match", value);
- }
-
- /**
- * Specifies the <c>If-Modified-Since</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest ifModifiedSince(Object value) {
- return header("If-Modified-Since", value);
- }
-
- /**
- * Specifies the <c>If-None-Match</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest ifNoneMatch(Object value) {
- return header("If-None-Match", value);
- }
-
- /**
- * Specifies the <c>If-Range</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest ifRange(Object value) {
- return header("If-Range", value);
- }
-
- /**
- * Specifies the <c>If-Unmodified-Since</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest ifUnmodifiedSince(Object value) {
- return header("If-Unmodified-Since", value);
- }
-
- /**
- * Specifies the <c>Max-Forwards</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest maxForwards(Object value) {
- return header("Max-Forwards", value);
- }
-
- /**
- * Specifies the <c>Pragma</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest pragma(Object value) {
- return header("Pragma", value);
- }
-
- /**
- * Specifies the <c>Proxy-Authorization</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest proxyAuthorization(Object value) {
- return header("Proxy-Authorization", value);
- }
-
- /**
- * Specifies the <c>Range</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest range(Object value) {
- return header("Range", value);
- }
-
- /**
- * Specifies the <c>Referer</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest referer(Object value) {
- return header("Referer", value);
- }
-
- /**
- * Specifies the <c>TE</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest te(Object value) {
- return header("TE", value);
- }
-
- /**
- * Specifies the <c>Upgrade</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest upgrade(Object value) {
- return header("Upgrade", value);
- }
-
- /**
- * Specifies the <c>User-Agent</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest userAgent(Object value) {
- return header("User-Agent", value);
- }
-
- /**
- * Specifies the <c>Warning</c> header value on the request.
- *
- * @param value The new value for the header.
- * @return This object (for method chaining).
- */
- public MockServletRequest warning(Object value) {
- return header("Warning", value);
- }
-
- /**
- * Enabled debug mode on this request.
- *
- * <p>
- * Causes information about the request execution to be sent to STDERR.
- *
- * @return This object (for method chaining).
- */
- public MockServletRequest debug() {
- this.debug = true;
- return this;
- }
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
deleted file mode 100644
index 7aef5e1..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
+++ /dev/null
@@ -1,417 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.mock;
-
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-import java.util.regex.*;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-import org.apache.juneau.internal.*;
-import org.apache.juneau.rest.util.*;
-import org.apache.juneau.utils.*;
-
-/**
- * An implementation of {@link HttpServletResponse} for mocking purposes.
- *
- * <div class='warn'>
- * <b>Deprecated</b> - Use <c>org.apache.juneau.restmock2</c>
- * </div>
- */
-@Deprecated
-public class MockServletResponse implements HttpServletResponse,
MockHttpResponse {
-
- private String characterEncoding = "UTF-8";
- private ByteArrayOutputStream baos = new ByteArrayOutputStream();
- private long contentLength = 0;
- private int bufferSize = 0;
- private Locale locale;
- private int sc;
- private String msg;
- private Map<String,String[]> headerMap = new LinkedHashMap<>();
-
-
- /**
- * Creates a new servlet response.
- *
- * @return A new response.
- */
- public static MockServletResponse create() {
- return new MockServletResponse();
- }
-
- /**
- * Returns the content length.
- *
- * @return The content length.
- */
- public long getContentLength() {
- return contentLength;
- }
-
- /**
- * Returns the response message.
- *
- * @return The response message.
- */
- @Override /* MockHttpResponse */
- public String getMessage() {
- return msg;
- }
-
- @Override /* HttpServletResponse */
- public String getCharacterEncoding() {
- return characterEncoding ;
- }
-
- @Override /* HttpServletResponse */
- public String getContentType() {
- return getHeader("Content-Type");
- }
-
- @Override /* HttpServletResponse */
- public ServletOutputStream getOutputStream() throws IOException {
- return new FinishableServletOutputStream(baos);
- }
-
- @Override /* HttpServletResponse */
- public PrintWriter getWriter() throws IOException {
- return new PrintWriter(new
OutputStreamWriter(getOutputStream(), characterEncoding));
- }
-
- @Override /* HttpServletResponse */
- public void setCharacterEncoding(String charset) {
- this.characterEncoding = charset;
- }
-
- @Override /* HttpServletResponse */
- public void setContentLength(int len) {
- this.contentLength = len;
- }
-
- @Override /* HttpServletResponse */
- public void setContentLengthLong(long len) {
- this.contentLength = len;
- }
-
- @Override /* HttpServletResponse */
- public void setContentType(String type) {
- setHeader("Content-Type", type);
- }
-
- @Override /* HttpServletResponse */
- public void setBufferSize(int size) {
- this.bufferSize = size;
- }
-
- @Override /* HttpServletResponse */
- public int getBufferSize() {
- return bufferSize;
- }
-
- @Override /* HttpServletResponse */
- public void flushBuffer() throws IOException {
- }
-
- @Override /* HttpServletResponse */
- public void resetBuffer() {
- }
-
- @Override /* HttpServletResponse */
- public boolean isCommitted() {
- return false;
- }
-
- @Override /* HttpServletResponse */
- public void reset() {
- }
-
- @Override /* HttpServletResponse */
- public void setLocale(Locale loc) {
- this.locale = loc;
- }
-
- @Override /* HttpServletResponse */
- public Locale getLocale() {
- return locale;
- }
-
- @Override /* HttpServletResponse */
- public void addCookie(Cookie cookie) {
- }
-
- @Override /* HttpServletResponse */
- public boolean containsHeader(String name) {
- return getHeader(name) != null;
- }
-
- @Override /* HttpServletResponse */
- public String encodeURL(String url) {
- return null;
- }
-
- @Override /* HttpServletResponse */
- public String encodeRedirectURL(String url) {
- return null;
- }
-
- @Override /* HttpServletResponse */
- public String encodeUrl(String url) {
- return null;
- }
-
- @Override /* HttpServletResponse */
- public String encodeRedirectUrl(String url) {
- return null;
- }
-
- @Override /* HttpServletResponse */
- public void sendError(int sc, String msg) throws IOException {
- this.sc = sc;
- this.msg = msg;
- }
-
- @Override /* HttpServletResponse */
- public void sendError(int sc) throws IOException {
- this.sc = sc;
- }
-
- @Override /* HttpServletResponse */
- public void sendRedirect(String location) throws IOException {
- this.sc = 302;
- headerMap.put("Location", new String[] {location});
- }
-
- @Override /* HttpServletResponse */
- public void setDateHeader(String name, long date) {
- headerMap.put(name, new String[] {DateUtils.formatDate(new
Date(date), DateUtils.PATTERN_RFC1123)});
- }
-
- @Override /* HttpServletResponse */
- public void addDateHeader(String name, long date) {
- headerMap.put(name, new String[] {DateUtils.formatDate(new
Date(date), DateUtils.PATTERN_RFC1123)});
- }
-
- @Override /* HttpServletResponse */
- public void setHeader(String name, String value) {
- headerMap.put(name, new String[] {value});
- }
-
- @Override /* HttpServletResponse */
- public void addHeader(String name, String value) {
- headerMap.put(name, new String[] {value});
- }
-
- @Override /* HttpServletResponse */
- public void setIntHeader(String name, int value) {
- headerMap.put(name, new String[] {String.valueOf(value)});
- }
-
- @Override /* HttpServletResponse */
- public void addIntHeader(String name, int value) {
- headerMap.put(name, new String[] {String.valueOf(value)});
- }
-
- @Override /* HttpServletResponse */
- public void setStatus(int sc) {
- this.sc = sc;
- }
-
- @Override /* HttpServletResponse */
- public void setStatus(int sc, String sm) {
- this.sc = sc;
- this.msg = sm;
- }
-
- @Override /* HttpServletResponse */
- public int getStatus() {
- return sc;
- }
-
- @Override /* HttpServletResponse */
- public String getHeader(String name) {
- String[] s = headerMap.get(name);
- return s == null || s.length == 0 ? null : s[0];
- }
-
- @Override /* HttpServletResponse */
- public Collection<String> getHeaders(String name) {
- String[] s = headerMap.get(name);
- return s == null ? Collections.emptyList() : Arrays.asList(s);
- }
-
- @Override /* HttpServletResponse */
- public Collection<String> getHeaderNames() {
- return headerMap.keySet();
- }
-
- /**
- * Returns the body of the request as a string.
- *
- * @return The body of the request as a string.
- */
- public String getBodyAsString() {
- try {
- return baos.toString("UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Throws an {@link AssertionError} if the response status does not
match the expected status.
- *
- * @param status The expected status.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if status does not match.
- */
- public MockServletResponse assertStatus(int status) throws
AssertionError {
- if (getStatus() != status)
- throw new MockAssertionError("Response did not have the
expected status.\n\tExpected=[{0}]\n\tActual=[{1}]", status, getStatus());
- return this;
- }
-
- /**
- * Throws an {@link AssertionError} if the response body does not
contain the expected text.
- *
- * @param text The expected text of the body.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if the body does not contain the
expected text.
- */
- public MockServletResponse assertBody(String text) throws
AssertionError {
- if (! StringUtils.isEquals(text, getBodyAsString()))
- throw new MockAssertionError("Response did not have the
expected text.\n\tExpected=[{0}]\n\tActual=[{1}]", text, getBodyAsString());
- return this;
- }
-
- /**
- * Throws an {@link AssertionError} if the response body does not
contain all of the expected substrings.
- *
- * @param substrings The expected substrings.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if the body does not contain one or
more of the expected substrings.
- */
- public MockServletResponse assertBodyContains(String...substrings)
throws AssertionError {
- String text = getBodyAsString();
- for (String substring : substrings)
- if (! contains(text, substring))
- throw new MockAssertionError("Response did not
have the expected substring.\n\tExpected=[{0}]\n\tBody=[{1}]", substring, text);
- return this;
- }
-
- /**
- * Throws an {@link AssertionError} if the response body does not match
the specified pattern.
- *
- * <p>
- * A pattern is a simple string containing <js>"*"</js> to represent
zero or more arbitrary characters.
- *
- * @param pattern The pattern to match against.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if the body does not match the
specified pattern.
- */
- public MockServletResponse assertBodyMatches(String pattern) throws
AssertionError {
- String text = getBodyAsString();
- if (! getMatchPattern(pattern).matcher(text).matches())
- throw new MockAssertionError("Response did not match
expected pattern.\n\tPattern=[{0}]\n\tBody=[{1}]", pattern, text);
- return this;
- }
-
- /**
- * Throws an {@link AssertionError} if the response body does not match
the specified regular expression.
- *
- * <p>
- * A pattern is a simple string containing <js>"*"</js> to represent
zero or more arbitrary characters.
- *
- * @param regExp The regular expression to match against.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if the body does not match the
specified regular expression.
- */
- public MockServletResponse assertBodyMatchesRE(String regExp) throws
AssertionError {
- String text = getBodyAsString();
- if (! Pattern.compile(regExp).matcher(text).matches())
- throw new MockAssertionError("Response did not match
expected regular expression.\n\tRegExp=[{0}]\n\tBody=[{1}]", regExp, text);
- return this;
- }
-
- /**
- * Throws an {@link AssertionError} if the response does not contain
the expected character encoding.
- *
- * @param value The expected character encoding.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if the response does not contain the
expected character encoding.
- */
- public MockServletResponse assertCharset(String value) {
- if (! StringUtils.isEquals(value, getCharacterEncoding()))
- throw new MockAssertionError("Response did not have the
expected character encoding.\n\tExpected=[{0}]\n\tActual=[{1}]", value,
getBodyAsString());
- return this;
- }
-
- /**
- * Throws an {@link AssertionError} if the response does not contain
the expected header value.
- *
- * @param name The header name.
- * @param value The expected header value.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if the response does not contain the
expected header value.
- */
- public MockServletResponse assertHeader(String name, String value) {
- if (! StringUtils.isEquals(value, getHeader(name)))
- throw new MockAssertionError("Response did not have the
expected value for header {0}.\n\tExpected=[{1}]\n\tActual=[{2}]", name, value,
getHeader(name));
- return this;
- }
-
- /**
- * Throws an {@link AssertionError} if the response header does not
contain all of the expected substrings.
- *
- * @param name The header name.
- * @param substrings The expected substrings.
- * @return This object (for method chaining).
- * @throws AssertionError Thrown if the header does not contain one or
more of the expected substrings.
- */
- public MockServletResponse assertHeaderContains(String name,
String...substrings) {
- String text = getHeader(name);
- for (String substring : substrings)
- if (! contains(text, substring))
- throw new MockAssertionError("Response did not
have the expected substring in header {0}.\n\tExpected=[{1}]\n\tHeader=[{2}]",
name, substring, text);
- return this;
- }
-
- /**
- * Returns the body of the request.
- *
- * @return The body of the request.
- */
- @Override /* MockHttpResponse */
- public byte[] getBody() {
- return baos.toByteArray();
- }
-
- @Override /* MockHttpResponse */
- public Map<String,String[]> getHeaders() {
- return headerMap;
- }
-
- private static class MockAssertionError extends AssertionError {
- private static final long serialVersionUID = 1L;
-
- MockAssertionError(String msg, Object...args) {
- super(MessageFormat.format(msg, args));
- System.err.println(getMessage()); // NOT DEBUG
- }
- }
-}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/package-info.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/package-info.java
deleted file mode 100644
index ba27d99..0000000
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/***************************************************************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file
- * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- *
-
***************************************************************************************************************************/
-
-/**
- * REST Server Mock API
- */
-package org.apache.juneau.rest.mock;
\ No newline at end of file