repository_name
string | func_path_in_repository
string | func_name
string | whole_func_string
string | language
string | func_code_string
string | func_code_tokens
sequence | func_documentation_string
string | func_documentation_tokens
sequence | split_name
string | func_code_url
string | prediction
string | prepared_prompt
string | func_def
string |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
airomem/airomem | airomem-chatsample/airomem-chatsample-web/src/main/java/pl/setblack/chatsample/servlet/ChatServlet.java | ChatServlet.processRequest | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
if (!request.getServletPath().endsWith("insecure")) {
response.addHeader("Content-Security-Policy", buildCSPHeader());
}
request.getRequestDispatcher("WEB-INF/chatq.jspx").forward(request, response);
} | java | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
if (!request.getServletPath().endsWith("insecure")) {
response.addHeader("Content-Security-Policy", buildCSPHeader());
}
request.getRequestDispatcher("WEB-INF/chatq.jspx").forward(request, response);
} | [
"protected",
"void",
"processRequest",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"response",
".",
"setContentType",
"(",
"\"text/html;charset=UTF-8\"",
")",
";",
"if",
"(",
"!",
"request",
".",
"getServletPath",
"(",
")",
".",
"endsWith",
"(",
"\"insecure\"",
")",
")",
"{",
"response",
".",
"addHeader",
"(",
"\"Content-Security-Policy\"",
",",
"buildCSPHeader",
"(",
")",
")",
";",
"}",
"request",
".",
"getRequestDispatcher",
"(",
"\"WEB-INF/chatq.jspx\"",
")",
".",
"forward",
"(",
"request",
",",
"response",
")",
";",
"}"
] | Processes requests for both HTTP <code>GET</code> and <code>POST</code>
methods.
@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs | [
"Processes",
"requests",
"for",
"both",
"HTTP",
"<code",
">",
"GET<",
"/",
"code",
">",
"and",
"<code",
">",
"POST<",
"/",
"code",
">",
"methods",
"."
] | train | https://github.com/airomem/airomem/blob/281ce18ff64836fccfb0edab18b8d677f1101a32/airomem-chatsample/airomem-chatsample-web/src/main/java/pl/setblack/chatsample/servlet/ChatServlet.java#L30-L37 | <|begin▁of▁sentence|>protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
"""
Processes requests for both HTTP <code>GET</code> and <code>POST</code>
methods.
@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs
"""
response.setContentType("text/html;charset=UTF-8");
final PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet Showcase</title>");
out.println("</head>");
out.println("<body>");
out.append("<h3>Servlet Showcase</h3>");
out.append("<form action=\"HelloWorld\" method=\"post\">");
//String first = request.getParameter("first");
//String last = request.getParameter("last");
final String first = ParamsMap.getString(request, "first");
final String last = ParamsMap.getString(request, "last");
//System.out.println(first + " " + last);
out.append("<br>Enter Your First Name: ");
out.append("<input name=\"first\" value=\"");
out.append(first);
out.append("\"/>");
out.append("<br>Enter Your Last Name: ");
out.append("<input name=\"last\" value=\"");
out.append(last);
out.append("\"/>");
out.append("<br><br>");
out.append("<input type=\"submit\" value=\"Get Your Name\"/>");
out.append("</form>");
out.append("<br><br>");
out.println("<a href=\"HelloWorld\">Get Your Name</a>");
out.println("</body></html>");
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
}
//src/main/java/com/peterpiper/servlet/ShowcaseServlet.java
package com.peterpiper.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.peterpiper.paramsmap.ParamsMap;
@WebServlet(name = "ShowcaseServlet", urlPatterns = { "/HelloWorld" })
public class ShowcaseServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Constructor of ShowcaseServlet
*/
public ShowcaseServlet() {
super();
}
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
"""
Processes requests for both HTTP <code>GET</code> and <code>POST</code>
methods.
@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs
"""
response.setContentType("text/html;charset=UTF-8");
final PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet Showcase</title>");
out.println("</head>");
out.println("<body>");
out.append("<h3>Servlet Showcase</h | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
"""
Processes requests for both HTTP <code>GET</code> and <code>POST</code>
methods.
@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs
""" | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException |