本文整理匯總了Java中org.apache.wicket.request.Response類的典型用法代碼示例。如果您正苦於以下問題:Java Response類的具體用法?Java Response怎麽用?Java Response使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Response類屬於org.apache.wicket.request包,在下文中一共展示了Response類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: afterRender
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public void afterRender(Component component) {
FormComponent<?> fc = (FormComponent<?>) component;
Response r = component.getResponse();
r.write("</span>");
if (fc.hasFeedbackMessage()) {
r.write("<span class=\"feedbackPanelTextField\">");
IFeedbackMessageFilter filter = new ComponentFeedbackMessageFilter(component);
for (FeedbackMessage message : fc.getFeedbackMessages().messages(filter)) {
r.write("<span class=\"feedbackPanel");
r.write(message.getLevelAsString().toUpperCase());
r.write("\">");
r.write(Strings.escapeMarkup(message.getMessage().toString()));
}
r.write("</span>");
}
}
示例2: afterRender
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public void afterRender(final Component component) {
super.afterRender(component);
final Response r = component.getResponse();
final String text = ResourceBundleLocator.getLabelModel(this.getClass(), "ajax.loading.text").getObject();
r.write("<span style=\"display:none;\" class=\"");
r.write(getSpanClass());
r.write("\" ");
r.write("id=\"");
r.write(getMarkupId());
r.write("\">");
r.write("<img src=\"");
r.write(getIndicatorUrl());
r.write("\" alt=\"\" class=\"spinner\"/>");
r.write("<span class=\"loading blink\">");
r.write(text);
r.write("</span>");
r.write("</span>");
}
示例3: set
import org.apache.wicket.request.Response; //導入依賴的package包/類
public void set(final Request request, final Response response, final Map<String, List<String>> prefs) {
Map<String, String> current = new HashMap<>();
String prefString = COOKIE_UTILS.load(COOKIE_NAME);
if (prefString != null) {
current.putAll(getPrefs(new String(Base64.getDecoder().decode(prefString.getBytes()))));
}
// after retrieved previous setting in order to overwrite the key ...
prefs.entrySet().forEach(entry -> {
current.put(entry.getKey(), StringUtils.join(entry.getValue(), ";"));
});
try {
COOKIE_UTILS.save(COOKIE_NAME, Base64.getEncoder().encodeToString(setPrefs(current).getBytes()));
} catch (IOException e) {
LOG.error("Could not save {} info: {}", getClass().getSimpleName(), current, e);
}
}
示例4: onComponentTagBody
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
super.onComponentTagBody(markupStream, openTag);
if (addFakeInputFields) {
final Response response = getResponse();
response.write("<input style=\"display:none\">\n" +
"<input type=\"password\" style=\"display:none\">");
}
}
示例5: renderChoice
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
protected void renderChoice(ItemDefinition<?> object, Response response, String criteria) {
String textValue = getTextValue(object);
textValue = Strings.escapeMarkup(textValue).toString();
response.write(textValue);
}
示例6: newSession
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public Session newSession(final Request request, final Response response) {
if(!DEMO_MODE_USING_CREDENTIALS_AS_QUERYARGS) {
return super.newSession(request, response);
}
// else demo mode
final AuthenticatedWebSessionForIsis s = (AuthenticatedWebSessionForIsis) super.newSession(request, response);
final org.apache.wicket.util.string.StringValue user = request.getRequestParameters().getParameterValue("user");
final org.apache.wicket.util.string.StringValue password = request.getRequestParameters().getParameterValue("pass");
s.signIn(user.toString(), password.toString());
return s;
}
示例7: newSession
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public Session newSession(Request request, Response response) {
try {
return webSessionClassRef.get().getDeclaredConstructor(Request.class).newInstance(request); // NOSONAR
} catch (RuntimeException | InstantiationException | IllegalAccessException
| InvocationTargetException | NoSuchMethodException e) {
throw new WicketRuntimeException("Unable to instantiate web session " +
webSessionClassRef.get(), e);
}
}
示例8: beforeRender
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public void beforeRender(Component component) {
Response response = component.getResponse();
response.write("<!--");
if (StringUtils.hasText(condition)) {
response.write(
new StringBuilder("[if ").append(condition).append("]>").toString()
);
}
}
示例9: afterRender
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public void afterRender(Component component) {
Response response = component.getResponse();
if (StringUtils.hasText(condition)) {
response.write("<![endif]");
}
response.write("-->");
}
示例10: set
import org.apache.wicket.request.Response; //導入依賴的package包/類
public void set(final Request request, final Response response,
final Map<String, List<String>> prefs) {
Cookie prefCookie =
((WebRequest) request).getCookie(Constants.PREFS_COOKIE_NAME);
final Map<String, String> current = new HashMap<String, String>();
if (prefCookie == null || !StringUtils.hasText(prefCookie.getValue())) {
prefCookie = new Cookie(Constants.PREFS_COOKIE_NAME, null);
} else {
current.putAll(getPrefs(new String(Base64.decodeBase64(
prefCookie.getValue().getBytes()))));
}
// after retrieved previous setting in order to overwrite the key ...
for (Entry<String, List<String>> entry : prefs.entrySet()) {
current.put(entry.getKey(), StringUtils.collectionToDelimitedString(
entry.getValue(), ";"));
}
try {
prefCookie.setValue(new String(
Base64.encodeBase64(setPrefs(current).getBytes())));
} catch (IOException e) {
LOG.error("Could not set preferences " + current, e);
}
prefCookie.setMaxAge(ONE_YEAR_TIME);
((WebResponse) response).addCookie(prefCookie);
}
示例11: getContainerResponse
import org.apache.wicket.request.Response; //導入依賴的package包/類
public static HttpServletResponse getContainerResponse() {
final RequestCycle requestCycle = RequestCycle.get();
if (requestCycle == null) {
return null;
}
final Response response = requestCycle.getResponse();
if (response == null) {
return null;
}
return (HttpServletResponse) response.getContainerResponse();
}
示例12: newSession
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public Session newSession(final Request request, final Response response) {
if(!DEMO_MODE_USING_CREDENTIALS_AS_QUERYARGS) {
return super.newSession(request, response);
}
// else demo mode
final AuthenticatedWebSessionForIsis s = (AuthenticatedWebSessionForIsis) super.newSession(request, response);
IRequestParameters requestParameters = request.getRequestParameters();
final org.apache.wicket.util.string.StringValue user = requestParameters.getParameterValue("user");
final org.apache.wicket.util.string.StringValue password = requestParameters.getParameterValue("pass");
s.signIn(user.toString(), password.toString());
return s;
}
示例13: newSession
import org.apache.wicket.request.Response; //導入依賴的package包/類
/**
* Action at the session start :
* * Add the User provided by GASSI in the application session
* * Add the corresponding PaaS user into session
* * Add demo data
*/
@Override
public Session newSession(Request request, Response response) {
if (logger.isDebugEnabled()) {
logger.debug("Created a new AcpSession");
}
WicketSession session = new WicketSession(request);
// english is default language
session.setLocale(Locale.US);
return session;
}
示例14: beforeRender
import org.apache.wicket.request.Response; //導入依賴的package包/類
public void beforeRender(Component component) {
FormComponent<?> fc = (FormComponent<?>) component;
Response r = component.getResponse();
String label = (fc.getLabel() != null) ? fc.getLabel().getObject(): null;
if (label != null) {
r.write("<span class=\"param\">");
r.write("<label for=\"");
r.write(fc.getMarkupId());
r.write("\"");
if (!fc.isValid()) {
r.write(" class=\"error\"");
}
r.write(" />");
r.write(Strings.escapeMarkup(label));
r.write("</label>");
r.write("</span>");
NotNull clazz;
try {
Field field = fc.getForm().getModelObject().getClass().getDeclaredField(fc.getInputName());
clazz = field.getAnnotation(NotNull.class);
} catch (NoSuchFieldException e) {
clazz = null;
}
if (clazz != null || fc.isRequired()) {
r.write("<span class=\"required\" title=\"");
r.write(fc.getString("portal.error.required.field.title"));
r.write("\">");
r.write(fc.getString("portal.required.field")+"</span>");
} else {
r.write("<span class=\"notrequired\"></span>");
}
r.write("<span class=\"value\">");
}
super.beforeRender(component);
}
示例15: newSession
import org.apache.wicket.request.Response; //導入依賴的package包/類
@Override
public Session newSession(Request request, Response response) {
PaasTestSession session = new PaasTestSession(request, useAuthentication);
// english is default language
session.setLocale(Locale.US);
return session;
}