Search in sources :

Example 11 with HttpContext

use of com.genexus.internet.HttpContext in project JavaClasses by genexuslabs.

the class GXGridStateHandler method loadGridState.

public void loadGridState() {
    HttpContext httpContext = (HttpContext) context.getHttpContext();
    HttpRequest httpRequest = httpContext.getHttpRequest();
    if (GXutil.strcmp(httpRequest.getMethod(), "GET") == 0) {
        WebSession session = httpContext.getWebSession();
        state = new SdtGridState(context);
        state.fromJSonString(session.getValue(gridName));
        runVarsFromState();
        dirty = true;
    }
}
Also used : HttpRequest(com.genexus.internet.HttpRequest) WebSession(com.genexus.webpanels.WebSession) HttpContext(com.genexus.internet.HttpContext)

Example 12 with HttpContext

use of com.genexus.internet.HttpContext in project JavaClasses by genexuslabs.

the class PDFReportItext method GxSetDocName.

public void GxSetDocName(String docName) {
    this.docName = docName.trim();
    if (this.docName.indexOf('.') < 0)
        this.docName += ".pdf";
    if (!new File(docName).isAbsolute()) {
        // Si el nombre del documento es relativo, veo si hay que agregarle el outputDir
        String outputDir = props.getGeneralProperty(Const.OUTPUT_FILE_DIRECTORY, "").replace(alternateSeparator, File.separatorChar).trim();
        if (!outputDir.equalsIgnoreCase("") && !outputDir.equalsIgnoreCase(".")) {
            if (!outputDir.endsWith(File.separator)) {
                outputDir += File.separator;
            }
            new File(outputDir).mkdirs();
            this.docName = outputDir + this.docName;
        } else {
            if (ModelContext.getModelContext() != null) {
                HttpContext webContext = (HttpContext) ModelContext.getModelContext().getHttpContext();
                if ((webContext != null) && (webContext instanceof HttpContextWeb)) {
                    outputDir = com.genexus.ModelContext.getModelContext().getHttpContext().getDefaultPath() + File.separator;
                    this.docName = outputDir + this.docName;
                }
            }
        }
    }
    if (this.docName.indexOf('.') < 0)
        this.docName += ".pdf";
    if (DEBUG)
        DEBUG_STREAM.println("GxSetDocName: '" + this.docName + "'");
}
Also used : HttpContext(com.genexus.internet.HttpContext) File(java.io.File) HttpContextWeb(com.genexus.webpanels.HttpContextWeb)

Example 13 with HttpContext

use of com.genexus.internet.HttpContext in project JavaClasses by genexuslabs.

the class JavaModelContextExtension method setTimeZone.

public Boolean setTimeZone(ModelContext model, String sTz) {
    HttpContext httpContext = (HttpContext) model.getHttpContext();
    sTz = CommonUtil.rtrim(sTz);
    TimeZone tz = TimeZone.getTimeZone(sTz);
    Boolean ret = tz.getID().equals(sTz);
    if (ret) {
        model.setCurrentTimeZone(tz);
        httpContext.webPutSessionValue("GXTimezone", tz.getID());
    }
    return ret;
}
Also used : TimeZone(java.util.TimeZone) GXTimeZone(com.genexus.util.GXTimeZone) HttpContext(com.genexus.internet.HttpContext)

Example 14 with HttpContext

use of com.genexus.internet.HttpContext in project JavaClasses by genexuslabs.

the class JavaModelContextExtension method initializeSubmitSession.

private static void initializeSubmitSession(ModelContext oldContext, ModelContext newContext) {
    HttpContext httpCtx = (HttpContext) oldContext.getHttpContext();
    HttpContext newHttpCtx = (HttpContext) newContext.getHttpContext();
    if (httpCtx != null && newHttpCtx != null) {
        com.genexus.webpanels.WebSession ws = newHttpCtx.getWebSession();
        for (int i = 0; i < copyKeys.length && ws != null; i++) {
            Object value = httpCtx.getSessionValue(copyKeys[i]);
            if (value != null) {
                ws.setValue(copyKeys[i], value.toString());
            }
        }
    }
}
Also used : HttpContext(com.genexus.internet.HttpContext)

Example 15 with HttpContext

use of com.genexus.internet.HttpContext in project JavaClasses by genexuslabs.

the class JavaModelContextExtension method getTimeZone.

public String getTimeZone(ModelContext context) {
    String TZ = null;
    HttpContext httpContext = (HttpContext) context.getHttpContext();
    if (context != null)
        TZ = (String) httpContext.getSessionValue("GXTimezone");
    if (TZ != null && !TZ.equals(""))
        setTimeZone(context, (String) TZ);
    if (context.getCurrentTimeZone() == null)
        context.setCurrentTimeZone(_getClientTimeZone(context));
    return context.getCurrentTimeZone().getID();
}
Also used : HttpContext(com.genexus.internet.HttpContext)

Aggregations

HttpContext (com.genexus.internet.HttpContext)30 File (java.io.File)5 WebSession (com.genexus.webpanels.WebSession)4 IOException (java.io.IOException)4 ModelContext (com.genexus.ModelContext)3 GXFile (com.genexus.util.GXFile)3 HttpContextWeb (com.genexus.webpanels.HttpContextWeb)3 com.genexus (com.genexus)2 HttpContextNull (com.genexus.internet.HttpContextNull)2 HttpRequest (com.genexus.internet.HttpRequest)2 BufferedInputStream (java.io.BufferedInputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 URL (java.net.URL)2 SQLException (java.sql.SQLException)2 IExtensionModelContext (com.genexus.common.interfaces.IExtensionModelContext)1 IGxJSONAble (com.genexus.internet.IGxJSONAble)1 GXResult (com.genexus.security.GXResult)1 ServletException (com.genexus.servlet.ServletException)1