Tabnine Logo
IWebContext.getResponse
Code IndexAdd Tabnine to your IDE (free)

How to use
getResponse
method
in
org.thymeleaf.context.IWebContext

Best Java code snippets using org.thymeleaf.context.IWebContext.getResponse (Showing top 13 results out of 315)

origin: thymeleaf/thymeleaf

/**
 * <p>
 *   Process an already-built URL just before returning it.
 * </p>
 * <p>
 *   By default, this method will apply the {@code HttpServletResponse.encodeURL(url)} mechanism, as standard
 *   when using the Java Servlet API. Note however that this will only be applied if {@code context} is
 *   an implementation of {@code IWebContext} (i.e. the Servlet API will only be applied in web environments).
 * </p>
 * <p>
 *   This method can be overridden by any subclasses that want to change this behaviour (e.g. in order to
 *   avoid using the Servlet API).
 * </p>
 *
 * @param context the execution context.
 * @param link the already-built URL.
 * @return the processed URL, ready to be used.
 */
protected String processLink(final IExpressionContext context, final String link) {
  if (!(context instanceof IWebContext)) {
    return link;
  }
  final HttpServletResponse response = ((IWebContext)context).getResponse();
  return (response != null? response.encodeURL(link) : link);
}
origin: thymeleaf/thymeleaf

return ((IWebContext) context).getResponse();
origin: thymeleaf/thymeleaf

  return new WebEngineContext(
      configuration, templateData, templateResolutionAttributes,
      webContext.getRequest(), webContext.getResponse(), webContext.getServletContext(),
      webContext.getLocale(), Collections.EMPTY_MAP);
return new WebEngineContext(
    configuration, templateData, templateResolutionAttributes,
    webContext.getRequest(), webContext.getResponse(), webContext.getServletContext(),
    webContext.getLocale(), variables);
origin: thymeleaf/thymeleaf-extras-springsecurity

@Override
public HttpServletResponse getHttpServletResponse(final IContext context) {
  if (context instanceof IWebContext) {
    return ((IWebContext)context).getResponse();
  }
  throw new TemplateProcessingException(
      "Cannot obtain HttpServletResponse from a non-WebFlux context implementation (\"" +
      context.getClass().getName() + "\")");
}
origin: org.thymeleaf.extras/thymeleaf-extras-springsecurity5

@Override
public HttpServletResponse getHttpServletResponse(final IContext context) {
  if (context instanceof IWebContext) {
    return ((IWebContext)context).getResponse();
  }
  throw new TemplateProcessingException(
      "Cannot obtain HttpServletResponse from a non-WebFlux context implementation (\"" +
      context.getClass().getName() + "\")");
}
origin: thymeleaf/thymeleaf-extras-springsecurity

@Override
protected boolean isVisible(
    final ITemplateContext context, final IProcessableElementTag tag,
    final AttributeName attributeName, final String attributeValue) {
  final String attrValue = (attributeValue == null? null : attributeValue.trim());
  if (attrValue == null || attrValue.length() == 0) {
    return false;
  }
  if (!(context instanceof IWebContext)) {
    throw new ConfigurationException(
        "Thymeleaf execution context is not a web context (implementation of " +
        IWebContext.class.getName() + "). Spring Security integration can only be used in " +
        "web environments.");
  }
  final IWebContext webContext = (IWebContext) context;
  final HttpServletRequest request = webContext.getRequest();
  final HttpServletResponse response = webContext.getResponse();
  final ServletContext servletContext = webContext.getServletContext();
  final Authentication authentication = AuthUtils.getAuthenticationObject();
  if (authentication == null) {
    return false;
  }
  return AuthUtils.authorizeUsingAccessExpression(
      context, attrValue, authentication, request, response, servletContext);
}

origin: org.thymeleaf.extras/thymeleaf-extras-springsecurity4

@Override
protected boolean isVisible(
    final ITemplateContext context, final IProcessableElementTag tag,
    final AttributeName attributeName, final String attributeValue) {
  final String attrValue = (attributeValue == null? null : attributeValue.trim());
  if (attrValue == null || attrValue.length() == 0) {
    return false;
  }
  if (!(context instanceof IWebContext)) {
    throw new ConfigurationException(
        "Thymeleaf execution context is not a web context (implementation of " +
        IWebContext.class.getName() + "). Spring Security integration can only be used in " +
        "web environments.");
  }
  final IWebContext webContext = (IWebContext) context;
  final HttpServletRequest request = webContext.getRequest();
  final HttpServletResponse response = webContext.getResponse();
  final ServletContext servletContext = webContext.getServletContext();
  final Authentication authentication = AuthUtils.getAuthenticationObject();
  if (authentication == null) {
    return false;
  }
  return AuthUtils.authorizeUsingAccessExpression(
      context, attrValue, authentication, request, response, servletContext);
}

origin: org.thymeleaf.extras/thymeleaf-extras-springsecurity3

@Override
protected boolean isVisible(
    final ITemplateContext context, final IProcessableElementTag tag,
    final AttributeName attributeName, final String attributeValue) {
  final String attrValue = (attributeValue == null? null : attributeValue.trim());
  if (attrValue == null || attrValue.length() == 0) {
    return false;
  }
  if (!(context instanceof IWebContext)) {
    throw new ConfigurationException(
        "Thymeleaf execution context is not a web context (implementation of " +
        IWebContext.class.getName() + "). Spring Security integration can only be used in " +
        "web environments.");
  }
  final IWebContext webContext = (IWebContext) context;
  
  final HttpServletRequest request = webContext.getRequest();
  final HttpServletResponse response = webContext.getResponse();
  final ServletContext servletContext = webContext.getServletContext();
  
  final Authentication authentication = AuthUtils.getAuthenticationObject();
  if (authentication == null) {
    return false;
  }
  
  return AuthUtils.authorizeUsingAccessExpression(
      context, attrValue, authentication, request, response, servletContext);
  
}

