Package org.apache.sling.servlets.post

Examples of org.apache.sling.servlets.post.SlingPostOperation


     * Access SlingPostOperation service and register proxy.
     * <p>
     * Called by serviceChanged
     */
    private void register(final ServiceReference serviceReference) {
        final SlingPostOperation service = (SlingPostOperation) this.bundleContext.getService(serviceReference);
        final PostOperationProxy proxy = new PostOperationProxy(service);

        final BundleContext bundleContext = serviceReference.getBundle().getBundleContext();
        final Dictionary<String, Object> props = copyServiceProperties(serviceReference);
        final ServiceRegistration reg = bundleContext.registerService(
View Full Code Here


        // prepare the response
        HtmlResponse htmlResponse = new HtmlResponse();
        htmlResponse.setReferer(request.getHeader("referer"));

        SlingPostOperation operation = getSlingPostOperation(request);
        if (operation == null) {

            htmlResponse.setStatus(
                HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                "Invalid operation specified for POST request");

        } else {

            try {
                operation.run(request, htmlResponse);
            } catch (ResourceNotFoundException rnfe) {
                htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
                    rnfe.getMessage());
            } catch (Throwable throwable) {
                htmlResponse.setError(throwable);
View Full Code Here

        // prepare the response
        HtmlResponse htmlResponse = new HtmlResponse();
        htmlResponse.setReferer(request.getHeader("referer"));

        SlingPostOperation operation = getSlingPostOperation(request);
        if (operation == null) {

            htmlResponse.setStatus(
                HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                "Invalid operation specified for POST request");

        } else {

            final SlingPostProcessor[] processors;
            synchronized ( this.delayedPostProcessors ) {
                processors = this.cachedPostProcessors;
            }
            try {
                operation.run(request, htmlResponse, processors);
            } catch (ResourceNotFoundException rnfe) {
                htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
                    rnfe.getMessage());
            } catch (Throwable throwable) {
                log.debug("Exception while handling POST "
                    + request.getResource().getPath() + " with "
                    + operation.getClass().getName(), throwable);
                htmlResponse.setError(throwable);
            }

        }
View Full Code Here

    }
    }
   
    protected void registerPostOperation(ServiceReference ref) {
      String operationName = (String) ref.getProperty(SlingPostOperation.PROP_OPERATION_NAME);
    SlingPostOperation operation = (SlingPostOperation) this.componentContext.locateService("postOperation", ref);
      synchronized (this.postOperations) {
      this.postOperations.put(operationName, operation);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.servlets.post.SlingPostOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.