001: /*
002: * Copyright 2000-2001,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.wsrp4j.util;
018:
019: public final class Constants {
020:
021: // locales
022: public static final String LOCALE_EN_US = "en";
023:
024: public static final String LOCALE_DE_DE = "de";
025:
026: // markup types
027: public static final String MIME_TYPE_HTML = "text/html";
028:
029: // character sets
030: public static final String UTF_8 = "UTF-8";
031:
032: // Constants for URL-Handling
033:
034: // tokens, tags etc.
035: public static final String REWRITE_START = "wsrp_rewrite";
036:
037: public static final String REWRITE_END = "/wsrp_rewrite";
038:
039: public static final String NEXT_PARAM = "&";
040:
041: public static final String NEXT_PARAM_AMP = "&";
042:
043: public static final String EQUALS = "=";
044:
045: public static final String PARAMS_START = "?";
046:
047: public static final String NAMESPACE_START = "_";
048:
049: // replacement tokens
050: public static final String REPLACE_START = "{";
051:
052: public static final String REPLACE_END = "}";
053:
054: // parameter names
055: public static final String URL_TYPE = "wsrp-urlType";
056:
057: public static final String NAVIGATIONAL_STATE = "wsrp-navigationalState";
058:
059: public static final String INTERACTION_STATE = "wsrp-interactionState";
060:
061: public static final String WINDOW_STATE = "wsrp-windowState";
062:
063: public static final String PORTLET_MODE = "wsrp-mode";
064:
065: public static final String URL = "wsrp-url";
066:
067: public static final String FRAGMENT_ID = "wsrp-fragmentID";
068:
069: public static final String SECURE_URL = "wsrp-secureURL";
070:
071: public static final String REWRITE_RESOURCE = "wsrp-requiresRewrite";
072:
073: public static final String FORM_PARAMETERS = "wsrp-formParameters";
074:
075: public static final String PORTLET_HANDLE = "wsrp-portletHandle";
076:
077: public static final String USER_CONTEXT_KEY = "wsrp-userContextKey";
078:
079: public static final String PORTLET_INSTANCE_KEY = "wsrp-portletInstanceKey";
080:
081: public static final String SESSION_ID = "wsrp-sessionID";
082:
083: // parameter values for url type
084: public static final String URL_TYPE_BLOCKINGACTION = "blockingAction";
085:
086: public static final String URL_TYPE_RENDER = "render";
087:
088: public static final String URL_TYPE_RESOURCE = "resource";
089:
090: // constants for parameter checker
091: public static final boolean NILLABLE_TRUE = true;
092:
093: public static final boolean NILLABLE_FALSE = false;
094:
095: // fault names as they appear on the wire
096: public static final String ACCESS_DENIED_FAULT = "AccessDenied";
097:
098: public static final String INCONSISTENT_PARAMETERS_FAULT = "InconsistenParameters";
099:
100: public static final String INVALID_REGISTRATION_FAULT = "InvalidRegistration";
101:
102: public static final String INVALID_COOKIE_FAULT = "InvalidCookie";
103:
104: public static final String INVALID_HANDLE_FAULT = "InvalidHandle";
105:
106: public static final String INVALID_SESSION_FAULT = "InvalidSession";
107:
108: public static final String INVALID_USER_CATEGORY_FAULT = "InvalidUserCategory";
109:
110: public static final String MISSING_PARAMETERS_FAULT = "MissingParameters";
111:
112: public static final String OPERATION_FAILED_FAULT = "OperationFailed";
113:
114: public static final String PORTLET_STATE_CHANGE_REQUIRED_FAULT = "PortletStateChangeRequired";
115:
116: public static final String UNSUPPORTED_LOCALE_FAULT = "UnsupportedLocale";
117:
118: public static final String UNSUPPORTED_MIME_TYPE_FAULT = "UnsupportedMimeType";
119:
120: public static final String UNSUPPORTED_MODE_FAULT = "UnsupportedMode";
121:
122: public static final String UNSUPPORTED_WINDOW_STATE_FAULT = "UnsupportedWindowState";
123:
124: private static final String[] knownParams = new String[] {
125: Constants.NAVIGATIONAL_STATE, Constants.INTERACTION_STATE,
126: Constants.PORTLET_MODE, Constants.WINDOW_STATE,
127: Constants.URL, Constants.FRAGMENT_ID, Constants.SECURE_URL,
128: Constants.URL_TYPE, Constants.PORTLET_HANDLE,
129: Constants.PORTLET_INSTANCE_KEY, Constants.SESSION_ID,
130: Constants.USER_CONTEXT_KEY, Constants.REWRITE_RESOURCE };
131:
132: public static boolean isWsrpURLParam(String param) {
133: if (!param.startsWith("wsrp-"))
134: return false;
135:
136: for (int i = 0; i < knownParams.length; i++)
137: if (param.equalsIgnoreCase(knownParams[i]))
138: return true;
139:
140: return false;
141: }
142:
143: public static String[] getWsrpParameters() {
144: return knownParams;
145: }
146:
147: }
|