本文整理匯總了Java中com.helger.web.scope.IRequestWebScopeWithoutResponse類的典型用法代碼示例。如果您正苦於以下問題:Java IRequestWebScopeWithoutResponse類的具體用法?Java IRequestWebScopeWithoutResponse怎麽用?Java IRequestWebScopeWithoutResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IRequestWebScopeWithoutResponse類屬於com.helger.web.scope包,在下文中一共展示了IRequestWebScopeWithoutResponse類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleRequest
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final UnifiedResponse aUnifiedResponse) throws Exception
{
final AS4Response aHttpResponse = (AS4Response) aUnifiedResponse;
try (final AS4Handler aHandler = new AS4Handler ())
{
aHandler.handleRequest (aRequestScope, aHttpResponse);
}
catch (final BadRequestException ex)
{
// Logged inside
aHttpResponse.setResponseError (HttpServletResponse.SC_BAD_REQUEST,
"Bad Request: " + ex.getMessage (),
ex.getCause ());
}
catch (final Throwable t)
{
// Logged inside
aHttpResponse.setResponseError (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Internal error processing AS4 request",
t);
}
}
示例2: handleRequest
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@Override
@Nonnull
protected EContinue handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final UnifiedResponse aUnifiedResponse) throws ServletException
{
if (m_aLogin.checkUserAndShowLogin (aRequestScope, aUnifiedResponse).isBreak ())
{
// Show login screen
return EContinue.BREAK;
}
// Check if the currently logged in user has the required roles
final String sCurrentUserID = LoggedInUserManager.getInstance ().getCurrentUserID ();
if (!SecurityHelper.hasUserAllRoles (sCurrentUserID, AppSecurity.REQUIRED_ROLE_IDS_CONFIG))
{
aUnifiedResponse.setStatus (HttpServletResponse.SC_FORBIDDEN);
return EContinue.BREAK;
}
return EContinue.CONTINUE;
}
示例3: init
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
public static void init ()
{
BootstrapDataTables.setConfigurator ( (aLEC, aTable, aDataTables) -> {
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope ();
aDataTables.setAutoWidth (false)
.setLengthMenu (LENGTH_MENU)
.setAjaxBuilder (new JQueryAjaxBuilder ().url (CAjax.DATATABLES.getInvocationURL (aRequestScope))
.data (new JSAssocArray ().add (AjaxExecutorDataTables.OBJECT_ID,
aTable.getID ())))
.setServerFilterType (EDataTablesFilterType.ALL_TERMS_PER_ROW)
.setTextLoadingURL (CAjax.DATATABLES_I18N.getInvocationURL (aRequestScope),
AjaxExecutorDataTablesI18N.LANGUAGE_ID)
.addPlugin (new DataTablesPluginSearchHighlight ());
});
// By default allow markdown in system message
BootstrapSystemMessage.setDefaultUseMarkdown (true);
}
示例4: fillBody
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@Override
protected void fillBody (@Nonnull final ISimpleWebExecutionContext aSWEC,
@Nonnull final HCHtml aHtml) throws ForcedRedirectException
{
final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope ();
final Locale aDisplayLocale = aSWEC.getDisplayLocale ();
final IMenuItemPage aMenuItem = RequestSettings.getMenuItem (aRequestScope);
final LayoutExecutionContext aLEC = new LayoutExecutionContext (aSWEC, aMenuItem);
final HCHead aHead = aHtml.head ();
final HCBody aBody = aHtml.body ();
// Add menu item in page title
aHead.setPageTitle (StringHelper.getConcatenatedOnDemand (AppCommonUI.getApplicationTitle (),
" - ",
aMenuItem.getDisplayText (aDisplayLocale)));
final IHCNode aNode = m_aFactory.apply (aLEC);
aBody.addChild (aNode);
}
示例5: PublicApplicationServlet
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
public PublicApplicationServlet ()
{
super (new AbstractApplicationXServletHandler ()
{
@Override
protected IHTMLProvider createHTMLProvider (final IRequestWebScopeWithoutResponse aRequestScope)
{
return new AppLayoutHTMLProvider (AppRendererPublic::getContent);
}
});
}
示例6: SecureApplicationServlet
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
public SecureApplicationServlet ()
{
super (new AbstractApplicationXServletHandler ()
{
@Override
protected IHTMLProvider createHTMLProvider (final IRequestWebScopeWithoutResponse aRequestScope)
{
return new AppLayoutHTMLProvider (AppRendererSecure::getContent);
}
});
}
示例7: handleRequest
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final PhotonUnifiedResponse aAjaxResponse) throws Exception
{
final LayoutExecutionContext aLEC = LayoutExecutionContext.createForAjaxOrAction (aRequestScope);
final String sLoginName = aRequestScope.params ().getAsString (CLogin.REQUEST_ATTR_USERID);
final String sPassword = aRequestScope.params ().getAsString (CLogin.REQUEST_ATTR_PASSWORD);
// Main login
final ELoginResult eLoginResult = LoggedInUserManager.getInstance ().loginUser (sLoginName,
sPassword,
AppSecurity.REQUIRED_ROLE_IDS_VIEW);
if (eLoginResult.isSuccess ())
{
aAjaxResponse.json (new JsonObject ().add (JSON_LOGGEDIN, true));
return;
}
// Get the rendered content of the menu area
if (GlobalDebug.isDebugMode ())
s_aLogger.warn ("Login of '" + sLoginName + "' failed because " + eLoginResult);
final Locale aDisplayLocale = aLEC.getDisplayLocale ();
final IHCNode aRoot = new BootstrapErrorBox ().addChild (EPhotonCoreText.LOGIN_ERROR_MSG.getDisplayText (aDisplayLocale) +
" " +
eLoginResult.getDisplayText (aDisplayLocale));
// Set as result property
aAjaxResponse.json (new JsonObject ().add (JSON_LOGGEDIN, false)
.add (JSON_HTML, HCRenderer.getAsHTMLStringWithoutNamespaces (aRoot)));
}
示例8: _getNavbar
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@Nonnull
private static IHCNode _getNavbar (@Nonnull final SimpleWebExecutionContext aSWEC)
{
final Locale aDisplayLocale = aSWEC.getDisplayLocale ();
final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope ();
final ISimpleURL aLinkToStartPage = aSWEC.getLinkToMenuItem (aSWEC.getMenuTree ().getDefaultMenuItemID ());
final BootstrapNavbar aNavbar = new BootstrapNavbar (EBootstrapNavbarType.STATIC_TOP, true, aDisplayLocale);
aNavbar.getContainer ().setFluid (true);
aNavbar.addBrand (new HCNodeList ().addChild (new HCSpan ().addClass (AppCommonUI.CSS_CLASS_LOGO1)
.addChild (AppCommonUI.getApplicationTitle ()))
.addChild (new HCSpan ().addClass (AppCommonUI.CSS_CLASS_LOGO2)
.addChild (" Administration")),
aLinkToStartPage);
{
final BootstrapNav aNav = new BootstrapNav ();
final IUser aUser = LoggedInUserManager.getInstance ().getCurrentUser ();
aNav.addButton (new BootstrapButton ().addChild ("Goto public area")
.setOnClick (LinkHelper.getURLWithContext (AbstractPublicApplicationServlet.SERVLET_DEFAULT_PATH +
"/")));
aNav.addText (new HCSpan ().addChild ("Welcome ")
.addChild (new HCStrong ().addChild (SecurityHelper.getUserDisplayName (aUser,
aDisplayLocale))));
aNav.addButton (new BootstrapButton ().setOnClick (LinkHelper.getURLWithContext (aRequestScope,
LogoutServlet.SERVLET_DEFAULT_PATH))
.addChild (EPhotonCoreText.LOGIN_LOGOUT.getDisplayText (aDisplayLocale)));
aNavbar.addNav (EBootstrapNavbarPosition.COLLAPSIBLE_RIGHT, aNav);
}
return aNavbar;
}
示例9: onError
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@Override
protected void onError (@Nonnull final Throwable t,
@Nullable final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull @Nonempty final String sErrorCode,
@Nullable final Map <String, String> aCustomAttrs)
{
new InternalErrorBuilder ().setThrowable (t)
.setRequestScope (aRequestScope)
.addErrorMessage (sErrorCode)
.addCustomData (aCustomAttrs)
.handle ();
}
示例10: PEPPOLAS2ApplicationServlet
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
public PEPPOLAS2ApplicationServlet ()
{
final AbstractApplicationXServletHandler aHandler = new AbstractApplicationXServletHandler ()
{
@Override
protected IHTMLProvider createHTMLProvider (final IRequestWebScopeWithoutResponse aRequestScope)
{
return new PEPPOLAS2HtmlProvider ();
}
};
handlerRegistry ().registerHandler (EHttpMethod.GET, aHandler);
}
示例11: handleRequest
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final UnifiedResponse aUnifiedResponse) throws Exception
{
// http://127.0.0.1:8080/participant -> null
// http://127.0.0.1:8080/participant/ -> "/"
// http://127.0.0.1:8080/participant/x -> "/x"
final String sPathInfo = StringHelper.getNotNull (aRequestScope.getPathInfo (), "");
final ICommonsList <String> aParts = StringHelper.getExploded ('/', sPathInfo.substring (1));
IParticipantIdentifier aPI = null;
if (aParts.isNotEmpty ())
{
final String sID = aParts.get (0);
aPI = PDMetaManager.getIdentifierFactory ().parseParticipantIdentifier (sID);
if (aPI == null)
{
// Maybe the scheme is missing
// Check if there is a second part as in
// /participant/iso6523-actorid-upis/9915:test
if (aParts.size () >= 2)
{
final String sScheme = sID;
final String sValue = aParts.get (1);
aPI = PDMetaManager.getIdentifierFactory ().createParticipantIdentifier (sScheme, sValue);
}
}
if (aPI == null)
{
// Still failure - try PEPPOL default scheme
aPI = PDMetaManager.getIdentifierFactory ()
.createParticipantIdentifier (PeppolIdentifierFactory.INSTANCE.getDefaultParticipantIdentifierScheme (),
sID);
}
}
if (aPI == null)
{
s_aLogger.error ("Failed to resolve path '" + sPathInfo + "' to a participant ID!");
aUnifiedResponse.setStatus (HttpServletResponse.SC_NOT_FOUND);
return;
}
// Redirect to search result page
final SimpleURL aTarget = RequestParameterManager.getInstance ()
.getLinkToMenuItem (aRequestScope,
AppCommonUI.DEFAULT_LOCALE,
CMenuPublic.MENU_SEARCH_SIMPLE)
.add (CPageParam.PARAM_ACTION, CPageParam.ACTION_VIEW)
.add (PagePublicSearchSimple.FIELD_QUERY, aPI.getURIEncoded ())
.add (PagePublicSearchSimple.FIELD_PARTICIPANT_ID,
aPI.getURIEncoded ());
aUnifiedResponse.setRedirect (aTarget);
}
示例12: getPageContent
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@SuppressWarnings ("unchecked")
@Nonnull
public static IHCNode getPageContent (@Nonnull final LayoutExecutionContext aLEC)
{
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope ();
// Get the requested menu item
final IMenuItemPage aSelectedMenuItem = aLEC.getSelectedMenuItem ();
// Resolve the page of the selected menu item (if found)
IWebPage <WebPageExecutionContext> aDisplayPage;
if (aSelectedMenuItem.matchesDisplayFilter ())
{
// Only if we have display rights!
aDisplayPage = (IWebPage <WebPageExecutionContext>) aSelectedMenuItem.getPage ();
}
else
{
// No rights -> goto start page
aDisplayPage = (IWebPage <WebPageExecutionContext>) aLEC.getMenuTree ().getDefaultMenuItem ().getPage ();
}
final WebPageExecutionContext aWPEC = new WebPageExecutionContext (aLEC, aDisplayPage);
// Build page content: header + content
final HCNodeList aPageContainer = new HCNodeList ();
// First add the system message
aPageContainer.addChild (BootstrapSystemMessage.createDefault ());
// Handle 404 case here (see error404.jsp)
if ("true".equals (aRequestScope.params ().getAsString ("httpError")))
{
final String sHttpStatusCode = aRequestScope.params ().getAsString ("httpStatusCode");
final String sHttpStatusMessage = aRequestScope.params ().getAsString ("httpStatusMessage");
final String sHttpRequestURI = aRequestScope.params ().getAsString ("httpRequestUri");
aPageContainer.addChild (new BootstrapErrorBox ().addChild ("HTTP error " +
sHttpStatusCode +
" (" +
sHttpStatusMessage +
")" +
(StringHelper.hasText (sHttpRequestURI) ? " for request URI " +
sHttpRequestURI
: "")));
}
else
{
// Add the forced redirect content here
if (aWPEC.params ().containsKey (ForcedRedirectManager.REQUEST_PARAMETER_PRG_ACTIVE))
aPageContainer.addChild ((IHCNode) ForcedRedirectManager.getLastForcedRedirectContent (aDisplayPage.getID ()));
}
// Add page header
aPageContainer.addChild (aDisplayPage.getHeaderNode (aWPEC));
// Main fill page content
aDisplayPage.getContent (aWPEC);
// Add page content to result
aPageContainer.addChild (aWPEC.getNodeList ());
return aPageContainer;
}
示例13: createViewLoginForm
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@Nonnull
public static BootstrapForm createViewLoginForm (@Nonnull final LayoutExecutionContext aLEC,
@Nullable final String sPreselectedUserName,
final boolean bFullUI)
{
final Locale aDisplayLocale = aLEC.getDisplayLocale ();
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope ();
// Use new IDs for both fields, in case the login stuff is displayed more
// than once!
final String sIDUserName = GlobalIDFactory.getNewStringID ();
final String sIDPassword = GlobalIDFactory.getNewStringID ();
final String sIDErrorField = GlobalIDFactory.getNewStringID ();
final BootstrapForm aForm = new BootstrapForm (aLEC).setAction (aLEC.getSelfHref ())
.setFormType (bFullUI ? EBootstrapFormType.HORIZONTAL
: EBootstrapFormType.DEFAULT);
aForm.setLeft (3);
// User name field
aForm.addFormGroup (new BootstrapFormGroup ().setLabel (EPhotonCoreText.EMAIL_ADDRESS.getDisplayText (aDisplayLocale))
.setCtrl (new HCEdit (new RequestField (CLogin.REQUEST_ATTR_USERID,
sPreselectedUserName)).setID (sIDUserName)));
// Password field
aForm.addFormGroup (new BootstrapFormGroup ().setLabel (EPhotonCoreText.LOGIN_FIELD_PASSWORD.getDisplayText (aDisplayLocale))
.setCtrl (new HCEditPassword (CLogin.REQUEST_ATTR_PASSWORD).setID (sIDPassword)));
// Placeholder for error message
aForm.addChild (new HCDiv ().setID (sIDErrorField).addStyle (CCSSProperties.MARGIN.newValue ("4px 0")));
// Login button
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild (new BootstrapButtonToolbar (aLEC));
final JSPackage aOnClick = new JSPackage ();
{
final JSAnonymousFunction aJSSuccess = new JSAnonymousFunction ();
final JSVar aJSData = aJSSuccess.param ("data");
aJSSuccess.body ()
._if (aJSData.ref (AjaxExecutorPublicLogin.JSON_LOGGEDIN),
JSHtml.windowLocationReload (),
JQuery.idRef (sIDErrorField).empty ().append (aJSData.ref (AjaxExecutorPublicLogin.JSON_HTML)));
aOnClick.add (new JQueryAjaxBuilder ().url (CAjax.LOGIN.getInvocationURI (aRequestScope))
.data (new JSAssocArray ().add (CLogin.REQUEST_ATTR_USERID,
JQuery.idRef (sIDUserName).val ())
.add (CLogin.REQUEST_ATTR_PASSWORD,
JQuery.idRef (sIDPassword).val ()))
.success (aJSSuccess)
.build ());
}
aOnClick._return (false);
aToolbar.addSubmitButton (EPhotonCoreText.LOGIN_BUTTON_SUBMIT.getDisplayText (aDisplayLocale), aOnClick);
return aForm;
}
示例14: fillContent
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@Override
protected void fillContent (final WebPageExecutionContext aWPEC)
{
final HCNodeList aNodeList = aWPEC.getNodeList ();
final IRequestWebScopeWithoutResponse aRequestScope = aWPEC.getRequestScope ();
{
final BootstrapButtonToolbar aToolbar = getUIHandler ().createToolbar (aWPEC);
aToolbar.addButton ("Export", m_aExportAll.getInvocationURL (aRequestScope), EDefaultIcon.SAVE);
aNodeList.addChild (aToolbar);
}
final ICommonsSortedSet <IParticipantIdentifier> aAllIDs = PDMetaManager.getStorageMgr ()
.getAllContainedParticipantIDs ();
aNodeList.addChild (new HCH3 ().addChild (aAllIDs.size () + " participants are contained"));
final BootstrapTable aTable = new BootstrapTable (HCCol.star (), HCCol.star (), HCCol.star ()).setCondensed (true)
.setBordered (true);
for (final IParticipantIdentifier aParticipantID : aAllIDs)
{
final String sParticipantID = aParticipantID.getURIEncoded ();
final HCRow aRow = aTable.addBodyRow ();
aRow.addCell (sParticipantID);
final ISimpleURL aShowDetails = aWPEC.getLinkToMenuItem (CApplicationID.APP_ID_PUBLIC,
CMenuPublic.MENU_SEARCH_SIMPLE)
.add (PagePublicSearchSimple.FIELD_QUERY, sParticipantID)
.add (CPageParam.PARAM_ACTION, CPageParam.ACTION_VIEW)
.add (PagePublicSearchSimple.FIELD_PARTICIPANT_ID, sParticipantID);
aRow.addCell (new HCA (aShowDetails).addChild ("Search"));
final ISimpleURL aReIndex = aWPEC.getLinkToMenuItem (CMenuSecure.MENU_INDEX_MANUALLY)
.add (PageSecureIndexManually.FIELD_PARTICIPANT_ID, sParticipantID)
.add (CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aRow.addCell (new HCA (aReIndex).addChild ("Reindex"));
}
if (aTable.hasBodyRows ())
aNodeList.addChild (aTable);
else
aNodeList.addChild (new BootstrapInfoBox ().addChild ("No participant identifier is yet in the index"));
}
示例15: fillHeadAndBody
import com.helger.web.scope.IRequestWebScopeWithoutResponse; //導入依賴的package包/類
@Override
protected void fillHeadAndBody (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final HCHtml aHtml,
@Nonnull final Locale aDisplayLocale)
{
// Add all meta elements
addMetaElements (aRequestScope, aHtml.head ());
aHtml.head ()
.addCSS (new HCStyle ("* { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";}" +
"code { font-family:Menlo,Monaco,Consolas,\"Courier New\",monospace; font-size:1em; padding:2px 4px; font-size:90%; color:#c7254e; background-color:#f9f2f4; border-radius:4px }"));
// Fill the body
final HCBody aBody = aHtml.body ();
aBody.addChild (new HCH1 ().addChild ("as2-peppol-server"));
if (WebAppSettings.isTestVersion ())
aBody.addChild (new HCH2 ().addChild ("TEST version!"));
aBody.addChild (new HCP ().addChild ("This site has no further user interface."));
aBody.addChild (new HCP ().addChild ("The AS2 endpoint is located at ")
.addChild (new HCA (new SimpleURL (aRequestScope.getContextPath () +
PEPPOLAS2ReceiveServlet.SERVLET_DEFAULT_PATH)).addChild (PEPPOLAS2ReceiveServlet.SERVLET_DEFAULT_PATH))
.addChild (" and it can only be accessed via HTTP POST."));
if (GlobalDebug.isDebugMode ())
{
aBody.addChild (new HCH2 ().addChild ("Debug information"));
final HCUL aUL = new HCUL ();
aUL.addItem ()
.addChild ("Incoming AS2 files reside at: ")
.addChild (new HCCode ().addChild (AppSettings.getFolderForReceiving ().getAbsolutePath ()));
aUL.addItem ()
.addChild ("Outgoing AS2 files sent from: ")
.addChild (new HCCode ().addChild (AppSettings.getFolderForSending ().getAbsolutePath ()));
aUL.addItem ()
.addChild ("Key store used: ")
.addChild (new HCCode ().addChild (AppSettings.getKeyStorePath ()))
.addChild (" of type ")
.addChild (new HCCode ().addChild (AppSettings.getKeyStoreType ().getID ()));
aBody.addChild (aUL);
}
aBody.addChild (new HCHR ());
aBody.addChild (new HCP ().addChild ("Open Source Software by ")
.addChild (new HCA ().setHref (new SimpleURL ("https://twitter.com/philiphelger"))
.setTargetBlank ()
.addChild ("@PhilipHelger"))
.addChild (" - ")
.addChild (new HCA ().setHref (new SimpleURL ("https://github.com/phax/as2-peppol-server"))
.setTargetBlank ()
.addChild ("GitHub project")));
}