Package net.oauth.server
Class OAuthServlet
java.lang.Object
net.oauth.server.OAuthServlet
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.oauth.OAuthMessage
getMessage
(jakarta.servlet.http.HttpServletRequest request, String URL) Extract the parts of the given request that are relevant to OAuth.static String
getRequestURL
(jakarta.servlet.http.HttpServletRequest request) Reconstruct the requested URL, complete with query string (if any).static void
handleException
(jakarta.servlet.http.HttpServletResponse response, Exception e, String realm) static void
handleException
(jakarta.servlet.http.HttpServletResponse response, Exception e, String realm, boolean sendBody) static String
htmlEncode
(String s) Return the HTML representation of the given plain text.static void
sendForm
(jakarta.servlet.http.HttpServletResponse response, Iterable<? extends Map.Entry> parameters) Send the given parameters as a form-encoded response body.
-
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
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
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.
-