Package dk.brics.jwig

Examples of dk.brics.jwig.JWIGException


                    Object value;
                    if (aParsed_request.isFormField()) {
                        try {
                            value = aParsed_request.getString("UTF-8");
                        } catch (UnsupportedEncodingException e) {
                            throw new JWIGException(e);
                        }
                    } else {
                        value = new FileField(aParsed_request);
                    }
                    List<Object> ps = paramslists.get(name);
                    if (ps == null) {
                        ps = new ArrayList<Object>();
                        paramslists.put(name, ps);
                    }
                    ps.add(value);
                }
                Map<String, Object[]> params = new HashMap<String, Object[]>();
                for (Map.Entry<String, List<Object>> es : paramslists.entrySet()) {
                    params.put(es.getKey(), es.getValue().toArray());
                }
                return params;
            } catch (FileUploadException e) {
                throw new JWIGException(e);
            }
        } else {
            if (request.getCharacterEncoding() == null) {
                try {
                    request.setCharacterEncoding("UTF-8");
                } catch (UnsupportedEncodingException e) {
                    throw new JWIGException(e);
                }
            }
            return request.getParameterMap();
        }
    }
View Full Code Here


                send(r);
            } else if (result instanceof URL) {
                try {
                    response.sendRedirect(result.toString());
                } catch (IOException e) {
                    throw new JWIGException(e);
                }
            } else { // TODO: support other return types? (e.g. binary data?)
                throw new JWIGException("Unrecognized return type of web method");
            }
        }
    }
View Full Code Here

                !URL.class.equals(t) &&
                !Parameters.class.equals(t) &&
                !Persistable.class.isAssignableFrom(t)) {
                try {
                    if (!Modifier.isStatic(t.getMethod("valueOf", String.class).getModifiers())) {
                        throw new JWIGException("valueOf(String) must be static for web method parameters: " + m.getName());
                    }
                } catch (NoSuchMethodException e) {
                    throw new JWIGException("web method " + m.getName() + " on " + m.getDeclaringClass() + " parameter does not implement valueOf(String)", e);
                }
            }
        }
        Annotation[][] pa = m.getParameterAnnotations();
        List<String> names = new LinkedList<String>();
        List<String> parameterNames = ParameterNamer.getParameterNames(m);
        for (int i = 0; i < pa.length; i++) {
            String name = null;
            for (Annotation a : pa[i]) {
                if (a.annotationType().equals(ParamName.class)) {
                    name = ((ParamName) a).value();
                }
            }
            if (name == null) { // if at least one parameter has no ParamName annotation, fall back to paranamer
                name = parameterNames.get(i);
                if (name == null) {
                    throw new JWIGException("parameter names not found for web method: " + m.toString());
                }

            }
            names.add(name);
        }
View Full Code Here

        }

        @Override
        void makeURL(StringBuilder b, Map<String, String[]> argmap) {
            if (argmap == null)
                throw new JWIGException("Parameters expected");
            String[] values = argmap.get(param);
            if (values == null)
                throw new JWIGException("Parameter expected: " + param);
            if (values.length != 1)
                throw new JWIGException("One parameter expected: " + param);
            b.append(URLEncoding.encode(values[0]));
            argmap.remove(param);
        }
View Full Code Here

TOP

Related Classes of dk.brics.jwig.JWIGException

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.