/** * Constructor * * @param aURL * A URL to make requests to when when the data provided by local and * prefetch is insufficient. */ public TypeaheadRemote (@Nonnull final ISimpleURL aURL) { ValueEnforcer.notNull (aURL, "URL"); m_aURL = new SimpleURL (aURL); }
@Nonnull public SimpleURL buildURL (@Nullable final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull @Nonempty final String sBasePath, @Nullable final Locale aDisplayLocale, @Nullable final String sMenuItemID) { // Add menu item parameter as URL parameter final SimpleURL ret = new SimpleURL (aRequestScope != null ? aRequestScope.encodeURL (sBasePath) : sBasePath); if (aDisplayLocale != null) ret.add (getRequestParamNameLocale (), aDisplayLocale.toString ()); if (StringHelper.hasText (sMenuItemID)) ret.add (getRequestParamNameMenuItem (), sMenuItemID); return ret; }
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception { final SimpleURL aTargetURL = new SimpleURL (m_aTargetURL); // Add all parameters for (final Map.Entry <String, Object> aEntry : aRequestScope.params ().entrySet ()) { final String sKey = aEntry.getKey (); final Object aValue = aEntry.getValue (); if (aValue instanceof String) aTargetURL.add (sKey, (String) aValue); else if (aValue instanceof String []) for (final String sValue : (String []) aValue) aTargetURL.add (sKey, sValue); } aUnifiedResponse.setRedirect (aTargetURL.getAsStringWithEncodedParameters ()); } }
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception { final HttpServletRequest aRequest = aRequestScope.getRequest (); final SimpleURL aURL = new SimpleURL (aRequestScope.getContextPath () + m_sServletPath); aURL.add ("httpError", true); aURL.addIf ("httpStatusCode", StringHelper.getToString (aRequest.getAttribute ("javax.servlet.error.status_code")), Objects::nonNull); aURL.addIf ("httpStatusMessage", StringHelper.getToString (aRequest.getAttribute ("javax.servlet.error.message")), Objects::nonNull); aURL.addIf ("httpRequestUri", StringHelper.getToString (aRequest.getAttribute ("javax.servlet.error.request_uri")), Objects::nonNull); aURL.addIf ("httpReferrer", aRequestScope.headers ().getFirstHeaderValue (CHttpHeader.REFERER), Objects::nonNull); aUnifiedResponse.setRedirect (aURL); } }
/** * Build the final connection string from the base JDBC URL and an optional * set of connection properties. * * @param sJdbcURL * The base JDBC URL. May neither be <code>null</code> nor empty and * must started with {@link CJDBC_MySQL#CONNECTION_PREFIX} * @param aConnectionProperties * An map with all connection properties. May be <code>null</code> . * @return The final JDBC connection string to be used. Never * <code>null</code> or empty */ @Nonnull @Nonempty public static String buildJDBCString (@Nonnull @Nonempty final String sJdbcURL, @Nullable final Map <EMySQLConnectionProperty, String> aConnectionProperties) { ValueEnforcer.notEmpty (sJdbcURL, "JDBC URL"); ValueEnforcer.isTrue (sJdbcURL.startsWith (CJDBC_MySQL.CONNECTION_PREFIX), "The JDBC URL '" + sJdbcURL + "' does not seem to be a MySQL connection string!"); // Add the connection properties to the JDBC string final SimpleURL aURL = new SimpleURL (sJdbcURL); if (aConnectionProperties != null) for (final Map.Entry <EMySQLConnectionProperty, String> aEntry : aConnectionProperties.entrySet ()) aURL.add (aEntry.getKey ().getName (), aEntry.getValue ()); return aURL.getAsStringWithoutEncodedParameters (); }
final SimpleURL aFinalURL = new SimpleURL (m_aTextLoadingURL).add (m_sTextLoadingURLLocaleParameterName, m_aDisplayLocale.getLanguage ()); if (m_aTextLoadingParams != null) aFinalURL.addAll (m_aTextLoadingParams); aLanguage = new JsonObject ().add ("url", aFinalURL.getAsString ());
/** * Throw a {@link ForcedRedirectException} with the self href of the current * layout context. This immediately stops the request and sends a HTTP * redirect to the client. * * @param aContent * The content to be displayed next time the page is rendered via GET. * May be <code>null</code>. * @param aAdditionalParameters * Additional parameters to be added to the request. May be * <code>null</code> or empty. * @throws ForcedRedirectException * Every time, since this is the P-R-G indicator. */ default void postRedirectGetInternal (@Nullable final IHCNode aContent, @Nullable final Map <String, String> aAdditionalParameters) throws ForcedRedirectException { // Add the "PRG active" parameter postRedirectGet (getSelfHref ().add (ForcedRedirectManager.REQUEST_PARAMETER_PRG_ACTIVE) .addAll (aAdditionalParameters), aContent); }
public HCYouTubeEmbed (final int nWidth, final int nHeight, @Nonnull @Nonempty final String sVideoID, final boolean bAllowFullScreen) { final ISimpleURL aBaseURL = new SimpleURL (PREFIX + sVideoID); setWidth (nWidth); setHeight (nHeight); final HCParam aParamMovie = addAndReturnChild (new HCParam ("movie")); final HCParam aParamAllowFullScreen = addAndReturnChild (new HCParam ("allowFullScreen")); aParamAllowFullScreen.setValue (Boolean.toString (bAllowFullScreen)); addChild (new HCParam ("allowscriptaccess").setValue ("always")); final HCEmbed aEmbed = addAndReturnChild (new HCEmbed ()); aEmbed.setType (CMimeType.APPLICATION_SHOCKWAVE_FLASH); aEmbed.setCustomAttr ("allowscriptaccess", "always"); aEmbed.setWidth (nWidth); aEmbed.setHeight (nHeight); aEmbed.setCustomAttr ("allowfullscreen", Boolean.toString (bAllowFullScreen)); // Build the correct URL based on the passed settings final SMap aURLParams = new SMap ("hl", "en_US"); aURLParams.add ("fs", bAllowFullScreen ? "1" : "0"); final ISimpleURL aURL = new SimpleURL (aBaseURL).addAll (aURLParams); aParamMovie.setValue (aURL.getAsString ()); aEmbed.setSrc (aURL); } }
@Nonnull public HCYouTubeIFrame setLanguage (@Nonnull final Locale aLocale) { ValueEnforcer.notNull (aLocale, "Locale"); ValueEnforcer.notEmpty (aLocale.getLanguage (), "Locale.getLanguage"); m_aVideoURL.params ().remove ("hl"); m_aVideoURL.add ("hl", aLocale.getLanguage ()); setSrc (m_aVideoURL); return this; } }
aWPEC.getSelfHref ().add (CHCParam.PARAM_ACTION, ACTION_DELETE_ALL), EDefaultIcon.DELETE); aNodeList.addChild (aToolbar); .add (CHCParam.PARAM_ACTION, sAction) .addIfNonNull (CHCParam.PARAM_OBJECT, sObjectID) .add (FIELD_FLOW_ID, aFormState.getFlowID ()) .add (FIELD_RESTORE_FLOW_ID, aFormState.getFlowID ())).setTitle (EText.SAVED_STATE_EDIT.getDisplayText (aDisplayLocale)) .addChild (getCreateImg ())); aActionCell.addChild (createDeleteLink (aWPEC,
public TypeaheadPrefetch (@Nonnull final TypeaheadPrefetch aOther) { ValueEnforcer.notNull (aOther, "Other"); m_aURL = aOther.m_aURL.getClone (); m_nTTL = aOther.m_nTTL; m_aFilter = aOther.m_aFilter; }
@Nonnull @ReturnsMutableCopy public JSAssocArray getAsJSObject () { final JSAssocArray ret = new JSAssocArray (); ret.add (JSON_URL, m_aURL.getAsStringWithEncodedParameters ()); if (m_nTTL != DEFAULT_TTL) ret.add (JSON_TTL, m_nTTL); if (m_aFilter != null) ret.add (JSON_FILTER, m_aFilter); return ret; }
/** * @param aRequestScope * The request web scope to be used. Required for cookie-less handling. * May not be <code>null</code>. * @param aParams * An optional map with URL parameters to be used in the URL. May be * <code>null</code> or empty. * @return The URI where the AJAX function can be invoked. Neither * <code>null</code> nor empty. */ @Nonnull @Nonempty default String getInvocationURI (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nullable final Map <String, String> aParams) { if (aParams == null || aParams.isEmpty ()) { // No need to convert to SimpleURL and back return getInvocationURI (aRequestScope); } return getInvocationURL (aRequestScope).addAll (aParams).getAsStringWithEncodedParameters (); }
@Nonnull public static HCA createEditLink (@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final IHasID <String> aCurObject, @Nullable final String sTitle, @Nullable final Map <String, String> aParams) { final ISimpleURL aEditURL = createEditURL (aLEC, aCurObject).addAll (aParams); return new HCA (aEditURL).setTitle (sTitle).addChild (getEditImg ()); }
aToolbar.addButton ("Refresh", aWPEC.getSelfHref (), EDefaultIcon.REFRESH); if (bTreeView) aToolbar.addButton ("Flat view", aWPEC.getSelfHref ().add (FIELD_VIEW_TYPE, VIEW_FLAT), EDefaultIcon.MAGNIFIER); else aToolbar.addButton ("Tree view", aWPEC.getSelfHref ().add (FIELD_VIEW_TYPE, VIEW_TREE), EDefaultIcon.MAGNIFIER); aNodeList.addChild (aToolbar); final ISimpleURL aEditURL = createEditURL (aWPEC, aServiceInfo).addAll (aParams); final ISimpleURL aCopyURL = createCopyURL (aWPEC, aServiceInfo).addAll (aParams); final ISimpleURL aDeleteURL = createDeleteURL (aWPEC, aServiceInfo).addAll (aParams); final ISimpleURL aPreviewURL = LinkHelper.getURLWithServerAndContext (aServiceInfo.getServiceGroup () .getParticpantIdentifier () .addAll (_createParamMap (aServiceInfo, aProcess, (ISMPEndpoint) null)) .add (CPageParam.PARAM_ACTION, ACTION_DELETE_PROCESS)) .setTitle ("Delete process") .addChild (EDefaultIcon.DELETE.getAsNode ())); .addAll (_createParamMap (aServiceInfo, (ISMPProcess) null, (ISMPEndpoint) null)) .add (CPageParam.PARAM_ACTION, ACTION_DELETE_DOCUMENT_TYPE)) .setTitle ("Delete document type") .addChild (EDefaultIcon.DELETE.getAsNode ())); final ISimpleURL aEditURL = createEditURL (aWPEC, aServiceInfo).addAll (aParams); final ISimpleURL aCopyURL = createCopyURL (aWPEC, aServiceInfo).addAll (aParams); final ISimpleURL aDeleteURL = createDeleteURL (aWPEC, aServiceInfo).addAll (aParams); final ISimpleURL aPreviewURL = LinkHelper.getURLWithServerAndContext (aServiceInfo.getServiceGroup ()