类 ParameterizableViewController

java.lang.Object
cn.taketoday.context.support.ApplicationObjectSupport
cn.taketoday.web.WebContentGenerator
cn.taketoday.web.handler.mvc.AbstractController
cn.taketoday.web.handler.mvc.ParameterizableViewController
所有已实现的接口:
cn.taketoday.beans.factory.Aware, cn.taketoday.context.ApplicationContextAware, Controller, HttpRequestHandler

public class ParameterizableViewController extends AbstractController
Trivial controller that always returns a pre-configured view and optionally sets the response status code. The view and status can be configured using the provided configuration properties.
从以下版本开始:
4.0 2022/2/8 15:48
作者:
Rod Johnson, Juergen Hoeller, Keith Donald, Rossen Stoyanchev, Harry Yang
  • 字段详细资料

    • returnValue

      @Nullable private Object returnValue
    • statusCode

      @Nullable private HttpStatusCode statusCode
    • statusOnly

      private boolean statusOnly
    • contentType

      @Nullable private String contentType
  • 构造器详细资料

    • ParameterizableViewController

      public ParameterizableViewController()
  • 方法详细资料

    • setViewName

      public void setViewName(@Nullable String viewName)
      Set a view name for the ModelAndView to return, to be resolved by the DispatcherServlet via a ViewResolver. Will override any pre-existing view name or View.
    • getViewName

      @Nullable public String getViewName()
      Return the name of the view to delegate to, or null if using a View instance.
    • setView

      public void setView(View view)
      Set a View object for the ModelAndView to return. Will override any pre-existing view name or View.
    • getView

      @Nullable public View getView()
      Return the View object, or null if we are using a view name to be resolved by the DispatcherHandler via a ViewResolver.
    • setStatusCode

      public void setStatusCode(@Nullable HttpStatusCode statusCode)
      Configure the HTTP status code that this controller should set on the response.

      When a "redirect:" prefixed view name is configured, there is no need to set this property since RedirectView will do that. However this property may still be used to override the 3xx status code of RedirectView. For full control over redirecting provide a RedirectView instance.

      If the status code is 204 and no view is configured, the request is fully handled within the controller.

    • getStatusCode

      @Nullable public HttpStatusCode getStatusCode()
      Return the configured HTTP status code or null.
    • setStatusOnly

      public void setStatusOnly(boolean statusOnly)
      The property can be used to indicate the request is considered fully handled within the controller and that no view should be used for rendering. Useful in combination with setStatusCode(cn.taketoday.http.HttpStatusCode).

      By default this is set to false.

    • isStatusOnly

      public boolean isStatusOnly()
      Whether the request is fully handled within the controller.
    • setReturnValue

      public void setReturnValue(@Nullable Object returnValue)
      Set a result object to return. Will override any pre-existing view name or View.
    • getReturnValue

      @Nullable public Object getReturnValue()
      Return the result object, or null if we are not set.
    • setContentType

      public void setContentType(@Nullable String contentType)
      Set content type
    • getContentType

      @Nullable public String getContentType()
    • handleRequestInternal

      protected Object handleRequestInternal(RequestContext request) throws Throwable
      Return a ModelAndView object with the specified view name.

      The content of the RequestContext.getInputRedirectModel() "input" RedirectModel} is also added to the model.

      指定者:
      handleRequestInternal 在类中 AbstractController
      抛出:
      Throwable
      另请参阅:
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • formatStatusAndView

      private String formatStatusAndView()