origin: thymeleaf/thymeleaf-extras-springsecurity

@Override
protected boolean isVisible(
    final ITemplateContext context, final IProcessableElementTag tag,
    final AttributeName attributeName, final String attributeValue) {
  final String attrValue = (attributeValue == null? null : attributeValue.trim());
  if (attrValue == null || attrValue.length() == 0) {
    return false;
  }
  if (!(context instanceof IWebContext)) {
    throw new ConfigurationException(
        "Thymeleaf execution context is not a web context (implementation of " +
        IWebContext.class.getName() + "). Spring Security integration can only be used in " +
        "web environments.");
  }
  final IWebContext webContext = (IWebContext) context;
  
  final HttpServletRequest request = webContext.getRequest();
  final HttpServletResponse response = webContext.getResponse();
  final ServletContext servletContext = webContext.getServletContext();
  
  final Authentication authentication = AuthUtils.getAuthenticationObject();
  if (authentication == null) {
    return false;
  }
  
  return AuthUtils.authorizeUsingAccessExpression(
      context, attrValue, authentication, request, response, servletContext);
  
}

origin: org.thymeleaf.extras/thymeleaf-extras-springsecurity3

public Object buildObject(final IExpressionContext context, final String expressionObjectName) {
  if (AUTHENTICATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      return AuthUtils.getAuthenticationObject();
    }
  }
  if (AUTHORIZATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      // We retrieve it like this in order to give it the opportunity to come from cache
      final Authentication authentication =
          (Authentication) context.getExpressionObjects().getObject(AUTHENTICATION_EXPRESSION_OBJECT_NAME);
      final IWebContext webContext = (IWebContext)context;
      final HttpServletRequest request = webContext.getRequest();
      final HttpServletResponse response = webContext.getResponse();
      final ServletContext servletContext = webContext.getServletContext();
      return new Authorization(context, authentication, request, response, servletContext);
    }
    return null;
  }
  return null;
}
origin: thymeleaf/thymeleaf-extras-springsecurity

public Object buildObject(final IExpressionContext context, final String expressionObjectName) {
  if (AUTHENTICATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      return AuthUtils.getAuthenticationObject();
    }
  }
  if (AUTHORIZATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      // We retrieve it like this in order to give it the opportunity to come from cache
      final Authentication authentication =
          (Authentication) context.getExpressionObjects().getObject(AUTHENTICATION_EXPRESSION_OBJECT_NAME);
      final IWebContext webContext = (IWebContext)context;
      final HttpServletRequest request = webContext.getRequest();
      final HttpServletResponse response = webContext.getResponse();
      final ServletContext servletContext = webContext.getServletContext();
      return new Authorization(context, authentication, request, response, servletContext);
    }
    return null;
  }
  return null;
}
origin: thymeleaf/thymeleaf-extras-springsecurity

public Object buildObject(final IExpressionContext context, final String expressionObjectName) {
  if (AUTHENTICATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      return AuthUtils.getAuthenticationObject();
    }
  }
  if (AUTHORIZATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      // We retrieve it like this in order to give it the opportunity to come from cache
      final Authentication authentication =
          (Authentication) context.getExpressionObjects().getObject(AUTHENTICATION_EXPRESSION_OBJECT_NAME);
      final IWebContext webContext = (IWebContext)context;
      final HttpServletRequest request = webContext.getRequest();
      final HttpServletResponse response = webContext.getResponse();
      final ServletContext servletContext = webContext.getServletContext();
      return new Authorization(context, authentication, request, response, servletContext);
    }
    return null;
  }
  return null;
}
origin: org.thymeleaf.extras/thymeleaf-extras-springsecurity4

public Object buildObject(final IExpressionContext context, final String expressionObjectName) {
  if (AUTHENTICATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      return AuthUtils.getAuthenticationObject();
    }
  }
  if (AUTHORIZATION_EXPRESSION_OBJECT_NAME.equals(expressionObjectName)) {
    if (context instanceof IWebContext) {
      // We retrieve it like this in order to give it the opportunity to come from cache
      final Authentication authentication =
          (Authentication) context.getExpressionObjects().getObject(AUTHENTICATION_EXPRESSION_OBJECT_NAME);
      final IWebContext webContext = (IWebContext)context;
      final HttpServletRequest request = webContext.getRequest();
      final HttpServletResponse response = webContext.getResponse();
      final ServletContext servletContext = webContext.getServletContext();
      return new Authorization(context, authentication, request, response, servletContext);
    }
    return null;
  }
  return null;
}
org.thymeleaf.contextIWebContextgetResponse

Javadoc

Returns the HttpServletResponse object associated with the template execution.

Popular methods of IWebContext

  • getRequest
  • getHttpServletRequest
    Returns the HttpServletRequest object associated with the request this context has been created for
  • getServletContext
    Returns the ServletContext object associated with the web application.
  • getHttpServletResponse
    Returns the HttpServletResponse object associated with the request this context has been created fo
  • getHttpSession
    Returns the HttpSession object associated with the request this context has been created for.
  • getLocale
  • getSession
    Returns the HttpSession object associated with the template execution, or null if there is no sessi

Popular in Java

  • Reading from database using SQL prepared statement
  • getApplicationContext (Context)
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now