File tree Expand file tree Collapse file tree 6 files changed +68
-1
lines changed
plugin-api/src/main/java/org/sonar/api/server/http Expand file tree Collapse file tree 6 files changed +68
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ public interface HttpRequest {
6666 */
6767 String getQueryString ();
6868
69+ /**
70+ * Returns the portion of the request URI that indicates the context of the request. The context path always comes first
71+ * in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the
72+ * default (root) context, this method returns "". The container does not decode this string.
73+ */
74+ String getContextPath ();
75+
6976 /**
7077 * Returns the value of a request parameter as a String, or null if the parameter does not exist.
7178 * You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value,
@@ -74,7 +81,7 @@ public interface HttpRequest {
7481 String getParameter (String name );
7582
7683 /**
77- * Returns an array containing all of the values the given request parameter has, or null if the parameter does not exist.
84+ * Returns an array containing all the values the given request parameter has, or null if the parameter does not exist.
7885 */
7986 String [] getParameterValues (String name );
8087
Original file line number Diff line number Diff line change 2020package org .sonar .api .server .http ;
2121
2222import java .io .IOException ;
23+ import java .io .PrintWriter ;
2324import java .util .Collection ;
2425
2526/**
@@ -55,6 +56,23 @@ public interface HttpResponse {
5556 */
5657 int getStatus ();
5758
59+ /**
60+ * Sets the content type of the response being sent to the client, if the response has not been committed yet.
61+ */
62+ void setContentType (String contentType );
63+
64+ /**
65+ * Returns a <code>PrintWriter</code> object that can send character text to the client. Calling flush()
66+ * on the <code>PrintWriter</code> commits the response.
67+ */
68+ PrintWriter getWriter () throws IOException ;
69+
70+ /**
71+ * Sets a response header with the given name and value. If the header had already been set, the new value overwrites
72+ * the previous one.
73+ */
74+ void setHeader (String name , String value );
75+
5876 /**
5977 * Sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer.
6078 * The buffer will be replaced with the data set by this method.
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ public String getQueryString() {
6868 return delegate .getQueryString ();
6969 }
7070
71+ @ Override
72+ public String getContextPath () {
73+ return delegate .getContextPath ();
74+ }
75+
7176 @ Override
7277 public String getParameter (String name ) {
7378 return delegate .getParameter (name );
Original file line number Diff line number Diff line change 2121
2222import jakarta .servlet .http .HttpServletResponse ;
2323import java .io .IOException ;
24+ import java .io .PrintWriter ;
2425import java .util .Collection ;
2526
2627/**
@@ -59,6 +60,21 @@ public int getStatus() {
5960 return delegate .getStatus ();
6061 }
6162
63+ @ Override
64+ public void setContentType (String contentType ) {
65+ delegate .setContentType (contentType );
66+ }
67+
68+ @ Override
69+ public PrintWriter getWriter () throws IOException {
70+ return delegate .getWriter ();
71+ }
72+
73+ @ Override
74+ public void setHeader (String name , String value ) {
75+ delegate .setHeader (name , value );
76+ }
77+
6278 @ Override
6379 public void sendRedirect (String location ) throws IOException {
6480 delegate .sendRedirect (location );
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ public String getQueryString() {
6868 return delegate .getQueryString ();
6969 }
7070
71+ @ Override
72+ public String getContextPath () {
73+ return delegate .getContextPath ();
74+ }
75+
7176 @ Override
7277 public String getParameter (String name ) {
7378 return delegate .getParameter (name );
Original file line number Diff line number Diff line change 2020package org .sonar .api .server .http ;
2121
2222import java .io .IOException ;
23+ import java .io .PrintWriter ;
2324import java .util .Collection ;
2425import javax .servlet .http .HttpServletResponse ;
2526
@@ -59,6 +60,21 @@ public int getStatus() {
5960 return delegate .getStatus ();
6061 }
6162
63+ @ Override
64+ public void setContentType (String contentType ) {
65+ delegate .setContentType (contentType );
66+ }
67+
68+ @ Override
69+ public PrintWriter getWriter () throws IOException {
70+ return delegate .getWriter ();
71+ }
72+
73+ @ Override
74+ public void setHeader (String name , String value ) {
75+ delegate .setHeader (name , value );
76+ }
77+
6278 @ Override
6379 public void sendRedirect (String location ) throws IOException {
6480 delegate .sendRedirect (location );
You can’t perform that action at this time.
0 commit comments