Search in sources :

Example 26 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class PolicyViewBean method getModelInternal.

@Override
protected AMModel getModelInternal() {
    RequestContext rc = RequestManager.getRequestContext();
    HttpServletRequest req = rc.getRequest();
    return new PolicyModelImpl(req, getPageSessionAttributes());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) RequestContext(com.iplanet.jato.RequestContext) PolicyModelImpl(com.sun.identity.console.policy.model.PolicyModelImpl)

Example 27 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class RealmPropertiesViewBean method getModelInternal.

protected AMModel getModelInternal() {
    RequestContext rc = RequestManager.getRequestContext();
    HttpServletRequest req = rc.getRequest();
    return new RMRealmModelImpl(req, getPageSessionAttributes());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) RequestContext(com.iplanet.jato.RequestContext) RMRealmModelImpl(com.sun.identity.console.realm.model.RMRealmModelImpl)

Example 28 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class ConfigureSalesForceAppsCompleteViewBean method handleButtonDownloadCertRequest.

/**
     * Handles Verification Certificate download button request.
     * Sends Verification Certificate to the ServletResponse output stream.  
     * @param event Request invocation event
     */
public void handleButtonDownloadCertRequest(RequestInvocationEvent event) throws ModelControlException {
    RequestContext reqContext = event.getRequestContext();
    HttpServletResponse resp = reqContext.getResponse();
    String cert = (String) psModel.getValue("PubKey");
    ServletOutputStream op = null;
    try {
        int length = 0;
        op = resp.getOutputStream();
        //  Set the response
        resp.setContentType("application/octet-stream");
        resp.setContentLength(cert.length());
        resp.setHeader("Content-Disposition", "attachment; filename=\"" + "OpenSSOCert.txt" + "\"");
        //  Stream to the requester.
        int BUFSIZE = cert.length();
        byte[] bbuf = new byte[BUFSIZE];
        InputStream is = new ByteArrayInputStream(cert.getBytes());
        DataInputStream in = new DataInputStream(is);
        while ((in != null) && ((length = in.read(bbuf)) != -1)) {
            op.write(bbuf, 0, length);
        }
        in.close();
        op.flush();
    } catch (IOException ex) {
        debug.error("ConfigureSalesForceAppsCompleteViewBean.uploadCert", ex);
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "configure.salesforce.apps.complete.certificate.download.error", ex.getMessage());
    } finally {
        if (op != null) {
            try {
                op.close();
            } catch (IOException ex) {
                debug.error("ConfigureSalesForceAppsCompleteViewBean.uploadCert", ex);
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "configure.SalesForce.apps.complete.certificate.download.error", ex.getMessage());
            }
        }
    }
}
Also used : ServletOutputStream(javax.servlet.ServletOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) DataInputStream(java.io.DataInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) HttpServletResponse(javax.servlet.http.HttpServletResponse) RequestContext(com.iplanet.jato.RequestContext) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream)

Example 29 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class ScriptsViewBean method getModelInternal.

@Override
protected AMModel getModelInternal() {
    RequestContext rc = RequestManager.getRequestContext();
    HttpServletRequest req = rc.getRequest();
    return new AMModelBase(req, getPageSessionAttributes());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) AMModelBase(com.sun.identity.console.base.model.AMModelBase) RequestContext(com.iplanet.jato.RequestContext)

Example 30 with RequestContext

use of com.iplanet.jato.RequestContext in project OpenAM by OpenRock.

the class ServicesViewBean method getModelInternal.

protected AMModel getModelInternal() {
    RequestContext rc = RequestManager.getRequestContext();
    HttpServletRequest req = rc.getRequest();
    return new ServicesModelImpl(req, getPageSessionAttributes());
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServicesModelImpl(com.sun.identity.console.realm.model.ServicesModelImpl) RequestContext(com.iplanet.jato.RequestContext)

Aggregations

RequestContext (com.iplanet.jato.RequestContext)32 HttpServletRequest (javax.servlet.http.HttpServletRequest)20 IOException (java.io.IOException)5 AuthConfigurationModelImpl (com.sun.identity.console.authentication.model.AuthConfigurationModelImpl)3 AuthPropertiesModelImpl (com.sun.identity.console.authentication.model.AuthPropertiesModelImpl)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)3 AMModelBase (com.sun.identity.console.base.model.AMModelBase)3 ISLocaleContext (com.sun.identity.common.ISLocaleContext)2 DelegationModelImpl (com.sun.identity.console.delegation.model.DelegationModelImpl)2 EntityModelImpl (com.sun.identity.console.federation.model.EntityModelImpl)2 RestSTSInstanceModel (com.sun.identity.console.sts.model.RestSTSInstanceModel)2 SoapSTSInstanceModel (com.sun.identity.console.sts.model.SoapSTSInstanceModel)2 PWResetUserValidationModel (com.sun.identity.password.ui.model.PWResetUserValidationModel)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 DataInputStream (java.io.DataInputStream)2 InputStream (java.io.InputStream)2 ServletOutputStream (javax.servlet.ServletOutputStream)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 CompleteRequestException (com.iplanet.jato.CompleteRequestException)1 HiddenField (com.iplanet.jato.view.html.HiddenField)1