Class OAuthServlet

java.lang.Object
net.oauth.server.OAuthServlet

public class OAuthServlet extends Object
Utility methods for servlets that implement OAuth.
Author:
John Kristian
Implementation Note:
Copied from net.oauth.core:oauth-provider to make it Jakarta compatible
  • Constructor Details

    • OAuthServlet

      public OAuthServlet()
  • Method Details

    • getMessage

      public static net.oauth.OAuthMessage getMessage(jakarta.servlet.http.HttpServletRequest request, String URL)
      Extract the parts of the given request that are relevant to OAuth. Parameters include OAuth Authorization headers and the usual request parameters in the query string and/or form encoded body. The header parameters come first, followed by the rest in the order they came from request.getParameterMap().
      Parameters:
      URL - the official URL of this service; that is the URL a legitimate client would use to compute the digital signature. If this parameter is null, this method will try to reconstruct the URL from the HTTP request; which may be wrong in some cases.
    • getRequestURL

      public static String getRequestURL(jakarta.servlet.http.HttpServletRequest request)
      Reconstruct the requested URL, complete with query string (if any).
    • handleException

      public static void handleException(jakarta.servlet.http.HttpServletResponse response, Exception e, String realm) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • handleException

      public static void handleException(jakarta.servlet.http.HttpServletResponse response, Exception e, String realm, boolean sendBody) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • sendForm

      public static void sendForm(jakarta.servlet.http.HttpServletResponse response, Iterable<? extends Map.Entry> parameters) throws IOException
      Send the given parameters as a form-encoded response body.
      Throws:
      IOException
    • htmlEncode

      public static String htmlEncode(String s)
      Return the HTML representation of the given plain text. Characters that would have special significance in HTML are replaced by character entity references. Whitespace is not converted.