@Override /* Object */ public String toString() { if (varSession != null) return varSession.resolve(contents); return contents; } }
private String resolve(String s) { if (s == null) return null; return vr.resolve(s.trim()); }
private String resolve(String s) { if (s == null) return null; return vr.resolve(s.trim()); }
private String resolve(String s) { if (s == null) return null; return vr.resolve(s.trim()); }
@Override /* Map */ public Object get(Object key) { return varResolver.resolve(super.get(key)); } }
/** * Shortcut for calling <code>getVarResolverSession().resolve(input)</code>. * * @param input The input string to resolve variables in. * @return The string with variables resolved, or <jk>null</jk> if input is null. */ public String resolveVars(String input) { return getVarResolverSession().resolve(input); }
@Override /* Map */ public Object get(Object key) { return varResolver.resolve(super.get(key)); } }
@Override /* Map */ public Object get(Object key) { return varResolver.resolve(super.get(key)); } }
/** * Resolve variables in the specified string. * * <p> * This is a shortcut for calling <code>createSession(<jk>null</jk>).resolve(s);</code>. * <br>This method can only be used if the string doesn't contain variables that rely on the existence of session * variables. * * @param s The input string. * @return The string with variables resolved, or the same string if it doesn't contain any variables to resolve. */ public String resolve(String s) { return createSession(null).resolve(s); }
/** * Resolve variables in the specified string. * * <p> * This is a shortcut for calling <code>createSession(<jk>null</jk>).resolve(s);</code>. * <br>This method can only be used if the string doesn't contain variables that rely on the existence of session * variables. * * @param s The input string. * @return The string with variables resolved, or the same string if it doesn't contain any variables to resolve. */ public String resolve(String s) { return createSession(null).resolve(s); }
/** * Resolve variables in the specified string. * * <p> * This is a shortcut for calling <code>createSession(<jk>null</jk>).resolve(s);</code>. * <br>This method can only be used if the string doesn't contain variables that rely on the existence of session * variables. * * @param s The input string. * @return The string with variables resolved, or the same string if it doesn't contain any variables to resolve. */ public String resolve(String s) { return createSession(null).resolve(s); }
private String getDescription(RestRequest req) { VarResolverSession vr = req.getVarResolverSession(); if (description != null) return vr.resolve(description); String description = msgs.findFirstString(req.getLocale(), method.getName() + ".description"); if (description != null) return vr.resolve(description); Operation o = getSwaggerOperationFromFile(req); if (o != null) return o.getDescription(); return null; }
private String getSummary(RestRequest req) { VarResolverSession vr = req.getVarResolverSession(); if (summary != null) return vr.resolve(summary); String summary = msgs.findFirstString(req.getLocale(), method.getName() + ".summary"); if (summary != null) return vr.resolve(summary); Operation o = getSwaggerOperationFromFile(req); if (o != null) return o.getSummary(); return null; }
/** * Same as {@link #loadScript(String)} but replaces request-time SVL variables. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='jm'>{@link org.apache.juneau.rest.RestContext#getVarResolver()} * <li class='link'>{@doc juneau-rest-server.SvlVariables} * </ul> * * @param req The current HTTP request. * @param name Name of the desired resource. * @return The resource converted to a string, or <jk>null</jk> if the resource could not be found. * @throws IOException */ protected String loadScriptWithVars(RestRequest req, String name) throws IOException { return req.getVarResolverSession().resolve(loadScript(name)); }
/** * Same as {@link #loadStyle(String)} but replaces request-time SVL variables. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='jm'>{@link org.apache.juneau.rest.RestContext#getVarResolver()} * <li class='link'>{@doc juneau-rest-server.SvlVariables} * </ul> * * @param req The current HTTP request. * @param name Name of the desired resource. * @return The resource converted to a string, or <jk>null</jk> if the resource could not be found. * @throws IOException */ protected String loadStyleWithVars(RestRequest req, String name) throws IOException { return req.getVarResolverSession().resolve(loadStyle(name)); }
/** * Same as {@link #loadHtml(String)} but replaces request-time SVL variables. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='jm'>{@link org.apache.juneau.rest.RestContext#getVarResolver()} * <li class='link'>{@doc juneau-rest-server.SvlVariables} * </ul> * * @param req The current HTTP request. * @param name Name of the desired resource. * @return The resource converted to a string, or <jk>null</jk> if the resource could not be found. * @throws IOException */ protected String loadHtmlWithVars(RestRequest req, String name) throws IOException { return req.getVarResolverSession().resolve(loadHtml(name)); } }
/** * Same as {@link #loadScript(String)} but replaces request-time SVL variables. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='jm'>{@link org.apache.juneau.rest.RestContext#getVarResolver()} * <li class='link'>{@doc juneau-rest-server.SvlVariables} * </ul> * * @param req The current HTTP request. * @param name Name of the desired resource. * @return The resource converted to a string, or <jk>null</jk> if the resource could not be found. * @throws IOException */ protected String loadScriptWithVars(RestRequest req, String name) throws IOException { return req.getVarResolverSession().resolve(loadScript(name)); }
/** * Same as {@link #loadStyle(String)} but replaces request-time SVL variables. * * <h5 class='section'>See Also:</h5> * <ul> * <li class='jm'>{@link org.apache.juneau.rest.RestContext#getVarResolver()} * <li class='link'>{@doc juneau-rest-server.SvlVariables} * </ul> * * @param req The current HTTP request. * @param name Name of the desired resource. * @return The resource converted to a string, or <jk>null</jk> if the resource could not be found. * @throws IOException */ protected String loadStyleWithVars(RestRequest req, String name) throws IOException { return req.getVarResolverSession().resolve(loadStyle(name)); }
private ExternalDocumentation getExternalDocs(RestRequest req) { VarResolverSession vr = req.getVarResolverSession(); JsonParser jp = JsonParser.DEFAULT; try { if (externalDocs != null) return jp.parse(vr.resolve(externalDocs), ExternalDocumentation.class); String externalDocs = msgs.findFirstString(req.getLocale(), method.getName() + ".externalDocs"); if (externalDocs != null) return jp.parse(vr.resolve(externalDocs), ExternalDocumentation.class); Operation o = getSwaggerOperationFromFile(req); if (o != null) return o.getExternalDocs(); return null; } catch (Exception e) { throw new RestException(SC_INTERNAL_SERVER_ERROR, e); } }
@SuppressWarnings("unchecked") private List<String> getTags(RestRequest req) { VarResolverSession vr = req.getVarResolverSession(); JsonParser jp = JsonParser.DEFAULT; try { if (tags != null) return jp.parseCollection(vr.resolve(tags), ArrayList.class, String.class); String tags = msgs.findFirstString(req.getLocale(), method.getName() + ".tags"); if (tags != null) return jp.parseCollection(vr.resolve(tags), ArrayList.class, String.class); Operation o = getSwaggerOperationFromFile(req); if (o != null) return o.getTags(); return null; } catch (Exception e) { throw new RestException(SC_INTERNAL_SERVER_ERROR, e); } }