HttpServletRequest and HttpServletResponse in RAML


#1

Hi,

If I have a REST interface:

@POST
@Path("/somePath")
public void doStuff(@Context HttpServletRequest request, @Context HttpServletResponse response, …);

How to I document the following in RAML?

  • HttpServletRequest
  • HttpServletResponse

Thank you! :slight_smile:
Gunnar


#2

MH, do you want to describe what specifically goes in and whats coming out? Right now it seems that you only have request and response, but what do you want to describe is not really clear to me.


#3

Hi Christian,

See in RESTEasy:

Chapter 15. @Context

The @Context annotation allows you to inject instances of javax.ws.rs.core.HttpHeaders, javax.ws.rs.core.UriInfo, javax.ws.rs.core.Request, javax.servlet.HttpServletRequest, javax.servlet.HttpServletResponse, javax.servlet.ServletConfig, javax.servlet.ServletContext, and javax.ws.rs.core.SecurityContext objects.
https://docs.jboss.org/resteasy/docs/3.0.6.Final/userguide/html_single/#_Context

In the Java code, I’m doing stuff like:

public void doStuff(HttpServletRequest request, HttpServletResponse response)
  {
    HttpSession session = request.getSession();
    setCookie(response, ....);
  }

#4

I am not really sure I understand what you’d like to capture in RAML? So what are the information that the consumers of your API should know?